@glamsystems/glam-cli 1.0.14-alpha.2 → 1.0.14-alpha.4
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 +211 -178
- package/package.json +2 -2
package/main.js
CHANGED
|
@@ -271,7 +271,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"address":"G1NTcMDYgNLpDwgnrpSZvoSKQu
|
|
|
271
271
|
/***/ ((module) => {
|
|
272
272
|
|
|
273
273
|
"use strict";
|
|
274
|
-
module.exports = /*#__PURE__*/JSON.parse('{"address":"G1NTbnLcjMex9Tjo8ocmNK9S2zBCiGVuxKUUNGhYZztx","metadata":{"name":"ext_bridge","version":"1.0.0","spec":"0.1.0","description":"Bridge integration for GLAM Protocol"},"instructions":[{"name":"add_layerzero_oft_route","discriminator":[53,181,204,38,240,57,218,148],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true},{"name":"glam_protocol_program","address":"GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"}],"args":[{"name":"route","type":{"defined":{"name":"LayerzeroOftRoute"}}}]},{"name":"cleanup_transfer_record","docs":["Closes a finalized transfer record and returns its rent."],"discriminator":[65,224,219,143,99,204,215,6],"accounts":[{"name":"glam_state"},{"name":"glam_signer","writable":true,"signer":true},{"name":"transfer_record","writable":true}],"args":[]},{"name":"commit_oft_transfer","docs":["Verifies the OFT send completed and records the resulting transfer."],"discriminator":[246,116,17,13,64,227,248,78],"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"},{"name":"glam_protocol_program","address":"GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"instructions","address":"Sysvar1nstructions1111111111111111111111111"},{"name":"bridge_registry","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,114,101,103,105,115,116,114,121]},{"kind":"account","path":"glam_state"}]}},{"name":"bridge_session","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,115,101,115,115,105,111,110]},{"kind":"account","path":"glam_state"},{"kind":"arg","path":"args.transfer_id"}]}},{"name":"transfer_record","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,116,114,97,110,115,102,101,114,45,114,101,99,111,114,100]},{"kind":"account","path":"glam_state"},{"kind":"arg","path":"args.transfer_id"}]}},{"name":"source_token_account","writable":true},{"name":"source_mint"},{"name":"auxiliary_token_account","writable":true}],"args":[{"name":"args","type":{"defined":{"name":"CommitOftTransferArgs"}}}]},{"name":"delete_layerzero_oft_route","discriminator":[122,191,90,182,160,67,86,227],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true},{"name":"glam_protocol_program","address":"GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"}],"args":[{"name":"route","type":{"defined":{"name":"LayerzeroOftRoute"}}}]},{"name":"fail_or_cancel_managed_transfer","docs":["Marks a managed inflight transfer as failed or cancelled."],"discriminator":[39,37,213,118,191,18,194,119],"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","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":"glam_protocol_program","address":"GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"bridge_registry","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,114,101,103,105,115,116,114,121]},{"kind":"account","path":"glam_state"}]}},{"name":"transfer_record","writable":true}],"args":[{"name":"failure_reason","type":"u8"}]},{"name":"prepare_oft_transfer","docs":["Prepares the auxiliary token account used by the OFT transfer flow."],"discriminator":[192,75,97,92,178,246,220,8],"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":"bridge_registry","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,114,101,103,105,115,116,114,121]},{"kind":"account","path":"glam_state"}]}},{"name":"bridge_session","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,115,101,115,115,105,111,110]},{"kind":"account","path":"glam_state"},{"kind":"arg","path":"args.transfer_id"}]}},{"name":"source_token_account","writable":true},{"name":"source_mint"},{"name":"auxiliary_token_account","writable":true},{"name":"cpi_program"},{"name":"glam_protocol_program","address":"GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"instructions","address":"Sysvar1nstructions1111111111111111111111111"}],"args":[{"name":"args","type":{"defined":{"name":"PrepareOftTransferArgs"}}}]},{"name":"reconcile_managed_transfer","docs":["Reconciles a managed inflight transfer back into normal pricing state."],"discriminator":[137,31,188,80,28,252,192,50],"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","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":"glam_protocol_program","address":"GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"bridge_registry","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,114,101,103,105,115,116,114,121]},{"kind":"account","path":"glam_state"}]}},{"name":"transfer_record","writable":true}],"args":[]},{"name":"settle_managed_transfer","docs":["Marks a managed inflight transfer as settled on the destination side."],"discriminator":[197,87,37,239,24,244,152,135],"accounts":[{"name":"glam_state"},{"name":"glam_signer","signer":true},{"name":"transfer_record","writable":true}],"args":[]},{"name":"update_layerzero_oft_route","discriminator":[77,162,99,1,182,142,66,172],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true},{"name":"glam_protocol_program","address":"GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"}],"args":[{"name":"route","type":{"defined":{"name":"LayerzeroOftRoute"}}}]}],"accounts":[{"name":"BridgeRegistry","discriminator":[178,207,65,53,51,157,148,202]},{"name":"BridgeSession","discriminator":[235,118,90,227,230,173,141,184]},{"name":"BridgeTransferRecord","discriminator":[46,131,253,32,218,137,45,96]},{"name":"StateAccount","discriminator":[142,247,54,95,85,133,249,103]}],"errors":[{"code":6000,"name":"UnsupportedProtocol","msg":"Unsupported bridge protocol"},{"code":6001,"name":"PolicyNotFound","msg":"A matching bridge policy was not found"},{"code":6002,"name":"AmountTooSmall","msg":"Bridge amount is below the policy minimum"},{"code":6003,"name":"AmountTooLarge","msg":"Bridge amount exceeds the policy maximum"},{"code":6004,"name":"InvalidProviderProgram","msg":"The provider program does not match the approved policy"},{"code":6005,"name":"InvalidSourceTokenAccount","msg":"The source token account is invalid"},{"code":6006,"name":"InvalidSourceBalance","msg":"The source token balance did not change as expected"},{"code":6007,"name":"InvalidProviderReceipt","msg":"The bridge receipt metadata is invalid"},{"code":6008,"name":"InvalidTransferStatus","msg":"The bridge transfer status does not allow this action"},{"code":6009,"name":"TransferNotManaged","msg":"Only managed transfers can use this instruction"},{"code":6010,"name":"MathOverflow","msg":"Arithmetic overflow"},{"code":6011,"name":"InvalidTransferRecord","msg":"The transfer record does not belong to this vault"},{"code":6012,"name":"TooManyProviderInstructions","msg":"Too many provider instructions were supplied"},{"code":6013,"name":"DuplicateBridgeRoute","msg":"Bridge policy contains overlapping duplicate routes"},{"code":6014,"name":"BridgeRouteNotFound","msg":"The bridge route was not found in the existing policy"},{"code":6015,"name":"AmbiguousBridgeRoute","msg":"Multiple bridge routes matched; disambiguate the provider identity"},{"code":6016,"name":"InvalidOftAuxiliaryTokenAccount","msg":"The OFT auxiliary token account is invalid"},{"code":6017,"name":"OftAuxiliaryTokenAccountAlreadyExists","msg":"The OFT auxiliary token account already exists"},{"code":6018,"name":"MissingEndOftInstruction","msg":"Transaction must include a matching commit_oft_transfer instruction"},{"code":6019,"name":"InvalidOftInstructionSet","msg":"The OFT middle instruction set is invalid"},{"code":6020,"name":"InvalidOftAuxiliaryBalance","msg":"The OFT auxiliary token balance did not change as expected"}],"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":"BridgeRegistry","type":{"kind":"struct","fields":[{"name":"glam_state","type":"pubkey"},{"name":"managed_transfer_count","type":"u64"},{"name":"bump","type":"u8"}]}},{"name":"BridgeSession","type":{"kind":"struct","fields":[{"name":"glam_state","type":"pubkey"},{"name":"signer","type":"pubkey"},{"name":"transfer_id","type":{"array":["u8",32]}},{"name":"protocol","type":"u16"},{"name":"managed","type":"bool"},{"name":"source_mint","type":"pubkey"},{"name":"source_token_account","type":"pubkey"},{"name":"provider_program","type":"pubkey"},{"name":"provider_config","type":"pubkey"},{"name":"provider_sender","type":"pubkey"},{"name":"provider_delegate","type":"pubkey"},{"name":"provider_receipt","type":"pubkey"},{"name":"provider_instruction_hash","type":{"array":["u8",32]}},{"name":"provider_instruction_count","type":"u16"},{"name":"source_amount","type":"u64"},{"name":"quoted_out_amount","type":"u64"},{"name":"initial_source_balance","type":"u64"},{"name":"initial_provider_sequence","type":"u64"},{"name":"destination_chain","type":"u16"},{"name":"destination_recipient","type":"pubkey"},{"name":"quote_expires_at","type":"i64"},{"name":"prepared_slot","type":"u64"},{"name":"bump","type":"u8"}]}},{"name":"BridgeTransferRecord","type":{"kind":"struct","fields":[{"name":"glam_state","type":"pubkey"},{"name":"transfer_id","type":{"array":["u8",32]}},{"name":"protocol","type":"u16"},{"name":"status","type":{"defined":{"name":"BridgeTransferStatus"}}},{"name":"managed","type":"bool"},{"name":"receipt_verified","type":"bool"},{"name":"source_mint","type":"pubkey"},{"name":"source_token_account","type":"pubkey"},{"name":"provider_program","type":"pubkey"},{"name":"provider_config","type":"pubkey"},{"name":"source_amount","type":"u64"},{"name":"quoted_out_amount","type":"u64"},{"name":"destination_chain","type":"u16"},{"name":"destination_recipient","type":"pubkey"},{"name":"provider_transfer_id","type":{"array":["u8",32]}},{"name":"provider_emitter","type":"pubkey"},{"name":"provider_sequence","type":"u64"},{"name":"committed_slot","type":"u64"},{"name":"settled_slot","type":"u64"},{"name":"reconciled_slot","type":"u64"},{"name":"failure_reason","type":"u8"},{"name":"bump","type":"u8"}]}},{"name":"BridgeTransferStatus","type":{"kind":"enum","variants":[{"name":"Committed"},{"name":"Settled"},{"name":"Reconciled"},{"name":"Failed"}]}},{"name":"CommitOftTransferArgs","type":{"kind":"struct","fields":[{"name":"transfer_id","type":{"array":["u8",32]}}]}},{"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":"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":"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":"LayerzeroOftRoute","docs":["source_mint, destination_chain, destination_recipient, provider_program uniquely identify a route"],"type":{"kind":"struct","fields":[{"name":"source_mint","type":"pubkey"},{"name":"destination_chain","type":"u32"},{"name":"destination_recipient","type":"pubkey"},{"name":"provider_program","type":"pubkey"},{"name":"management_mode","type":{"defined":{"name":"RouteManagementMode"}}},{"name":"min_amount","type":"u64"},{"name":"max_amount","type":"u64"}]}},{"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":"PrepareOftTransferArgs","type":{"kind":"struct","fields":[{"name":"transfer_id","type":{"array":["u8",32]}},{"name":"middle_instruction_hash","type":{"array":["u8",32]}},{"name":"middle_instruction_count","type":"u16"},{"name":"source_amount","type":"u64"},{"name":"managed","type":"bool"}]}},{"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":"RouteManagementMode","type":{"kind":"enum","variants":[{"name":"UnmanagedOnly"},{"name":"ManagedOnly"},{"name":"Either"}]}},{"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"}]}}],"constants":[{"name":"PROTO_BRIDGE_PERM_RECONCILE","type":"u64","value":"2"},{"name":"PROTO_BRIDGE_PERM_SEND","type":"u64","value":"1"},{"name":"PROTO_LAYERZERO_OFT","type":"u16","value":"4"},{"name":"PROTO_MANAGED_INFLIGHT","type":"u16","value":"4"}]}');
|
|
274
|
+
module.exports = /*#__PURE__*/JSON.parse('{"address":"G1NTbnLcjMex9Tjo8ocmNK9S2zBCiGVuxKUUNGhYZztx","metadata":{"name":"ext_bridge","version":"1.0.0","spec":"0.1.0","description":"Bridge integration for GLAM Protocol"},"instructions":[{"name":"add_layerzero_oft_route","discriminator":[53,181,204,38,240,57,218,148],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true},{"name":"glam_protocol_program","address":"GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"}],"args":[{"name":"route","type":{"defined":{"name":"LayerzeroOftRoute"}}}]},{"name":"commit_oft_transfer","docs":["Verifies the OFT send completed and records the resulting transfer."],"discriminator":[246,116,17,13,64,227,248,78],"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":"cpi_program"},{"name":"glam_protocol_program","address":"GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"},{"name":"instructions","address":"Sysvar1nstructions1111111111111111111111111"},{"name":"bridge_registry","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,114,101,103,105,115,116,114,121]},{"kind":"account","path":"glam_state"}]}},{"name":"bridge_session","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,115,101,115,115,105,111,110]},{"kind":"account","path":"glam_state"},{"kind":"arg","path":"args.transfer_id"}]}},{"name":"source_token_account","writable":true},{"name":"source_mint"},{"name":"auxiliary_token_account","writable":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":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"args","type":{"defined":{"name":"CommitOftTransferArgs"}}}]},{"name":"delete_layerzero_oft_route","discriminator":[122,191,90,182,160,67,86,227],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true},{"name":"glam_protocol_program","address":"GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"}],"args":[{"name":"route","type":{"defined":{"name":"LayerzeroOftRoute"}}}]},{"name":"prepare_oft_transfer","docs":["Prepares the auxiliary token account used by the OFT transfer flow."],"discriminator":[192,75,97,92,178,246,220,8],"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":"bridge_registry","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,114,101,103,105,115,116,114,121]},{"kind":"account","path":"glam_state"}]}},{"name":"bridge_session","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,115,101,115,115,105,111,110]},{"kind":"account","path":"glam_state"},{"kind":"arg","path":"args.transfer_id"}]}},{"name":"source_token_account","writable":true},{"name":"source_mint"},{"name":"auxiliary_token_account","writable":true},{"name":"cpi_program"},{"name":"glam_protocol_program","address":"GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"instructions","address":"Sysvar1nstructions1111111111111111111111111"}],"args":[{"name":"args","type":{"defined":{"name":"PrepareOftTransferArgs"}}}]},{"name":"price_managed_transfers","docs":["Prices managed inflight transfers and publishes aggregated amount."],"discriminator":[77,76,20,48,41,168,205,81],"accounts":[{"name":"glam_state","writable":true},{"name":"bridge_registry","pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,114,101,103,105,115,116,114,121]},{"kind":"account","path":"glam_state"}]}},{"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":"glam_protocol_program","address":"GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"},{"name":"glam_config","pda":{"seeds":[{"kind":"const","value":[103,108,111,98,97,108,45,99,111,110,102,105,103]}],"program":{"kind":"const","value":[10,11,0,83,72,16,46,144,46,42,79,22,157,123,21,242,192,146,1,78,88,59,102,9,190,226,92,189,187,232,83,220]}}},{"name":"base_asset_oracle"}],"args":[]},{"name":"settle_managed_transfer","docs":["Settles a managed inflight transfer and removes it from the registry."],"discriminator":[197,87,37,239,24,244,152,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":"glam_protocol_program","address":"GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"},{"name":"bridge_registry","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,114,101,103,105,115,116,114,121]},{"kind":"account","path":"glam_state"}]}},{"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":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"args","type":{"defined":{"name":"SettleManagedTransferArgs"}}}]},{"name":"update_layerzero_oft_route","discriminator":[77,162,99,1,182,142,66,172],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true},{"name":"glam_protocol_program","address":"GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"}],"args":[{"name":"route","type":{"defined":{"name":"LayerzeroOftRoute"}}}]},{"name":"validate_managed_transfer","docs":["Validates a managed inflight transfer so that it becomes priceable."],"discriminator":[47,86,129,235,30,249,248,42],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","signer":true},{"name":"bridge_registry","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,114,101,103,105,115,116,114,121]},{"kind":"account","path":"glam_state"}]}}],"args":[{"name":"args","type":{"defined":{"name":"ValidateManagedTransferArgs"}}}]}],"accounts":[{"name":"BridgeRegistry","discriminator":[178,207,65,53,51,157,148,202]},{"name":"BridgeSession","discriminator":[235,118,90,227,230,173,141,184]},{"name":"StateAccount","discriminator":[142,247,54,95,85,133,249,103]}],"errors":[{"code":6000,"name":"UnsupportedProtocol","msg":"Unsupported bridge protocol"},{"code":6001,"name":"PolicyNotFound","msg":"A matching bridge policy was not found"},{"code":6002,"name":"AmountTooSmall","msg":"Bridge amount is below the policy minimum"},{"code":6003,"name":"AmountTooLarge","msg":"Bridge amount exceeds the policy maximum"},{"code":6004,"name":"InvalidProviderProgram","msg":"The provider program does not match the approved policy"},{"code":6005,"name":"InvalidSourceTokenAccount","msg":"The source token account is invalid"},{"code":6006,"name":"InvalidSourceBalance","msg":"The source token balance did not change as expected"},{"code":6007,"name":"InvalidProviderReceipt","msg":"The bridge receipt metadata is invalid"},{"code":6008,"name":"InvalidTransferStatus","msg":"The bridge transfer status does not allow this action"},{"code":6009,"name":"TransferNotManaged","msg":"Only managed transfers can use this instruction"},{"code":6010,"name":"MathOverflow","msg":"Arithmetic overflow"},{"code":6011,"name":"InvalidTransferRecord","msg":"The transfer record does not belong to this vault"},{"code":6012,"name":"TooManyProviderInstructions","msg":"Too many provider instructions were supplied"},{"code":6013,"name":"DuplicateBridgeRoute","msg":"Bridge policy contains overlapping duplicate routes"},{"code":6014,"name":"BridgeRouteNotFound","msg":"The bridge route was not found in the existing policy"},{"code":6015,"name":"AmbiguousBridgeRoute","msg":"Multiple bridge routes matched; disambiguate the provider identity"},{"code":6016,"name":"InvalidOftAuxiliaryTokenAccount","msg":"The OFT auxiliary token account is invalid"},{"code":6017,"name":"OftAuxiliaryTokenAccountAlreadyExists","msg":"The OFT auxiliary token account already exists"},{"code":6018,"name":"MissingEndOftInstruction","msg":"Transaction must include a matching commit_oft_transfer instruction"},{"code":6019,"name":"InvalidOftInstructionSet","msg":"The OFT middle instruction set is invalid"},{"code":6020,"name":"InvalidOftAuxiliaryBalance","msg":"The OFT auxiliary token balance did not change as expected"},{"code":6021,"name":"InvalidRemainingAccounts","msg":"The remaining accounts are invalid"},{"code":6022,"name":"DuplicateTransferRecord","msg":"Duplicate transfer record found"},{"code":6023,"name":"TooManyManagedTransfers","msg":"Too many managed transfers are inflight for this vault"},{"code":6024,"name":"InvalidBridgeRegistry","msg":"The bridge registry does not belong to this vault"}],"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":"BridgeManagedTransfer","serialization":"bytemuckunsafe","repr":{"kind":"c"},"type":{"kind":"struct","fields":[{"name":"transfer_id","type":"pubkey"},{"name":"source_mint","type":"pubkey"},{"name":"destination_recipient","type":"pubkey"},{"name":"provider_program","type":"pubkey"},{"name":"provider_config","type":"pubkey"},{"name":"provider_emitter","type":"pubkey"},{"name":"source_amount","type":"u64"},{"name":"quoted_out_amount","type":"u64"},{"name":"provider_sequence","type":"u64"},{"name":"committed_slot","type":"u64"},{"name":"protocol","type":"u16"},{"name":"destination_chain","type":"u16"},{"name":"source_decimals","type":"u8"},{"name":"status","type":"u8"},{"name":"reserved","type":{"array":["u8",2]}}]}},{"name":"BridgeRegistry","serialization":"bytemuckunsafe","repr":{"kind":"c"},"type":{"kind":"struct","fields":[{"name":"glam_state","type":"pubkey"},{"name":"managed_transfer_count","type":"u8"},{"name":"reserved","type":{"array":["u8",7]}},{"name":"transfers","type":{"array":[{"defined":{"name":"BridgeManagedTransfer"}},16]}}]}},{"name":"BridgeSession","type":{"kind":"struct","fields":[{"name":"glam_state","type":"pubkey"},{"name":"signer","type":"pubkey"},{"name":"transfer_id","type":"pubkey"},{"name":"protocol","type":"u16"},{"name":"managed","type":"bool"},{"name":"source_mint","type":"pubkey"},{"name":"source_decimals","type":"u8"},{"name":"source_token_account","type":"pubkey"},{"name":"provider_program","type":"pubkey"},{"name":"provider_config","type":"pubkey"},{"name":"provider_sender","type":"pubkey"},{"name":"provider_delegate","type":"pubkey"},{"name":"provider_receipt","type":"pubkey"},{"name":"provider_instruction_hash","type":{"array":["u8",32]}},{"name":"provider_instruction_count","type":"u16"},{"name":"source_amount","type":"u64"},{"name":"quoted_out_amount","type":"u64"},{"name":"initial_source_balance","type":"u64"},{"name":"initial_provider_sequence","type":"u64"},{"name":"destination_chain","type":"u16"},{"name":"destination_recipient","type":"pubkey"},{"name":"quote_expires_at","type":"i64"},{"name":"prepared_slot","type":"u64"},{"name":"bump","type":"u8"}]}},{"name":"CommitOftTransferArgs","type":{"kind":"struct","fields":[{"name":"transfer_id","type":"pubkey"}]}},{"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":"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":"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":"LayerzeroOftRoute","docs":["source_mint, destination_chain, destination_recipient, provider_program uniquely identify a route"],"type":{"kind":"struct","fields":[{"name":"source_mint","type":"pubkey"},{"name":"destination_chain","type":"u32"},{"name":"destination_recipient","type":"pubkey"},{"name":"provider_program","type":"pubkey"},{"name":"management_mode","type":{"defined":{"name":"RouteManagementMode"}}},{"name":"min_amount","type":"u64"},{"name":"max_amount","type":"u64"}]}},{"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":"PrepareOftTransferArgs","type":{"kind":"struct","fields":[{"name":"transfer_id","type":"pubkey"},{"name":"middle_instruction_hash","type":{"array":["u8",32]}},{"name":"middle_instruction_count","type":"u16"},{"name":"source_amount","type":"u64"},{"name":"managed","type":"bool"}]}},{"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":"RouteManagementMode","type":{"kind":"enum","variants":[{"name":"UnmanagedOnly"},{"name":"ManagedOnly"},{"name":"Either"}]}},{"name":"SettleManagedTransferArgs","type":{"kind":"struct","fields":[{"name":"transfer_id","type":"pubkey"}]}},{"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":"ValidateManagedTransferArgs","type":{"kind":"struct","fields":[{"name":"transfer_id","type":"pubkey"}]}},{"name":"ValuationModel","type":{"kind":"enum","variants":[{"name":"Continuous"},{"name":"Periodic"}]}}],"constants":[{"name":"PROTO_BRIDGE_PERM_SEND","type":"u64","value":"1"},{"name":"PROTO_BRIDGE_PERM_SETTLE","type":"u64","value":"4"},{"name":"PROTO_BRIDGE_PERM_VALIDATE","type":"u64","value":"2"},{"name":"PROTO_LAYERZERO_OFT","type":"u16","value":"4"},{"name":"PROTO_MANAGED_INFLIGHT","type":"u16","value":"4"}]}');
|
|
275
275
|
|
|
276
276
|
/***/ }),
|
|
277
277
|
/* 15 */
|
|
@@ -327,7 +327,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"address":"gstgmvM2o7h7GcScvXymH1oFgW
|
|
|
327
327
|
/***/ ((module) => {
|
|
328
328
|
|
|
329
329
|
"use strict";
|
|
330
|
-
module.exports = /*#__PURE__*/JSON.parse('{"address":"gstgxS9yTioViNKdsM4DC33k1TU9un2VCYDQK8fAeSA","metadata":{"name":"ext_bridge","version":"1.0.0","spec":"0.1.0","description":"Bridge integration for GLAM Protocol"},"instructions":[{"name":"add_layerzero_oft_route","discriminator":[53,181,204,38,240,57,218,148],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"}],"args":[{"name":"route","type":{"defined":{"name":"LayerzeroOftRoute"}}}]},{"name":"cleanup_transfer_record","docs":["Closes a finalized transfer record and returns its rent."],"discriminator":[65,224,219,143,99,204,215,6],"accounts":[{"name":"glam_state"},{"name":"glam_signer","writable":true,"signer":true},{"name":"transfer_record","writable":true}],"args":[]},{"name":"commit_oft_transfer","docs":["Verifies the OFT send completed and records the resulting transfer."],"discriminator":[246,116,17,13,64,227,248,78],"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"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"instructions","address":"Sysvar1nstructions1111111111111111111111111"},{"name":"bridge_registry","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,114,101,103,105,115,116,114,121]},{"kind":"account","path":"glam_state"}]}},{"name":"bridge_session","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,115,101,115,115,105,111,110]},{"kind":"account","path":"glam_state"},{"kind":"arg","path":"args.transfer_id"}]}},{"name":"transfer_record","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,116,114,97,110,115,102,101,114,45,114,101,99,111,114,100]},{"kind":"account","path":"glam_state"},{"kind":"arg","path":"args.transfer_id"}]}},{"name":"source_token_account","writable":true},{"name":"source_mint"},{"name":"auxiliary_token_account","writable":true}],"args":[{"name":"args","type":{"defined":{"name":"CommitOftTransferArgs"}}}]},{"name":"delete_layerzero_oft_route","discriminator":[122,191,90,182,160,67,86,227],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"}],"args":[{"name":"route","type":{"defined":{"name":"LayerzeroOftRoute"}}}]},{"name":"fail_or_cancel_managed_transfer","docs":["Marks a managed inflight transfer as failed or cancelled."],"discriminator":[39,37,213,118,191,18,194,119],"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","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":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"bridge_registry","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,114,101,103,105,115,116,114,121]},{"kind":"account","path":"glam_state"}]}},{"name":"transfer_record","writable":true}],"args":[{"name":"failure_reason","type":"u8"}]},{"name":"prepare_oft_transfer","docs":["Prepares the auxiliary token account used by the OFT transfer flow."],"discriminator":[192,75,97,92,178,246,220,8],"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":"bridge_registry","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,114,101,103,105,115,116,114,121]},{"kind":"account","path":"glam_state"}]}},{"name":"bridge_session","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,115,101,115,115,105,111,110]},{"kind":"account","path":"glam_state"},{"kind":"arg","path":"args.transfer_id"}]}},{"name":"source_token_account","writable":true},{"name":"source_mint"},{"name":"auxiliary_token_account","writable":true},{"name":"cpi_program"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"instructions","address":"Sysvar1nstructions1111111111111111111111111"}],"args":[{"name":"args","type":{"defined":{"name":"PrepareOftTransferArgs"}}}]},{"name":"reconcile_managed_transfer","docs":["Reconciles a managed inflight transfer back into normal pricing state."],"discriminator":[137,31,188,80,28,252,192,50],"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","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":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"bridge_registry","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,114,101,103,105,115,116,114,121]},{"kind":"account","path":"glam_state"}]}},{"name":"transfer_record","writable":true}],"args":[]},{"name":"settle_managed_transfer","docs":["Marks a managed inflight transfer as settled on the destination side."],"discriminator":[197,87,37,239,24,244,152,135],"accounts":[{"name":"glam_state"},{"name":"glam_signer","signer":true},{"name":"transfer_record","writable":true}],"args":[]},{"name":"update_layerzero_oft_route","discriminator":[77,162,99,1,182,142,66,172],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"}],"args":[{"name":"route","type":{"defined":{"name":"LayerzeroOftRoute"}}}]}],"accounts":[{"name":"BridgeRegistry","discriminator":[178,207,65,53,51,157,148,202]},{"name":"BridgeSession","discriminator":[235,118,90,227,230,173,141,184]},{"name":"BridgeTransferRecord","discriminator":[46,131,253,32,218,137,45,96]},{"name":"StateAccount","discriminator":[142,247,54,95,85,133,249,103]}],"errors":[{"code":6000,"name":"UnsupportedProtocol","msg":"Unsupported bridge protocol"},{"code":6001,"name":"PolicyNotFound","msg":"A matching bridge policy was not found"},{"code":6002,"name":"AmountTooSmall","msg":"Bridge amount is below the policy minimum"},{"code":6003,"name":"AmountTooLarge","msg":"Bridge amount exceeds the policy maximum"},{"code":6004,"name":"InvalidProviderProgram","msg":"The provider program does not match the approved policy"},{"code":6005,"name":"InvalidSourceTokenAccount","msg":"The source token account is invalid"},{"code":6006,"name":"InvalidSourceBalance","msg":"The source token balance did not change as expected"},{"code":6007,"name":"InvalidProviderReceipt","msg":"The bridge receipt metadata is invalid"},{"code":6008,"name":"InvalidTransferStatus","msg":"The bridge transfer status does not allow this action"},{"code":6009,"name":"TransferNotManaged","msg":"Only managed transfers can use this instruction"},{"code":6010,"name":"MathOverflow","msg":"Arithmetic overflow"},{"code":6011,"name":"InvalidTransferRecord","msg":"The transfer record does not belong to this vault"},{"code":6012,"name":"TooManyProviderInstructions","msg":"Too many provider instructions were supplied"},{"code":6013,"name":"DuplicateBridgeRoute","msg":"Bridge policy contains overlapping duplicate routes"},{"code":6014,"name":"BridgeRouteNotFound","msg":"The bridge route was not found in the existing policy"},{"code":6015,"name":"AmbiguousBridgeRoute","msg":"Multiple bridge routes matched; disambiguate the provider identity"},{"code":6016,"name":"InvalidOftAuxiliaryTokenAccount","msg":"The OFT auxiliary token account is invalid"},{"code":6017,"name":"OftAuxiliaryTokenAccountAlreadyExists","msg":"The OFT auxiliary token account already exists"},{"code":6018,"name":"MissingEndOftInstruction","msg":"Transaction must include a matching commit_oft_transfer instruction"},{"code":6019,"name":"InvalidOftInstructionSet","msg":"The OFT middle instruction set is invalid"},{"code":6020,"name":"InvalidOftAuxiliaryBalance","msg":"The OFT auxiliary token balance did not change as expected"}],"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":"BridgeRegistry","type":{"kind":"struct","fields":[{"name":"glam_state","type":"pubkey"},{"name":"managed_transfer_count","type":"u64"},{"name":"bump","type":"u8"}]}},{"name":"BridgeSession","type":{"kind":"struct","fields":[{"name":"glam_state","type":"pubkey"},{"name":"signer","type":"pubkey"},{"name":"transfer_id","type":{"array":["u8",32]}},{"name":"protocol","type":"u16"},{"name":"managed","type":"bool"},{"name":"source_mint","type":"pubkey"},{"name":"source_token_account","type":"pubkey"},{"name":"provider_program","type":"pubkey"},{"name":"provider_config","type":"pubkey"},{"name":"provider_sender","type":"pubkey"},{"name":"provider_delegate","type":"pubkey"},{"name":"provider_receipt","type":"pubkey"},{"name":"provider_instruction_hash","type":{"array":["u8",32]}},{"name":"provider_instruction_count","type":"u16"},{"name":"source_amount","type":"u64"},{"name":"quoted_out_amount","type":"u64"},{"name":"initial_source_balance","type":"u64"},{"name":"initial_provider_sequence","type":"u64"},{"name":"destination_chain","type":"u16"},{"name":"destination_recipient","type":"pubkey"},{"name":"quote_expires_at","type":"i64"},{"name":"prepared_slot","type":"u64"},{"name":"bump","type":"u8"}]}},{"name":"BridgeTransferRecord","type":{"kind":"struct","fields":[{"name":"glam_state","type":"pubkey"},{"name":"transfer_id","type":{"array":["u8",32]}},{"name":"protocol","type":"u16"},{"name":"status","type":{"defined":{"name":"BridgeTransferStatus"}}},{"name":"managed","type":"bool"},{"name":"receipt_verified","type":"bool"},{"name":"source_mint","type":"pubkey"},{"name":"source_token_account","type":"pubkey"},{"name":"provider_program","type":"pubkey"},{"name":"provider_config","type":"pubkey"},{"name":"source_amount","type":"u64"},{"name":"quoted_out_amount","type":"u64"},{"name":"destination_chain","type":"u16"},{"name":"destination_recipient","type":"pubkey"},{"name":"provider_transfer_id","type":{"array":["u8",32]}},{"name":"provider_emitter","type":"pubkey"},{"name":"provider_sequence","type":"u64"},{"name":"committed_slot","type":"u64"},{"name":"settled_slot","type":"u64"},{"name":"reconciled_slot","type":"u64"},{"name":"failure_reason","type":"u8"},{"name":"bump","type":"u8"}]}},{"name":"BridgeTransferStatus","type":{"kind":"enum","variants":[{"name":"Committed"},{"name":"Settled"},{"name":"Reconciled"},{"name":"Failed"}]}},{"name":"CommitOftTransferArgs","type":{"kind":"struct","fields":[{"name":"transfer_id","type":{"array":["u8",32]}}]}},{"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":"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":"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":"LayerzeroOftRoute","docs":["source_mint, destination_chain, destination_recipient, provider_program uniquely identify a route"],"type":{"kind":"struct","fields":[{"name":"source_mint","type":"pubkey"},{"name":"destination_chain","type":"u32"},{"name":"destination_recipient","type":"pubkey"},{"name":"provider_program","type":"pubkey"},{"name":"management_mode","type":{"defined":{"name":"RouteManagementMode"}}},{"name":"min_amount","type":"u64"},{"name":"max_amount","type":"u64"}]}},{"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":"PrepareOftTransferArgs","type":{"kind":"struct","fields":[{"name":"transfer_id","type":{"array":["u8",32]}},{"name":"middle_instruction_hash","type":{"array":["u8",32]}},{"name":"middle_instruction_count","type":"u16"},{"name":"source_amount","type":"u64"},{"name":"managed","type":"bool"}]}},{"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":"RouteManagementMode","type":{"kind":"enum","variants":[{"name":"UnmanagedOnly"},{"name":"ManagedOnly"},{"name":"Either"}]}},{"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"}]}}],"constants":[{"name":"PROTO_BRIDGE_PERM_RECONCILE","type":"u64","value":"2"},{"name":"PROTO_BRIDGE_PERM_SEND","type":"u64","value":"1"},{"name":"PROTO_LAYERZERO_OFT","type":"u16","value":"4"},{"name":"PROTO_MANAGED_INFLIGHT","type":"u16","value":"4"}]}');
|
|
330
|
+
module.exports = /*#__PURE__*/JSON.parse('{"address":"gstgxS9yTioViNKdsM4DC33k1TU9un2VCYDQK8fAeSA","metadata":{"name":"ext_bridge","version":"1.0.0","spec":"0.1.0","description":"Bridge integration for GLAM Protocol"},"instructions":[{"name":"add_layerzero_oft_route","discriminator":[53,181,204,38,240,57,218,148],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"}],"args":[{"name":"route","type":{"defined":{"name":"LayerzeroOftRoute"}}}]},{"name":"commit_oft_transfer","docs":["Verifies the OFT send completed and records the resulting transfer."],"discriminator":[246,116,17,13,64,227,248,78],"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":"cpi_program"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"instructions","address":"Sysvar1nstructions1111111111111111111111111"},{"name":"bridge_registry","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,114,101,103,105,115,116,114,121]},{"kind":"account","path":"glam_state"}]}},{"name":"bridge_session","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,115,101,115,115,105,111,110]},{"kind":"account","path":"glam_state"},{"kind":"arg","path":"args.transfer_id"}]}},{"name":"source_token_account","writable":true},{"name":"source_mint"},{"name":"auxiliary_token_account","writable":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":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"args","type":{"defined":{"name":"CommitOftTransferArgs"}}}]},{"name":"delete_layerzero_oft_route","discriminator":[122,191,90,182,160,67,86,227],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"}],"args":[{"name":"route","type":{"defined":{"name":"LayerzeroOftRoute"}}}]},{"name":"prepare_oft_transfer","docs":["Prepares the auxiliary token account used by the OFT transfer flow."],"discriminator":[192,75,97,92,178,246,220,8],"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":"bridge_registry","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,114,101,103,105,115,116,114,121]},{"kind":"account","path":"glam_state"}]}},{"name":"bridge_session","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,115,101,115,115,105,111,110]},{"kind":"account","path":"glam_state"},{"kind":"arg","path":"args.transfer_id"}]}},{"name":"source_token_account","writable":true},{"name":"source_mint"},{"name":"auxiliary_token_account","writable":true},{"name":"cpi_program"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"instructions","address":"Sysvar1nstructions1111111111111111111111111"}],"args":[{"name":"args","type":{"defined":{"name":"PrepareOftTransferArgs"}}}]},{"name":"price_managed_transfers","docs":["Prices managed inflight transfers and publishes aggregated amount."],"discriminator":[77,76,20,48,41,168,205,81],"accounts":[{"name":"glam_state","writable":true},{"name":"bridge_registry","pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,114,101,103,105,115,116,114,121]},{"kind":"account","path":"glam_state"}]}},{"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":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"glam_config","pda":{"seeds":[{"kind":"const","value":[103,108,111,98,97,108,45,99,111,110,102,105,103]}],"program":{"kind":"const","value":[10,11,0,83,72,16,46,144,46,42,79,22,157,123,21,242,192,146,1,78,88,59,102,9,190,226,92,189,187,232,83,220]}}},{"name":"base_asset_oracle"}],"args":[]},{"name":"settle_managed_transfer","docs":["Settles a managed inflight transfer and removes it from the registry."],"discriminator":[197,87,37,239,24,244,152,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":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"bridge_registry","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,114,101,103,105,115,116,114,121]},{"kind":"account","path":"glam_state"}]}},{"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":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"args","type":{"defined":{"name":"SettleManagedTransferArgs"}}}]},{"name":"update_layerzero_oft_route","discriminator":[77,162,99,1,182,142,66,172],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"}],"args":[{"name":"route","type":{"defined":{"name":"LayerzeroOftRoute"}}}]},{"name":"validate_managed_transfer","docs":["Validates a managed inflight transfer so that it becomes priceable."],"discriminator":[47,86,129,235,30,249,248,42],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","signer":true},{"name":"bridge_registry","writable":true,"pda":{"seeds":[{"kind":"const","value":[98,114,105,100,103,101,45,114,101,103,105,115,116,114,121]},{"kind":"account","path":"glam_state"}]}}],"args":[{"name":"args","type":{"defined":{"name":"ValidateManagedTransferArgs"}}}]}],"accounts":[{"name":"BridgeRegistry","discriminator":[178,207,65,53,51,157,148,202]},{"name":"BridgeSession","discriminator":[235,118,90,227,230,173,141,184]},{"name":"StateAccount","discriminator":[142,247,54,95,85,133,249,103]}],"errors":[{"code":6000,"name":"UnsupportedProtocol","msg":"Unsupported bridge protocol"},{"code":6001,"name":"PolicyNotFound","msg":"A matching bridge policy was not found"},{"code":6002,"name":"AmountTooSmall","msg":"Bridge amount is below the policy minimum"},{"code":6003,"name":"AmountTooLarge","msg":"Bridge amount exceeds the policy maximum"},{"code":6004,"name":"InvalidProviderProgram","msg":"The provider program does not match the approved policy"},{"code":6005,"name":"InvalidSourceTokenAccount","msg":"The source token account is invalid"},{"code":6006,"name":"InvalidSourceBalance","msg":"The source token balance did not change as expected"},{"code":6007,"name":"InvalidProviderReceipt","msg":"The bridge receipt metadata is invalid"},{"code":6008,"name":"InvalidTransferStatus","msg":"The bridge transfer status does not allow this action"},{"code":6009,"name":"TransferNotManaged","msg":"Only managed transfers can use this instruction"},{"code":6010,"name":"MathOverflow","msg":"Arithmetic overflow"},{"code":6011,"name":"InvalidTransferRecord","msg":"The transfer record does not belong to this vault"},{"code":6012,"name":"TooManyProviderInstructions","msg":"Too many provider instructions were supplied"},{"code":6013,"name":"DuplicateBridgeRoute","msg":"Bridge policy contains overlapping duplicate routes"},{"code":6014,"name":"BridgeRouteNotFound","msg":"The bridge route was not found in the existing policy"},{"code":6015,"name":"AmbiguousBridgeRoute","msg":"Multiple bridge routes matched; disambiguate the provider identity"},{"code":6016,"name":"InvalidOftAuxiliaryTokenAccount","msg":"The OFT auxiliary token account is invalid"},{"code":6017,"name":"OftAuxiliaryTokenAccountAlreadyExists","msg":"The OFT auxiliary token account already exists"},{"code":6018,"name":"MissingEndOftInstruction","msg":"Transaction must include a matching commit_oft_transfer instruction"},{"code":6019,"name":"InvalidOftInstructionSet","msg":"The OFT middle instruction set is invalid"},{"code":6020,"name":"InvalidOftAuxiliaryBalance","msg":"The OFT auxiliary token balance did not change as expected"},{"code":6021,"name":"InvalidRemainingAccounts","msg":"The remaining accounts are invalid"},{"code":6022,"name":"DuplicateTransferRecord","msg":"Duplicate transfer record found"},{"code":6023,"name":"TooManyManagedTransfers","msg":"Too many managed transfers are inflight for this vault"},{"code":6024,"name":"InvalidBridgeRegistry","msg":"The bridge registry does not belong to this vault"}],"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":"BridgeManagedTransfer","serialization":"bytemuckunsafe","repr":{"kind":"c"},"type":{"kind":"struct","fields":[{"name":"transfer_id","type":"pubkey"},{"name":"source_mint","type":"pubkey"},{"name":"destination_recipient","type":"pubkey"},{"name":"provider_program","type":"pubkey"},{"name":"provider_config","type":"pubkey"},{"name":"provider_emitter","type":"pubkey"},{"name":"source_amount","type":"u64"},{"name":"quoted_out_amount","type":"u64"},{"name":"provider_sequence","type":"u64"},{"name":"committed_slot","type":"u64"},{"name":"protocol","type":"u16"},{"name":"destination_chain","type":"u16"},{"name":"source_decimals","type":"u8"},{"name":"status","type":"u8"},{"name":"reserved","type":{"array":["u8",2]}}]}},{"name":"BridgeRegistry","serialization":"bytemuckunsafe","repr":{"kind":"c"},"type":{"kind":"struct","fields":[{"name":"glam_state","type":"pubkey"},{"name":"managed_transfer_count","type":"u8"},{"name":"reserved","type":{"array":["u8",7]}},{"name":"transfers","type":{"array":[{"defined":{"name":"BridgeManagedTransfer"}},16]}}]}},{"name":"BridgeSession","type":{"kind":"struct","fields":[{"name":"glam_state","type":"pubkey"},{"name":"signer","type":"pubkey"},{"name":"transfer_id","type":"pubkey"},{"name":"protocol","type":"u16"},{"name":"managed","type":"bool"},{"name":"source_mint","type":"pubkey"},{"name":"source_decimals","type":"u8"},{"name":"source_token_account","type":"pubkey"},{"name":"provider_program","type":"pubkey"},{"name":"provider_config","type":"pubkey"},{"name":"provider_sender","type":"pubkey"},{"name":"provider_delegate","type":"pubkey"},{"name":"provider_receipt","type":"pubkey"},{"name":"provider_instruction_hash","type":{"array":["u8",32]}},{"name":"provider_instruction_count","type":"u16"},{"name":"source_amount","type":"u64"},{"name":"quoted_out_amount","type":"u64"},{"name":"initial_source_balance","type":"u64"},{"name":"initial_provider_sequence","type":"u64"},{"name":"destination_chain","type":"u16"},{"name":"destination_recipient","type":"pubkey"},{"name":"quote_expires_at","type":"i64"},{"name":"prepared_slot","type":"u64"},{"name":"bump","type":"u8"}]}},{"name":"CommitOftTransferArgs","type":{"kind":"struct","fields":[{"name":"transfer_id","type":"pubkey"}]}},{"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":"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":"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":"LayerzeroOftRoute","docs":["source_mint, destination_chain, destination_recipient, provider_program uniquely identify a route"],"type":{"kind":"struct","fields":[{"name":"source_mint","type":"pubkey"},{"name":"destination_chain","type":"u32"},{"name":"destination_recipient","type":"pubkey"},{"name":"provider_program","type":"pubkey"},{"name":"management_mode","type":{"defined":{"name":"RouteManagementMode"}}},{"name":"min_amount","type":"u64"},{"name":"max_amount","type":"u64"}]}},{"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":"PrepareOftTransferArgs","type":{"kind":"struct","fields":[{"name":"transfer_id","type":"pubkey"},{"name":"middle_instruction_hash","type":{"array":["u8",32]}},{"name":"middle_instruction_count","type":"u16"},{"name":"source_amount","type":"u64"},{"name":"managed","type":"bool"}]}},{"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":"RouteManagementMode","type":{"kind":"enum","variants":[{"name":"UnmanagedOnly"},{"name":"ManagedOnly"},{"name":"Either"}]}},{"name":"SettleManagedTransferArgs","type":{"kind":"struct","fields":[{"name":"transfer_id","type":"pubkey"}]}},{"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":"ValidateManagedTransferArgs","type":{"kind":"struct","fields":[{"name":"transfer_id","type":"pubkey"}]}},{"name":"ValuationModel","type":{"kind":"enum","variants":[{"name":"Continuous"},{"name":"Periodic"}]}}],"constants":[{"name":"PROTO_BRIDGE_PERM_SEND","type":"u64","value":"1"},{"name":"PROTO_BRIDGE_PERM_SETTLE","type":"u64","value":"4"},{"name":"PROTO_BRIDGE_PERM_VALIDATE","type":"u64","value":"2"},{"name":"PROTO_LAYERZERO_OFT","type":"u16","value":"4"},{"name":"PROTO_MANAGED_INFLIGHT","type":"u16","value":"4"}]}');
|
|
331
331
|
|
|
332
332
|
/***/ }),
|
|
333
333
|
/* 23 */
|
|
@@ -397,6 +397,7 @@ class StateIdlModel {
|
|
|
397
397
|
this.name = data.name ?? null;
|
|
398
398
|
this.uri = data.uri ?? null;
|
|
399
399
|
this.enabled = data.enabled ?? null;
|
|
400
|
+
this.oracleConfigs = data.oracleConfigs ?? null;
|
|
400
401
|
this.assets = data.assets ?? null;
|
|
401
402
|
this.created = data.created ?? null;
|
|
402
403
|
this.owner = data.owner ?? null;
|
|
@@ -3641,7 +3642,7 @@ class GlamClient extends base_1.BaseClient {
|
|
|
3641
3642
|
}
|
|
3642
3643
|
get jupiterSwap() {
|
|
3643
3644
|
if (!this._jupiterSwap) {
|
|
3644
|
-
this._jupiterSwap = new jupiter_1.JupiterSwapClient(this, this.vault);
|
|
3645
|
+
this._jupiterSwap = new jupiter_1.JupiterSwapClient(this, this.vault, this.kaminoLending);
|
|
3645
3646
|
}
|
|
3646
3647
|
return this._jupiterSwap;
|
|
3647
3648
|
}
|
|
@@ -3671,7 +3672,7 @@ class GlamClient extends base_1.BaseClient {
|
|
|
3671
3672
|
}
|
|
3672
3673
|
get price() {
|
|
3673
3674
|
if (!this._price) {
|
|
3674
|
-
this._price = new price_1.PriceClient(this, this.kaminoLending, this.kaminoVaults, () => this.jupiterSwap.jupApi);
|
|
3675
|
+
this._price = new price_1.PriceClient(this, this.kaminoLending, this.kaminoVaults, this.bridge, () => this.jupiterSwap.jupApi);
|
|
3675
3676
|
}
|
|
3676
3677
|
return this._price;
|
|
3677
3678
|
}
|
|
@@ -4672,7 +4673,12 @@ class TxBuilder extends base_1.BaseTxBuilder {
|
|
|
4672
4673
|
const inputStakePool = assets_1.STAKE_POOLS_MAP.get(inputMint.toBase58())?.poolState || null;
|
|
4673
4674
|
const outputStakePool = assets_1.STAKE_POOLS_MAP.get(outputMint.toBase58())?.poolState || null;
|
|
4674
4675
|
const preInstructions = await this.getPreInstructions(glamSigner, inputMint, outputMint, amount, outputTokenProgram);
|
|
4675
|
-
|
|
4676
|
+
if (oracleAccounts?.kaminoReservesToRefresh &&
|
|
4677
|
+
oracleAccounts.kaminoReservesToRefresh.length > 0) {
|
|
4678
|
+
const reserves = await this.client.klend.fetchAndParseReserves(oracleAccounts.kaminoReservesToRefresh);
|
|
4679
|
+
const refreshReservesIx = this.client.klend.txBuilder.refreshReservesBatchIx(reserves, false);
|
|
4680
|
+
preInstructions.push(refreshReservesIx);
|
|
4681
|
+
}
|
|
4676
4682
|
const ix = await this.client.base.protocolProgram.methods
|
|
4677
4683
|
.jupiterSwapV2(skipQuotePriceCheck, swapIx.data)
|
|
4678
4684
|
.accounts({
|
|
@@ -4700,9 +4706,10 @@ class TxBuilder extends base_1.BaseTxBuilder {
|
|
|
4700
4706
|
}
|
|
4701
4707
|
}
|
|
4702
4708
|
class JupiterSwapClient {
|
|
4703
|
-
constructor(base, vault) {
|
|
4709
|
+
constructor(base, vault, klend) {
|
|
4704
4710
|
this.base = base;
|
|
4705
4711
|
this.vault = vault;
|
|
4712
|
+
this.klend = klend;
|
|
4706
4713
|
this.txBuilder = new TxBuilder(this);
|
|
4707
4714
|
this.jupApi =
|
|
4708
4715
|
this.base.jupiterApiClient ||
|
|
@@ -8174,10 +8181,11 @@ class VaultHoldings {
|
|
|
8174
8181
|
}
|
|
8175
8182
|
exports.VaultHoldings = VaultHoldings;
|
|
8176
8183
|
class PriceClient {
|
|
8177
|
-
constructor(base, klend, kvaults, getJupiterApi) {
|
|
8184
|
+
constructor(base, klend, kvaults, bridge, getJupiterApi) {
|
|
8178
8185
|
this.base = base;
|
|
8179
8186
|
this.klend = klend;
|
|
8180
8187
|
this.kvaults = kvaults;
|
|
8188
|
+
this.bridge = bridge;
|
|
8181
8189
|
this.getJupiterApi = getJupiterApi;
|
|
8182
8190
|
this._stateModel = null;
|
|
8183
8191
|
this._lookupTables = new utils_1.PkSet();
|
|
@@ -8803,6 +8811,9 @@ class PriceClient {
|
|
|
8803
8811
|
const epiRefreshIx = await this.priceEpiValidatedPositionsIx();
|
|
8804
8812
|
if (epiRefreshIx)
|
|
8805
8813
|
pricingIxs.push(epiRefreshIx);
|
|
8814
|
+
const priceBridgeIxs = await this.bridge.txBuilder.priceManagedTransfersIxs();
|
|
8815
|
+
if (priceBridgeIxs)
|
|
8816
|
+
pricingIxs.push(...priceBridgeIxs);
|
|
8806
8817
|
return pricingIxs.filter(Boolean);
|
|
8807
8818
|
}
|
|
8808
8819
|
async validateAumIx() {
|
|
@@ -10408,19 +10419,15 @@ const anchor_1 = __webpack_require__(4);
|
|
|
10408
10419
|
const crypto_1 = __webpack_require__(87);
|
|
10409
10420
|
const web3_js_1 = __webpack_require__(5);
|
|
10410
10421
|
const base_1 = __webpack_require__(58);
|
|
10422
|
+
const kamino_1 = __webpack_require__(67);
|
|
10423
|
+
const vault_1 = __webpack_require__(65);
|
|
10411
10424
|
const bridgeRegistry_1 = __webpack_require__(88);
|
|
10412
10425
|
const accounts_1 = __webpack_require__(33);
|
|
10413
10426
|
const lookupTables_1 = __webpack_require__(44);
|
|
10414
10427
|
const integrationPolicies_1 = __webpack_require__(29);
|
|
10428
|
+
const glamPDAs_1 = __webpack_require__(37);
|
|
10415
10429
|
const constants_1 = __webpack_require__(34);
|
|
10416
10430
|
const LAYERZERO_OFT_PROTOCOL = 1 << 2;
|
|
10417
|
-
function toFixedArray32(value, label) {
|
|
10418
|
-
const bytes = Array.from(Buffer.from(value));
|
|
10419
|
-
if (bytes.length !== 32) {
|
|
10420
|
-
throw new Error(`${label} must be exactly 32 bytes`);
|
|
10421
|
-
}
|
|
10422
|
-
return bytes;
|
|
10423
|
-
}
|
|
10424
10431
|
function appendU16Le(parts, value) {
|
|
10425
10432
|
const out = Buffer.alloc(2);
|
|
10426
10433
|
out.writeUInt16LE(value, 0);
|
|
@@ -10513,15 +10520,47 @@ function getBridgeSessionPda(glamState, transferId, bridgeProgramId) {
|
|
|
10513
10520
|
return web3_js_1.PublicKey.findProgramAddressSync([
|
|
10514
10521
|
Buffer.from(constants_1.SEED_BRIDGE_SESSION),
|
|
10515
10522
|
glamState.toBuffer(),
|
|
10516
|
-
|
|
10523
|
+
transferId.toBuffer(),
|
|
10517
10524
|
], bridgeProgramId)[0];
|
|
10518
10525
|
}
|
|
10519
|
-
function
|
|
10520
|
-
return
|
|
10521
|
-
|
|
10522
|
-
|
|
10523
|
-
|
|
10524
|
-
|
|
10526
|
+
function toCount(value) {
|
|
10527
|
+
return anchor_1.BN.isBN(value) ? value.toNumber() : value;
|
|
10528
|
+
}
|
|
10529
|
+
function toBridgeTransferStatus(status) {
|
|
10530
|
+
switch (status) {
|
|
10531
|
+
case 0:
|
|
10532
|
+
return { committed: {} };
|
|
10533
|
+
case 1:
|
|
10534
|
+
return { validated: {} };
|
|
10535
|
+
case 2:
|
|
10536
|
+
return { settled: {} };
|
|
10537
|
+
default:
|
|
10538
|
+
throw new Error(`Unsupported bridge transfer status: ${status}`);
|
|
10539
|
+
}
|
|
10540
|
+
}
|
|
10541
|
+
function getActiveRegistryTransfers(registry) {
|
|
10542
|
+
return registry.transfers.slice(0, toCount(registry.managedTransferCount));
|
|
10543
|
+
}
|
|
10544
|
+
function registryTransferToRecord(transfer, glamState) {
|
|
10545
|
+
return {
|
|
10546
|
+
glamState,
|
|
10547
|
+
transferId: transfer.transferId,
|
|
10548
|
+
protocol: transfer.protocol,
|
|
10549
|
+
status: toBridgeTransferStatus(transfer.status),
|
|
10550
|
+
managed: true,
|
|
10551
|
+
receiptVerified: true,
|
|
10552
|
+
sourceMint: transfer.sourceMint,
|
|
10553
|
+
sourceDecimals: transfer.sourceDecimals,
|
|
10554
|
+
providerProgram: transfer.providerProgram,
|
|
10555
|
+
providerConfig: transfer.providerConfig,
|
|
10556
|
+
sourceAmount: transfer.sourceAmount,
|
|
10557
|
+
quotedOutAmount: transfer.quotedOutAmount,
|
|
10558
|
+
destinationChain: transfer.destinationChain,
|
|
10559
|
+
destinationRecipient: transfer.destinationRecipient,
|
|
10560
|
+
providerEmitter: transfer.providerEmitter,
|
|
10561
|
+
providerSequence: transfer.providerSequence,
|
|
10562
|
+
committedSlot: transfer.committedSlot,
|
|
10563
|
+
};
|
|
10525
10564
|
}
|
|
10526
10565
|
function toRouteManagementModeArg(managementMode) {
|
|
10527
10566
|
if (managementMode &&
|
|
@@ -10565,7 +10604,7 @@ async function deriveOftAuxiliaryAccountSeed(glamState, transferId) {
|
|
|
10565
10604
|
const digest = await sha256(Buffer.concat([
|
|
10566
10605
|
Buffer.from("oft-auxiliary-account"),
|
|
10567
10606
|
glamState.toBuffer(),
|
|
10568
|
-
|
|
10607
|
+
transferId.toBuffer(),
|
|
10569
10608
|
]));
|
|
10570
10609
|
return digest.subarray(0, 16).toString("hex");
|
|
10571
10610
|
}
|
|
@@ -10625,10 +10664,9 @@ class TxBuilder extends base_1.BaseTxBuilder {
|
|
|
10625
10664
|
if (params.providerInstructions.length !== 1) {
|
|
10626
10665
|
throw new Error("OFT transfers require exactly one provider instruction");
|
|
10627
10666
|
}
|
|
10628
|
-
const transferId =
|
|
10667
|
+
const transferId = params.transferId;
|
|
10629
10668
|
const registryPda = getBridgeRegistryPda(this.client.base.statePda, this.client.base.extBridgeProgram.programId);
|
|
10630
10669
|
const sessionPda = getBridgeSessionPda(this.client.base.statePda, transferId, this.client.base.extBridgeProgram.programId);
|
|
10631
|
-
const transferRecordPda = getBridgeTransferRecordPda(this.client.base.statePda, transferId, this.client.base.extBridgeProgram.programId);
|
|
10632
10670
|
const integrationAuthority = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from(constants_1.SEED_INTEGRATION_AUTHORITY)], this.client.base.extBridgeProgram.programId)[0];
|
|
10633
10671
|
const { tokenProgram } = await (0, accounts_1.fetchMintAndTokenProgram)(this.client.base.connection, params.sourceMint);
|
|
10634
10672
|
const sourceTokenAccount = params.sourceTokenAccount ||
|
|
@@ -10684,17 +10722,16 @@ class TxBuilder extends base_1.BaseTxBuilder {
|
|
|
10684
10722
|
glamState: this.client.base.statePda,
|
|
10685
10723
|
glamVault: this.client.base.vaultPda,
|
|
10686
10724
|
glamSigner: txOptions.signer || this.client.base.signer,
|
|
10687
|
-
integrationAuthority,
|
|
10688
10725
|
cpiProgram: tokenProgram,
|
|
10689
10726
|
glamProtocolProgram: this.client.base.protocolProgram.programId,
|
|
10690
|
-
systemProgram: web3_js_1.SystemProgram.programId,
|
|
10691
10727
|
instructions: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
10692
10728
|
bridgeRegistry: registryPda,
|
|
10693
10729
|
bridgeSession: sessionPda,
|
|
10694
|
-
transferRecord: transferRecordPda,
|
|
10695
10730
|
sourceTokenAccount,
|
|
10696
10731
|
sourceMint: params.sourceMint,
|
|
10697
10732
|
auxiliaryTokenAccount,
|
|
10733
|
+
integrationAuthority,
|
|
10734
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
10698
10735
|
});
|
|
10699
10736
|
commitMethod.remainingAccounts(commitRemainingAccounts);
|
|
10700
10737
|
const commitIx = await commitMethod.instruction();
|
|
@@ -10703,11 +10740,62 @@ class TxBuilder extends base_1.BaseTxBuilder {
|
|
|
10703
10740
|
tx,
|
|
10704
10741
|
additionalSigners: params.providerSigners || [],
|
|
10705
10742
|
sessionPda,
|
|
10706
|
-
transferRecordPda,
|
|
10707
10743
|
auxiliaryTokenAccount,
|
|
10708
10744
|
sourceTokenAccount,
|
|
10709
10745
|
};
|
|
10710
10746
|
}
|
|
10747
|
+
async priceManagedTransfersIxs() {
|
|
10748
|
+
const [stateAccount, registry] = await Promise.all([
|
|
10749
|
+
this.client.base.fetchStateAccount(),
|
|
10750
|
+
this.client.fetchRegistry(),
|
|
10751
|
+
]);
|
|
10752
|
+
if (!registry) {
|
|
10753
|
+
throw new Error("Managed bridge registry not initialized");
|
|
10754
|
+
}
|
|
10755
|
+
const transfers = getActiveRegistryTransfers(registry);
|
|
10756
|
+
const [baseAssetMeta, assetMetas] = await Promise.all([
|
|
10757
|
+
this.client.base.getAssetMeta(stateAccount.baseAssetMint),
|
|
10758
|
+
Promise.all(transfers.map(async (transfer) => ({
|
|
10759
|
+
transfer,
|
|
10760
|
+
assetMeta: await this.client.base.getAssetMeta(transfer.sourceMint),
|
|
10761
|
+
}))),
|
|
10762
|
+
]);
|
|
10763
|
+
const integrationAuthority = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from(constants_1.SEED_INTEGRATION_AUTHORITY)], this.client.base.extBridgeProgram.programId)[0];
|
|
10764
|
+
const ixs = [];
|
|
10765
|
+
const kaminoReserveKeys = new Map();
|
|
10766
|
+
[baseAssetMeta, ...assetMetas.map(({ assetMeta }) => assetMeta)].forEach((assetMeta) => {
|
|
10767
|
+
if (assetMeta.oracleSource === "KaminoReserve") {
|
|
10768
|
+
kaminoReserveKeys.set(assetMeta.oracle.toBase58(), assetMeta.oracle);
|
|
10769
|
+
}
|
|
10770
|
+
});
|
|
10771
|
+
if (kaminoReserveKeys.size > 0) {
|
|
10772
|
+
const klend = new kamino_1.KaminoLendingClient(this.client.base, new vault_1.VaultClient(this.client.base));
|
|
10773
|
+
const reserves = await klend.fetchAndParseReserves(Array.from(kaminoReserveKeys.values()));
|
|
10774
|
+
ixs.push(klend.txBuilder.refreshReservesBatchIx(reserves, false));
|
|
10775
|
+
}
|
|
10776
|
+
const remainingAccounts = assetMetas.map(({ assetMeta }) => ({
|
|
10777
|
+
pubkey: assetMeta.oracle,
|
|
10778
|
+
isSigner: false,
|
|
10779
|
+
isWritable: false,
|
|
10780
|
+
}));
|
|
10781
|
+
const priceMethod = this.client.base.extBridgeProgram.methods
|
|
10782
|
+
.priceManagedTransfers()
|
|
10783
|
+
.accountsPartial({
|
|
10784
|
+
glamState: this.client.base.statePda,
|
|
10785
|
+
bridgeRegistry: this.client.getRegistryPda(),
|
|
10786
|
+
integrationAuthority,
|
|
10787
|
+
glamProtocolProgram: this.client.base.protocolProgram.programId,
|
|
10788
|
+
glamConfig: (0, glamPDAs_1.getGlobalConfigPda)(),
|
|
10789
|
+
baseAssetOracle: baseAssetMeta.oracle,
|
|
10790
|
+
});
|
|
10791
|
+
priceMethod.remainingAccounts(remainingAccounts);
|
|
10792
|
+
ixs.push(await priceMethod.instruction());
|
|
10793
|
+
return ixs;
|
|
10794
|
+
}
|
|
10795
|
+
async priceManagedTransfersTx(txOptions = {}) {
|
|
10796
|
+
const ixs = await this.priceManagedTransfersIxs();
|
|
10797
|
+
return await this.buildVersionedTx(ixs, txOptions);
|
|
10798
|
+
}
|
|
10711
10799
|
}
|
|
10712
10800
|
class LayerzeroOftBridgeProtocolClient {
|
|
10713
10801
|
constructor(bridge) {
|
|
@@ -10733,9 +10821,6 @@ class BridgeClient {
|
|
|
10733
10821
|
getSessionPda(transferId) {
|
|
10734
10822
|
return getBridgeSessionPda(this.base.statePda, transferId, this.base.extBridgeProgram.programId);
|
|
10735
10823
|
}
|
|
10736
|
-
getTransferRecordPda(transferId) {
|
|
10737
|
-
return getBridgeTransferRecordPda(this.base.statePda, transferId, this.base.extBridgeProgram.programId);
|
|
10738
|
-
}
|
|
10739
10824
|
getLayerzeroNoncePda(endpointProgram, sender, destinationChain, destinationRecipient) {
|
|
10740
10825
|
return deriveLayerzeroNoncePda(endpointProgram, sender, destinationChain, destinationRecipient);
|
|
10741
10826
|
}
|
|
@@ -10877,7 +10962,21 @@ class BridgeClient {
|
|
|
10877
10962
|
return await this.base.extBridgeProgram.account.bridgeSession.fetchNullable(this.getSessionPda(transferId));
|
|
10878
10963
|
}
|
|
10879
10964
|
async fetchTransferRecord(transferId) {
|
|
10880
|
-
|
|
10965
|
+
const record = await this.fetchTransferRecordNullable(transferId);
|
|
10966
|
+
if (!record) {
|
|
10967
|
+
throw new Error(`Managed bridge transfer not found for transferId ${transferId.toBase58()}`);
|
|
10968
|
+
}
|
|
10969
|
+
return record;
|
|
10970
|
+
}
|
|
10971
|
+
async fetchTransferRecordNullable(transferId) {
|
|
10972
|
+
const registry = await this.fetchRegistry();
|
|
10973
|
+
if (!registry) {
|
|
10974
|
+
return null;
|
|
10975
|
+
}
|
|
10976
|
+
const transfer = getActiveRegistryTransfers(registry).find((candidate) => candidate.transferId.equals(transferId));
|
|
10977
|
+
return transfer
|
|
10978
|
+
? registryTransferToRecord(transfer, this.base.statePda)
|
|
10979
|
+
: null;
|
|
10881
10980
|
}
|
|
10882
10981
|
async addLayerzeroOftRoute(route, txOptions = {}) {
|
|
10883
10982
|
const glamSigner = txOptions.signer || this.base.signer;
|
|
@@ -10909,7 +11008,7 @@ class BridgeClient {
|
|
|
10909
11008
|
return await this.txBuilder.buildOftTransferTx(params, txOptions);
|
|
10910
11009
|
}
|
|
10911
11010
|
async buildLayerzeroOftSendTx(params, txOptions = {}) {
|
|
10912
|
-
const resolvedTransferId = params.transferId || web3_js_1.Keypair.generate().publicKey
|
|
11011
|
+
const resolvedTransferId = params.transferId || web3_js_1.Keypair.generate().publicKey;
|
|
10913
11012
|
const { tokenProgram } = await (0, accounts_1.fetchMintAndTokenProgram)(this.base.connection, params.sourceMint);
|
|
10914
11013
|
const signer = txOptions.signer || this.base.signer;
|
|
10915
11014
|
const sourceTokenAccount = params.sourceTokenAccount ||
|
|
@@ -10972,63 +11071,39 @@ class BridgeClient {
|
|
|
10972
11071
|
};
|
|
10973
11072
|
}
|
|
10974
11073
|
async settleManagedTransfer(transferId, txOptions = {}) {
|
|
10975
|
-
const ix = await this.base.extBridgeProgram.methods
|
|
10976
|
-
.settleManagedTransfer()
|
|
10977
|
-
.accounts({
|
|
10978
|
-
glamState: this.base.statePda,
|
|
10979
|
-
glamSigner: txOptions.signer || this.base.signer,
|
|
10980
|
-
transferRecord: this.getTransferRecordPda(transferId),
|
|
10981
|
-
})
|
|
10982
|
-
.instruction();
|
|
10983
|
-
const tx = await this.txBuilder.buildVersionedTx([ix], txOptions);
|
|
10984
|
-
return await this.base.sendAndConfirm(tx);
|
|
10985
|
-
}
|
|
10986
|
-
async reconcileManagedTransfer(transferId, txOptions = {}) {
|
|
10987
11074
|
const integrationAuthority = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from(constants_1.SEED_INTEGRATION_AUTHORITY)], this.base.extBridgeProgram.programId)[0];
|
|
10988
11075
|
const ix = await this.base.extBridgeProgram.methods
|
|
10989
|
-
.
|
|
10990
|
-
|
|
11076
|
+
.settleManagedTransfer({
|
|
11077
|
+
transferId,
|
|
11078
|
+
})
|
|
11079
|
+
.accountsPartial({
|
|
10991
11080
|
glamState: this.base.statePda,
|
|
10992
|
-
|
|
11081
|
+
glamVault: this.base.vaultPda,
|
|
10993
11082
|
glamSigner: txOptions.signer || this.base.signer,
|
|
10994
|
-
|
|
10995
|
-
|
|
10996
|
-
|
|
10997
|
-
|
|
10998
|
-
transferRecord: this.getTransferRecordPda(transferId),
|
|
11083
|
+
glamProtocolProgram: this.base.protocolProgram.programId,
|
|
11084
|
+
bridgeRegistry: this.getRegistryPda(),
|
|
11085
|
+
integrationAuthority,
|
|
11086
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
10999
11087
|
})
|
|
11000
11088
|
.instruction();
|
|
11001
11089
|
const tx = await this.txBuilder.buildVersionedTx([ix], txOptions);
|
|
11002
11090
|
return await this.base.sendAndConfirm(tx);
|
|
11003
11091
|
}
|
|
11004
|
-
async
|
|
11005
|
-
const integrationAuthority = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from(constants_1.SEED_INTEGRATION_AUTHORITY)], this.base.extBridgeProgram.programId)[0];
|
|
11092
|
+
async validateManagedTransfer(transferId, txOptions = {}) {
|
|
11006
11093
|
const ix = await this.base.extBridgeProgram.methods
|
|
11007
|
-
.
|
|
11094
|
+
.validateManagedTransfer({
|
|
11095
|
+
transferId,
|
|
11096
|
+
})
|
|
11008
11097
|
.accounts({
|
|
11009
11098
|
glamState: this.base.statePda,
|
|
11010
|
-
// glamVault: this.base.vaultPda,
|
|
11011
11099
|
glamSigner: txOptions.signer || this.base.signer,
|
|
11012
|
-
// integrationAuthority,
|
|
11013
|
-
// glamProtocolProgram: this.base.protocolProgram.programId,
|
|
11014
|
-
// systemProgram: SystemProgram.programId,
|
|
11015
|
-
// bridgeRegistry: this.getRegistryPda(),
|
|
11016
|
-
transferRecord: this.getTransferRecordPda(transferId),
|
|
11017
11100
|
})
|
|
11018
11101
|
.instruction();
|
|
11019
11102
|
const tx = await this.txBuilder.buildVersionedTx([ix], txOptions);
|
|
11020
11103
|
return await this.base.sendAndConfirm(tx);
|
|
11021
11104
|
}
|
|
11022
|
-
async
|
|
11023
|
-
const
|
|
11024
|
-
.cleanupTransferRecord()
|
|
11025
|
-
.accounts({
|
|
11026
|
-
glamState: this.base.statePda,
|
|
11027
|
-
glamSigner: txOptions.signer || this.base.signer,
|
|
11028
|
-
transferRecord: this.getTransferRecordPda(transferId),
|
|
11029
|
-
})
|
|
11030
|
-
.instruction();
|
|
11031
|
-
const tx = await this.txBuilder.buildVersionedTx([ix], txOptions);
|
|
11105
|
+
async priceManagedTransfers(txOptions = {}) {
|
|
11106
|
+
const tx = await this.txBuilder.priceManagedTransfersTx(txOptions);
|
|
11032
11107
|
return await this.base.sendAndConfirm(tx);
|
|
11033
11108
|
}
|
|
11034
11109
|
}
|
|
@@ -47580,10 +47655,19 @@ async function getJupiterSwapV2OracleAccounts(context, tokenFrom, tokenTo, optio
|
|
|
47580
47655
|
outputAssetMeta = await context.glamClient.getAssetMeta(tokenTo.address);
|
|
47581
47656
|
}
|
|
47582
47657
|
catch { }
|
|
47658
|
+
// input and output asset metas might be kaminoReserve
|
|
47659
|
+
const kaminoReservesToRefresh = [];
|
|
47660
|
+
if (inputAssetMeta?.oracleSource === "KaminoReserve") {
|
|
47661
|
+
kaminoReservesToRefresh.push(inputAssetMeta.oracle);
|
|
47662
|
+
}
|
|
47663
|
+
if (outputAssetMeta?.oracleSource === "KaminoReserve") {
|
|
47664
|
+
kaminoReservesToRefresh.push(outputAssetMeta.oracle);
|
|
47665
|
+
}
|
|
47583
47666
|
const oracleAccounts = {
|
|
47584
47667
|
solUsdOracle: await context.glamClient.getSolOracle(),
|
|
47585
47668
|
inputTokenOracle: inputAssetMeta?.oracle,
|
|
47586
47669
|
outputTokenOracle: outputAssetMeta?.oracle,
|
|
47670
|
+
kaminoReservesToRefresh,
|
|
47587
47671
|
};
|
|
47588
47672
|
if (!options.skipQuotePriceCheck &&
|
|
47589
47673
|
(!oracleAccounts.inputTokenOracle || !oracleAccounts.outputTokenOracle)) {
|
|
@@ -48975,9 +49059,20 @@ function parseFixedBytes(value, label, expectedLength) {
|
|
|
48975
49059
|
}
|
|
48976
49060
|
return bytes;
|
|
48977
49061
|
}
|
|
49062
|
+
function parseTransferId(value) {
|
|
49063
|
+
try {
|
|
49064
|
+
return new web3_js_1.PublicKey(value.trim());
|
|
49065
|
+
}
|
|
49066
|
+
catch {
|
|
49067
|
+
return new web3_js_1.PublicKey(parseFixedBytes(value, "transferId", 32));
|
|
49068
|
+
}
|
|
49069
|
+
}
|
|
48978
49070
|
function formatBytesHex(value) {
|
|
48979
49071
|
return `0x${Buffer.from(value).toString("hex")}`;
|
|
48980
49072
|
}
|
|
49073
|
+
function formatTransferId(value) {
|
|
49074
|
+
return value.toBase58();
|
|
49075
|
+
}
|
|
48981
49076
|
function parseManagementMode(value) {
|
|
48982
49077
|
switch (value) {
|
|
48983
49078
|
case "managed":
|
|
@@ -49161,15 +49256,15 @@ function installLayerzeroOftCommands(program, context) {
|
|
|
49161
49256
|
});
|
|
49162
49257
|
program
|
|
49163
49258
|
.command("derive-aux-account")
|
|
49164
|
-
.argument("<transfer_id>", "32-byte hex
|
|
49259
|
+
.argument("<transfer_id>", "transfer id pubkey or 32-byte hex/base64")
|
|
49165
49260
|
.argument("<source_mint>")
|
|
49166
49261
|
.option("--signer <pubkey>", "Optional signer override for the derived seed")
|
|
49167
49262
|
.description("Derive the temporary auxiliary token account used during OFT sends")
|
|
49168
49263
|
.action(async (transferId, sourceMint, { signer }) => {
|
|
49169
|
-
const parsedTransferId =
|
|
49264
|
+
const parsedTransferId = parseTransferId(transferId);
|
|
49170
49265
|
const auxiliary = await context.glamClient.bridge.deriveOftAuxiliaryTokenAccount(parsedTransferId, new web3_js_1.PublicKey(sourceMint), signer ? new web3_js_1.PublicKey(signer) : undefined);
|
|
49171
49266
|
printJson({
|
|
49172
|
-
transferId:
|
|
49267
|
+
transferId: parsedTransferId,
|
|
49173
49268
|
seed: auxiliary.seed,
|
|
49174
49269
|
address: auxiliary.address,
|
|
49175
49270
|
tokenProgram: auxiliary.tokenProgram,
|
|
@@ -49200,16 +49295,12 @@ function installLayerzeroOftCommands(program, context) {
|
|
|
49200
49295
|
.option("--source-ata <pubkey>", "Optional explicit source token account")
|
|
49201
49296
|
.option("--managed", "Keep the inflight transfer managed until reconcile", false)
|
|
49202
49297
|
.option("--lookup-table <pubkey>", "Optional extra address lookup table", collectPublicKeys, [])
|
|
49203
|
-
.option("--transfer-id <hex_or_base64>", "Optional 32-byte transfer id")
|
|
49204
49298
|
.option("-y, --yes", "Skip confirmation", false)
|
|
49205
49299
|
.description("Bridge USDT through the checked-in direct LayerZero USDT0 OFT route")
|
|
49206
|
-
.action(async (amount, destinationChain, destinationRecipient, { nativeFee, minAmount, lzTokenFee, options, composeMsg, nonceAccount, sourceAta, managed, lookupTable,
|
|
49207
|
-
const
|
|
49208
|
-
? parseFixedBytes(transferId, "transferId", 32)
|
|
49209
|
-
: web3_js_1.Keypair.generate().publicKey.toBuffer();
|
|
49210
|
-
const transferIdHex = formatBytesHex(resolvedTransferId);
|
|
49300
|
+
.action(async (amount, destinationChain, destinationRecipient, { nativeFee, minAmount, lzTokenFee, options, composeMsg, nonceAccount, sourceAta, managed, lookupTable, yes, }) => {
|
|
49301
|
+
const transferId = web3_js_1.Keypair.generate().publicKey;
|
|
49211
49302
|
await (0, utils_1.executeTxWithErrorHandling)(() => context.glamClient.bridge.oft.send({
|
|
49212
|
-
transferId
|
|
49303
|
+
transferId,
|
|
49213
49304
|
sourceMint: glam_sdk_1.USDT,
|
|
49214
49305
|
sourceAmount: (0, glam_sdk_1.fromUiAmount)(amount, 6),
|
|
49215
49306
|
destinationChain,
|
|
@@ -49238,43 +49329,7 @@ function installLayerzeroOftCommands(program, context) {
|
|
|
49238
49329
|
}), {
|
|
49239
49330
|
skip: yes,
|
|
49240
49331
|
message: `Confirm LayerZero OFT send of ${amount} USDT to ${destinationRecipient} on chain ${destinationChain}?`,
|
|
49241
|
-
}, (txSig) => `LayerZero OFT transfer submitted: ${txSig}\nTransfer ID: ${
|
|
49242
|
-
});
|
|
49243
|
-
program
|
|
49244
|
-
.command("send")
|
|
49245
|
-
.argument("<amount>", "Source amount in UI units", parseFloat)
|
|
49246
|
-
.argument("<source_mint>")
|
|
49247
|
-
.argument("<destination_chain>", "", parseInt)
|
|
49248
|
-
.argument("<destination_recipient>")
|
|
49249
|
-
.requiredOption("--provider-ix-file <path>", "JSON file with serialized provider instructions")
|
|
49250
|
-
.requiredOption("--provider-receipt <pubkey>", "Provider receipt account, usually the LayerZero nonce PDA")
|
|
49251
|
-
.option("--source-ata <pubkey>", "Optional explicit source token account")
|
|
49252
|
-
.option("--managed", "Keep the inflight transfer managed until reconcile", false)
|
|
49253
|
-
.option("--decimals <decimals>", "Source mint decimals", parseInt, 6)
|
|
49254
|
-
.option("--transfer-id <hex_or_base64>", "Optional 32-byte transfer id")
|
|
49255
|
-
.option("-y, --yes", "Skip confirmation", false)
|
|
49256
|
-
.description("Bridge tokens through a LayerZero OFT provider instruction")
|
|
49257
|
-
.action(async (amount, sourceMint, destinationChain, destinationRecipient, { providerIxFile, providerReceipt, sourceAta, managed, decimals, transferId, yes, }) => {
|
|
49258
|
-
const resolvedTransferId = transferId
|
|
49259
|
-
? parseFixedBytes(transferId, "transferId", 32)
|
|
49260
|
-
: web3_js_1.Keypair.generate().publicKey.toBuffer();
|
|
49261
|
-
const transferIdHex = formatBytesHex(resolvedTransferId);
|
|
49262
|
-
const providerIxs = parseInstructionFile(providerIxFile);
|
|
49263
|
-
await (0, utils_1.executeTxWithErrorHandling)(() => context.glamClient.bridge.sendOft({
|
|
49264
|
-
transferId: resolvedTransferId,
|
|
49265
|
-
sourceMint: new web3_js_1.PublicKey(sourceMint),
|
|
49266
|
-
sourceAmount: (0, glam_sdk_1.fromUiAmount)(amount, decimals),
|
|
49267
|
-
providerInstructions: providerIxs.instructions,
|
|
49268
|
-
providerReceipt: new web3_js_1.PublicKey(providerReceipt),
|
|
49269
|
-
sourceTokenAccount: sourceAta
|
|
49270
|
-
? new web3_js_1.PublicKey(sourceAta)
|
|
49271
|
-
: undefined,
|
|
49272
|
-
managed,
|
|
49273
|
-
providerSigners: providerIxs.additionalSigners,
|
|
49274
|
-
}, context.txOptions), {
|
|
49275
|
-
skip: yes,
|
|
49276
|
-
message: `Confirm LayerZero OFT send of ${amount} tokens to ${destinationRecipient} on chain ${destinationChain}?`,
|
|
49277
|
-
}, (txSig) => `LayerZero OFT transfer submitted: ${txSig}\nTransfer ID: ${transferIdHex}`);
|
|
49332
|
+
}, (txSig) => `LayerZero OFT transfer submitted: ${txSig}\nTransfer ID: ${transferId}`);
|
|
49278
49333
|
});
|
|
49279
49334
|
}
|
|
49280
49335
|
function installBridgeCommands(program, context) {
|
|
@@ -49291,93 +49346,71 @@ function installBridgeCommands(program, context) {
|
|
|
49291
49346
|
printJson({
|
|
49292
49347
|
pubkey: registryPda,
|
|
49293
49348
|
...registry,
|
|
49349
|
+
transfers: registry.transfers.slice(0, toSortableNumber(registry.managedTransferCount)),
|
|
49294
49350
|
});
|
|
49295
49351
|
});
|
|
49296
49352
|
program
|
|
49297
49353
|
.command("records")
|
|
49298
49354
|
.description("List bridge transfer records for the active vault")
|
|
49299
49355
|
.action(async () => {
|
|
49300
|
-
const
|
|
49301
|
-
|
|
49302
|
-
|
|
49303
|
-
|
|
49304
|
-
|
|
49305
|
-
|
|
49306
|
-
|
|
49307
|
-
|
|
49308
|
-
printJson(records
|
|
49309
|
-
.map((record) => ({
|
|
49310
|
-
pubkey: record.publicKey,
|
|
49311
|
-
...record.account,
|
|
49312
|
-
}))
|
|
49313
|
-
.sort((left, right) => toSortableNumber(right.committedSlot) -
|
|
49356
|
+
const registry = await context.glamClient.bridge.fetchRegistry();
|
|
49357
|
+
if (!registry) {
|
|
49358
|
+
printJson([]);
|
|
49359
|
+
return;
|
|
49360
|
+
}
|
|
49361
|
+
const records = await Promise.all(registry.transfers
|
|
49362
|
+
.slice(0, toSortableNumber(registry.managedTransferCount))
|
|
49363
|
+
.map((transfer) => context.glamClient.bridge.fetchTransferRecord(transfer.transferId)));
|
|
49364
|
+
printJson(records.sort((left, right) => toSortableNumber(right.committedSlot) -
|
|
49314
49365
|
toSortableNumber(left.committedSlot)));
|
|
49315
49366
|
});
|
|
49316
49367
|
program
|
|
49317
49368
|
.command("record")
|
|
49318
|
-
.argument("<transfer_id>", "32-byte hex
|
|
49369
|
+
.argument("<transfer_id>", "transfer id pubkey or 32-byte hex/base64")
|
|
49319
49370
|
.description("View a single bridge transfer record")
|
|
49320
49371
|
.action(async (transferId) => {
|
|
49321
|
-
const parsedTransferId =
|
|
49322
|
-
const
|
|
49323
|
-
const record = await context.glamClient.extBridgeProgram.account.bridgeTransferRecord.fetchNullable(recordPda);
|
|
49372
|
+
const parsedTransferId = parseTransferId(transferId);
|
|
49373
|
+
const record = await context.glamClient.bridge.fetchTransferRecordNullable(parsedTransferId);
|
|
49324
49374
|
if (!record) {
|
|
49325
|
-
console.error(`Bridge transfer record not found
|
|
49375
|
+
console.error(`Bridge transfer record not found for transfer ${formatTransferId(parsedTransferId)}`);
|
|
49326
49376
|
process.exit(1);
|
|
49327
49377
|
}
|
|
49328
|
-
printJson(
|
|
49329
|
-
pubkey: recordPda,
|
|
49330
|
-
...record,
|
|
49331
|
-
});
|
|
49378
|
+
printJson(record);
|
|
49332
49379
|
});
|
|
49333
49380
|
program
|
|
49334
|
-
.command("
|
|
49335
|
-
.
|
|
49336
|
-
.
|
|
49337
|
-
.
|
|
49338
|
-
const parsedTransferId = parseFixedBytes(transferId, "transferId", 32);
|
|
49339
|
-
const transferIdHex = formatBytesHex(parsedTransferId);
|
|
49340
|
-
await (0, utils_1.executeTxWithErrorHandling)(() => context.glamClient.bridge.settleManagedTransfer(parsedTransferId, context.txOptions), {
|
|
49341
|
-
skip: yes,
|
|
49342
|
-
message: `Confirm marking transfer ${transferIdHex} as settled?`,
|
|
49343
|
-
}, (txSig) => `Transfer settled: ${txSig}`);
|
|
49344
|
-
});
|
|
49345
|
-
program
|
|
49346
|
-
.command("reconcile")
|
|
49347
|
-
.argument("<transfer_id>", "32-byte hex or base64 transfer id")
|
|
49381
|
+
.command("validate")
|
|
49382
|
+
.alias("validate-managed-transfer")
|
|
49383
|
+
.argument("<transfer_id>", "transfer id pubkey or 32-byte hex/base64")
|
|
49384
|
+
.description("Validate a managed bridge transfer")
|
|
49348
49385
|
.option("-y, --yes", "Skip confirmation", false)
|
|
49349
49386
|
.action(async (transferId, { yes }) => {
|
|
49350
|
-
const parsedTransferId =
|
|
49351
|
-
|
|
49352
|
-
await (0, utils_1.executeTxWithErrorHandling)(() => context.glamClient.bridge.reconcileManagedTransfer(parsedTransferId, context.txOptions), {
|
|
49387
|
+
const parsedTransferId = parseTransferId(transferId);
|
|
49388
|
+
await (0, utils_1.executeTxWithErrorHandling)(() => context.glamClient.bridge.validateManagedTransfer(parsedTransferId, context.txOptions), {
|
|
49353
49389
|
skip: yes,
|
|
49354
|
-
message: `Confirm
|
|
49355
|
-
}, (txSig) => `Transfer
|
|
49390
|
+
message: `Confirm validating transfer ${parsedTransferId}?`,
|
|
49391
|
+
}, (txSig) => `Transfer validated: ${txSig}`);
|
|
49356
49392
|
});
|
|
49357
49393
|
program
|
|
49358
|
-
.command("
|
|
49359
|
-
.
|
|
49360
|
-
.argument("<reason>", "Failure reason code", parseInt)
|
|
49394
|
+
.command("price")
|
|
49395
|
+
.description("Price all managed bridge transfers")
|
|
49361
49396
|
.option("-y, --yes", "Skip confirmation", false)
|
|
49362
|
-
.action(async (
|
|
49363
|
-
|
|
49364
|
-
const transferIdHex = formatBytesHex(parsedTransferId);
|
|
49365
|
-
await (0, utils_1.executeTxWithErrorHandling)(() => context.glamClient.bridge.failManagedTransfer(parsedTransferId, reason, context.txOptions), {
|
|
49397
|
+
.action(async ({ yes }) => {
|
|
49398
|
+
await (0, utils_1.executeTxWithErrorHandling)(() => context.glamClient.bridge.priceManagedTransfers(context.txOptions), {
|
|
49366
49399
|
skip: yes,
|
|
49367
|
-
message:
|
|
49368
|
-
}, (txSig) => `
|
|
49400
|
+
message: "Confirm pricing all managed transfers?",
|
|
49401
|
+
}, (txSig) => `Managed transfers priced: ${txSig}`);
|
|
49369
49402
|
});
|
|
49370
49403
|
program
|
|
49371
|
-
.command("
|
|
49372
|
-
.argument("<transfer_id>", "32-byte hex
|
|
49404
|
+
.command("settle")
|
|
49405
|
+
.argument("<transfer_id>", "transfer id pubkey or 32-byte hex/base64")
|
|
49406
|
+
.description("Settle a managed bridge transfer")
|
|
49373
49407
|
.option("-y, --yes", "Skip confirmation", false)
|
|
49374
49408
|
.action(async (transferId, { yes }) => {
|
|
49375
|
-
const parsedTransferId =
|
|
49376
|
-
|
|
49377
|
-
await (0, utils_1.executeTxWithErrorHandling)(() => context.glamClient.bridge.cleanupTransferRecord(parsedTransferId, context.txOptions), {
|
|
49409
|
+
const parsedTransferId = parseTransferId(transferId);
|
|
49410
|
+
await (0, utils_1.executeTxWithErrorHandling)(() => context.glamClient.bridge.settleManagedTransfer(parsedTransferId, context.txOptions), {
|
|
49378
49411
|
skip: yes,
|
|
49379
|
-
message: `Confirm
|
|
49380
|
-
}, (txSig) => `Transfer
|
|
49412
|
+
message: `Confirm settling transfer ${parsedTransferId}?`,
|
|
49413
|
+
}, (txSig) => `Transfer settled: ${txSig}`);
|
|
49381
49414
|
});
|
|
49382
49415
|
const oft = program.command("oft").description("LayerZero OFT");
|
|
49383
49416
|
installLayerzeroOftCommands(oft, context);
|
|
@@ -50308,7 +50341,7 @@ program
|
|
|
50308
50341
|
initialize(config, skipSimulation);
|
|
50309
50342
|
await (0, idl_1.idlCheck)(context.glamClient);
|
|
50310
50343
|
})
|
|
50311
|
-
.version("1.0.14-alpha.
|
|
50344
|
+
.version("1.0.14-alpha.4");
|
|
50312
50345
|
program
|
|
50313
50346
|
.command("env")
|
|
50314
50347
|
.description("Display current environment setup")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glamsystems/glam-cli",
|
|
3
|
-
"version": "1.0.14-alpha.
|
|
3
|
+
"version": "1.0.14-alpha.4",
|
|
4
4
|
"description": "CLI for interacting with the GLAM Protocol",
|
|
5
5
|
"main": "./main.js",
|
|
6
6
|
"bin": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"node": ">=20.20.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@glamsystems/glam-sdk": "1.0.14-alpha.
|
|
24
|
+
"@glamsystems/glam-sdk": "1.0.14-alpha.4",
|
|
25
25
|
"@switchboard-xyz/common": "^3.0.0",
|
|
26
26
|
"commander": "^11.1.0",
|
|
27
27
|
"decimal.js": "^10.6.0",
|