@glamsystems/glam-cli 1.0.14-alpha.2 → 1.0.14-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/main.js +193 -175
- 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;
|
|
@@ -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
|
}
|
|
@@ -8174,10 +8175,11 @@ class VaultHoldings {
|
|
|
8174
8175
|
}
|
|
8175
8176
|
exports.VaultHoldings = VaultHoldings;
|
|
8176
8177
|
class PriceClient {
|
|
8177
|
-
constructor(base, klend, kvaults, getJupiterApi) {
|
|
8178
|
+
constructor(base, klend, kvaults, bridge, getJupiterApi) {
|
|
8178
8179
|
this.base = base;
|
|
8179
8180
|
this.klend = klend;
|
|
8180
8181
|
this.kvaults = kvaults;
|
|
8182
|
+
this.bridge = bridge;
|
|
8181
8183
|
this.getJupiterApi = getJupiterApi;
|
|
8182
8184
|
this._stateModel = null;
|
|
8183
8185
|
this._lookupTables = new utils_1.PkSet();
|
|
@@ -8803,6 +8805,9 @@ class PriceClient {
|
|
|
8803
8805
|
const epiRefreshIx = await this.priceEpiValidatedPositionsIx();
|
|
8804
8806
|
if (epiRefreshIx)
|
|
8805
8807
|
pricingIxs.push(epiRefreshIx);
|
|
8808
|
+
const priceBridgeIxs = await this.bridge.txBuilder.priceManagedTransfersIxs();
|
|
8809
|
+
if (priceBridgeIxs)
|
|
8810
|
+
pricingIxs.push(...priceBridgeIxs);
|
|
8806
8811
|
return pricingIxs.filter(Boolean);
|
|
8807
8812
|
}
|
|
8808
8813
|
async validateAumIx() {
|
|
@@ -10408,19 +10413,15 @@ const anchor_1 = __webpack_require__(4);
|
|
|
10408
10413
|
const crypto_1 = __webpack_require__(87);
|
|
10409
10414
|
const web3_js_1 = __webpack_require__(5);
|
|
10410
10415
|
const base_1 = __webpack_require__(58);
|
|
10416
|
+
const kamino_1 = __webpack_require__(67);
|
|
10417
|
+
const vault_1 = __webpack_require__(65);
|
|
10411
10418
|
const bridgeRegistry_1 = __webpack_require__(88);
|
|
10412
10419
|
const accounts_1 = __webpack_require__(33);
|
|
10413
10420
|
const lookupTables_1 = __webpack_require__(44);
|
|
10414
10421
|
const integrationPolicies_1 = __webpack_require__(29);
|
|
10422
|
+
const glamPDAs_1 = __webpack_require__(37);
|
|
10415
10423
|
const constants_1 = __webpack_require__(34);
|
|
10416
10424
|
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
10425
|
function appendU16Le(parts, value) {
|
|
10425
10426
|
const out = Buffer.alloc(2);
|
|
10426
10427
|
out.writeUInt16LE(value, 0);
|
|
@@ -10513,15 +10514,47 @@ function getBridgeSessionPda(glamState, transferId, bridgeProgramId) {
|
|
|
10513
10514
|
return web3_js_1.PublicKey.findProgramAddressSync([
|
|
10514
10515
|
Buffer.from(constants_1.SEED_BRIDGE_SESSION),
|
|
10515
10516
|
glamState.toBuffer(),
|
|
10516
|
-
|
|
10517
|
+
transferId.toBuffer(),
|
|
10517
10518
|
], bridgeProgramId)[0];
|
|
10518
10519
|
}
|
|
10519
|
-
function
|
|
10520
|
-
return
|
|
10521
|
-
|
|
10522
|
-
|
|
10523
|
-
|
|
10524
|
-
|
|
10520
|
+
function toCount(value) {
|
|
10521
|
+
return anchor_1.BN.isBN(value) ? value.toNumber() : value;
|
|
10522
|
+
}
|
|
10523
|
+
function toBridgeTransferStatus(status) {
|
|
10524
|
+
switch (status) {
|
|
10525
|
+
case 0:
|
|
10526
|
+
return { committed: {} };
|
|
10527
|
+
case 1:
|
|
10528
|
+
return { validated: {} };
|
|
10529
|
+
case 2:
|
|
10530
|
+
return { settled: {} };
|
|
10531
|
+
default:
|
|
10532
|
+
throw new Error(`Unsupported bridge transfer status: ${status}`);
|
|
10533
|
+
}
|
|
10534
|
+
}
|
|
10535
|
+
function getActiveRegistryTransfers(registry) {
|
|
10536
|
+
return registry.transfers.slice(0, toCount(registry.managedTransferCount));
|
|
10537
|
+
}
|
|
10538
|
+
function registryTransferToRecord(transfer, glamState) {
|
|
10539
|
+
return {
|
|
10540
|
+
glamState,
|
|
10541
|
+
transferId: transfer.transferId,
|
|
10542
|
+
protocol: transfer.protocol,
|
|
10543
|
+
status: toBridgeTransferStatus(transfer.status),
|
|
10544
|
+
managed: true,
|
|
10545
|
+
receiptVerified: true,
|
|
10546
|
+
sourceMint: transfer.sourceMint,
|
|
10547
|
+
sourceDecimals: transfer.sourceDecimals,
|
|
10548
|
+
providerProgram: transfer.providerProgram,
|
|
10549
|
+
providerConfig: transfer.providerConfig,
|
|
10550
|
+
sourceAmount: transfer.sourceAmount,
|
|
10551
|
+
quotedOutAmount: transfer.quotedOutAmount,
|
|
10552
|
+
destinationChain: transfer.destinationChain,
|
|
10553
|
+
destinationRecipient: transfer.destinationRecipient,
|
|
10554
|
+
providerEmitter: transfer.providerEmitter,
|
|
10555
|
+
providerSequence: transfer.providerSequence,
|
|
10556
|
+
committedSlot: transfer.committedSlot,
|
|
10557
|
+
};
|
|
10525
10558
|
}
|
|
10526
10559
|
function toRouteManagementModeArg(managementMode) {
|
|
10527
10560
|
if (managementMode &&
|
|
@@ -10565,7 +10598,7 @@ async function deriveOftAuxiliaryAccountSeed(glamState, transferId) {
|
|
|
10565
10598
|
const digest = await sha256(Buffer.concat([
|
|
10566
10599
|
Buffer.from("oft-auxiliary-account"),
|
|
10567
10600
|
glamState.toBuffer(),
|
|
10568
|
-
|
|
10601
|
+
transferId.toBuffer(),
|
|
10569
10602
|
]));
|
|
10570
10603
|
return digest.subarray(0, 16).toString("hex");
|
|
10571
10604
|
}
|
|
@@ -10625,10 +10658,9 @@ class TxBuilder extends base_1.BaseTxBuilder {
|
|
|
10625
10658
|
if (params.providerInstructions.length !== 1) {
|
|
10626
10659
|
throw new Error("OFT transfers require exactly one provider instruction");
|
|
10627
10660
|
}
|
|
10628
|
-
const transferId =
|
|
10661
|
+
const transferId = params.transferId;
|
|
10629
10662
|
const registryPda = getBridgeRegistryPda(this.client.base.statePda, this.client.base.extBridgeProgram.programId);
|
|
10630
10663
|
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
10664
|
const integrationAuthority = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from(constants_1.SEED_INTEGRATION_AUTHORITY)], this.client.base.extBridgeProgram.programId)[0];
|
|
10633
10665
|
const { tokenProgram } = await (0, accounts_1.fetchMintAndTokenProgram)(this.client.base.connection, params.sourceMint);
|
|
10634
10666
|
const sourceTokenAccount = params.sourceTokenAccount ||
|
|
@@ -10684,17 +10716,16 @@ class TxBuilder extends base_1.BaseTxBuilder {
|
|
|
10684
10716
|
glamState: this.client.base.statePda,
|
|
10685
10717
|
glamVault: this.client.base.vaultPda,
|
|
10686
10718
|
glamSigner: txOptions.signer || this.client.base.signer,
|
|
10687
|
-
integrationAuthority,
|
|
10688
10719
|
cpiProgram: tokenProgram,
|
|
10689
10720
|
glamProtocolProgram: this.client.base.protocolProgram.programId,
|
|
10690
|
-
systemProgram: web3_js_1.SystemProgram.programId,
|
|
10691
10721
|
instructions: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
10692
10722
|
bridgeRegistry: registryPda,
|
|
10693
10723
|
bridgeSession: sessionPda,
|
|
10694
|
-
transferRecord: transferRecordPda,
|
|
10695
10724
|
sourceTokenAccount,
|
|
10696
10725
|
sourceMint: params.sourceMint,
|
|
10697
10726
|
auxiliaryTokenAccount,
|
|
10727
|
+
integrationAuthority,
|
|
10728
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
10698
10729
|
});
|
|
10699
10730
|
commitMethod.remainingAccounts(commitRemainingAccounts);
|
|
10700
10731
|
const commitIx = await commitMethod.instruction();
|
|
@@ -10703,11 +10734,62 @@ class TxBuilder extends base_1.BaseTxBuilder {
|
|
|
10703
10734
|
tx,
|
|
10704
10735
|
additionalSigners: params.providerSigners || [],
|
|
10705
10736
|
sessionPda,
|
|
10706
|
-
transferRecordPda,
|
|
10707
10737
|
auxiliaryTokenAccount,
|
|
10708
10738
|
sourceTokenAccount,
|
|
10709
10739
|
};
|
|
10710
10740
|
}
|
|
10741
|
+
async priceManagedTransfersIxs() {
|
|
10742
|
+
const [stateAccount, registry] = await Promise.all([
|
|
10743
|
+
this.client.base.fetchStateAccount(),
|
|
10744
|
+
this.client.fetchRegistry(),
|
|
10745
|
+
]);
|
|
10746
|
+
if (!registry) {
|
|
10747
|
+
throw new Error("Managed bridge registry not initialized");
|
|
10748
|
+
}
|
|
10749
|
+
const transfers = getActiveRegistryTransfers(registry);
|
|
10750
|
+
const [baseAssetMeta, assetMetas] = await Promise.all([
|
|
10751
|
+
this.client.base.getAssetMeta(stateAccount.baseAssetMint),
|
|
10752
|
+
Promise.all(transfers.map(async (transfer) => ({
|
|
10753
|
+
transfer,
|
|
10754
|
+
assetMeta: await this.client.base.getAssetMeta(transfer.sourceMint),
|
|
10755
|
+
}))),
|
|
10756
|
+
]);
|
|
10757
|
+
const integrationAuthority = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from(constants_1.SEED_INTEGRATION_AUTHORITY)], this.client.base.extBridgeProgram.programId)[0];
|
|
10758
|
+
const ixs = [];
|
|
10759
|
+
const kaminoReserveKeys = new Map();
|
|
10760
|
+
[baseAssetMeta, ...assetMetas.map(({ assetMeta }) => assetMeta)].forEach((assetMeta) => {
|
|
10761
|
+
if (assetMeta.oracleSource === "KaminoReserve") {
|
|
10762
|
+
kaminoReserveKeys.set(assetMeta.oracle.toBase58(), assetMeta.oracle);
|
|
10763
|
+
}
|
|
10764
|
+
});
|
|
10765
|
+
if (kaminoReserveKeys.size > 0) {
|
|
10766
|
+
const klend = new kamino_1.KaminoLendingClient(this.client.base, new vault_1.VaultClient(this.client.base));
|
|
10767
|
+
const reserves = await klend.fetchAndParseReserves(Array.from(kaminoReserveKeys.values()));
|
|
10768
|
+
ixs.push(klend.txBuilder.refreshReservesBatchIx(reserves, false));
|
|
10769
|
+
}
|
|
10770
|
+
const remainingAccounts = assetMetas.map(({ assetMeta }) => ({
|
|
10771
|
+
pubkey: assetMeta.oracle,
|
|
10772
|
+
isSigner: false,
|
|
10773
|
+
isWritable: false,
|
|
10774
|
+
}));
|
|
10775
|
+
const priceMethod = this.client.base.extBridgeProgram.methods
|
|
10776
|
+
.priceManagedTransfers()
|
|
10777
|
+
.accountsPartial({
|
|
10778
|
+
glamState: this.client.base.statePda,
|
|
10779
|
+
bridgeRegistry: this.client.getRegistryPda(),
|
|
10780
|
+
integrationAuthority,
|
|
10781
|
+
glamProtocolProgram: this.client.base.protocolProgram.programId,
|
|
10782
|
+
glamConfig: (0, glamPDAs_1.getGlobalConfigPda)(),
|
|
10783
|
+
baseAssetOracle: baseAssetMeta.oracle,
|
|
10784
|
+
});
|
|
10785
|
+
priceMethod.remainingAccounts(remainingAccounts);
|
|
10786
|
+
ixs.push(await priceMethod.instruction());
|
|
10787
|
+
return ixs;
|
|
10788
|
+
}
|
|
10789
|
+
async priceManagedTransfersTx(txOptions = {}) {
|
|
10790
|
+
const ixs = await this.priceManagedTransfersIxs();
|
|
10791
|
+
return await this.buildVersionedTx(ixs, txOptions);
|
|
10792
|
+
}
|
|
10711
10793
|
}
|
|
10712
10794
|
class LayerzeroOftBridgeProtocolClient {
|
|
10713
10795
|
constructor(bridge) {
|
|
@@ -10733,9 +10815,6 @@ class BridgeClient {
|
|
|
10733
10815
|
getSessionPda(transferId) {
|
|
10734
10816
|
return getBridgeSessionPda(this.base.statePda, transferId, this.base.extBridgeProgram.programId);
|
|
10735
10817
|
}
|
|
10736
|
-
getTransferRecordPda(transferId) {
|
|
10737
|
-
return getBridgeTransferRecordPda(this.base.statePda, transferId, this.base.extBridgeProgram.programId);
|
|
10738
|
-
}
|
|
10739
10818
|
getLayerzeroNoncePda(endpointProgram, sender, destinationChain, destinationRecipient) {
|
|
10740
10819
|
return deriveLayerzeroNoncePda(endpointProgram, sender, destinationChain, destinationRecipient);
|
|
10741
10820
|
}
|
|
@@ -10877,7 +10956,21 @@ class BridgeClient {
|
|
|
10877
10956
|
return await this.base.extBridgeProgram.account.bridgeSession.fetchNullable(this.getSessionPda(transferId));
|
|
10878
10957
|
}
|
|
10879
10958
|
async fetchTransferRecord(transferId) {
|
|
10880
|
-
|
|
10959
|
+
const record = await this.fetchTransferRecordNullable(transferId);
|
|
10960
|
+
if (!record) {
|
|
10961
|
+
throw new Error(`Managed bridge transfer not found for transferId ${transferId.toBase58()}`);
|
|
10962
|
+
}
|
|
10963
|
+
return record;
|
|
10964
|
+
}
|
|
10965
|
+
async fetchTransferRecordNullable(transferId) {
|
|
10966
|
+
const registry = await this.fetchRegistry();
|
|
10967
|
+
if (!registry) {
|
|
10968
|
+
return null;
|
|
10969
|
+
}
|
|
10970
|
+
const transfer = getActiveRegistryTransfers(registry).find((candidate) => candidate.transferId.equals(transferId));
|
|
10971
|
+
return transfer
|
|
10972
|
+
? registryTransferToRecord(transfer, this.base.statePda)
|
|
10973
|
+
: null;
|
|
10881
10974
|
}
|
|
10882
10975
|
async addLayerzeroOftRoute(route, txOptions = {}) {
|
|
10883
10976
|
const glamSigner = txOptions.signer || this.base.signer;
|
|
@@ -10909,7 +11002,7 @@ class BridgeClient {
|
|
|
10909
11002
|
return await this.txBuilder.buildOftTransferTx(params, txOptions);
|
|
10910
11003
|
}
|
|
10911
11004
|
async buildLayerzeroOftSendTx(params, txOptions = {}) {
|
|
10912
|
-
const resolvedTransferId = params.transferId || web3_js_1.Keypair.generate().publicKey
|
|
11005
|
+
const resolvedTransferId = params.transferId || web3_js_1.Keypair.generate().publicKey;
|
|
10913
11006
|
const { tokenProgram } = await (0, accounts_1.fetchMintAndTokenProgram)(this.base.connection, params.sourceMint);
|
|
10914
11007
|
const signer = txOptions.signer || this.base.signer;
|
|
10915
11008
|
const sourceTokenAccount = params.sourceTokenAccount ||
|
|
@@ -10972,63 +11065,39 @@ class BridgeClient {
|
|
|
10972
11065
|
};
|
|
10973
11066
|
}
|
|
10974
11067
|
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
11068
|
const integrationAuthority = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from(constants_1.SEED_INTEGRATION_AUTHORITY)], this.base.extBridgeProgram.programId)[0];
|
|
10988
11069
|
const ix = await this.base.extBridgeProgram.methods
|
|
10989
|
-
.
|
|
10990
|
-
|
|
11070
|
+
.settleManagedTransfer({
|
|
11071
|
+
transferId,
|
|
11072
|
+
})
|
|
11073
|
+
.accountsPartial({
|
|
10991
11074
|
glamState: this.base.statePda,
|
|
10992
|
-
|
|
11075
|
+
glamVault: this.base.vaultPda,
|
|
10993
11076
|
glamSigner: txOptions.signer || this.base.signer,
|
|
10994
|
-
|
|
10995
|
-
|
|
10996
|
-
|
|
10997
|
-
|
|
10998
|
-
transferRecord: this.getTransferRecordPda(transferId),
|
|
11077
|
+
glamProtocolProgram: this.base.protocolProgram.programId,
|
|
11078
|
+
bridgeRegistry: this.getRegistryPda(),
|
|
11079
|
+
integrationAuthority,
|
|
11080
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
10999
11081
|
})
|
|
11000
11082
|
.instruction();
|
|
11001
11083
|
const tx = await this.txBuilder.buildVersionedTx([ix], txOptions);
|
|
11002
11084
|
return await this.base.sendAndConfirm(tx);
|
|
11003
11085
|
}
|
|
11004
|
-
async
|
|
11005
|
-
const integrationAuthority = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from(constants_1.SEED_INTEGRATION_AUTHORITY)], this.base.extBridgeProgram.programId)[0];
|
|
11086
|
+
async validateManagedTransfer(transferId, txOptions = {}) {
|
|
11006
11087
|
const ix = await this.base.extBridgeProgram.methods
|
|
11007
|
-
.
|
|
11088
|
+
.validateManagedTransfer({
|
|
11089
|
+
transferId,
|
|
11090
|
+
})
|
|
11008
11091
|
.accounts({
|
|
11009
11092
|
glamState: this.base.statePda,
|
|
11010
|
-
// glamVault: this.base.vaultPda,
|
|
11011
11093
|
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
11094
|
})
|
|
11018
11095
|
.instruction();
|
|
11019
11096
|
const tx = await this.txBuilder.buildVersionedTx([ix], txOptions);
|
|
11020
11097
|
return await this.base.sendAndConfirm(tx);
|
|
11021
11098
|
}
|
|
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);
|
|
11099
|
+
async priceManagedTransfers(txOptions = {}) {
|
|
11100
|
+
const tx = await this.txBuilder.priceManagedTransfersTx(txOptions);
|
|
11032
11101
|
return await this.base.sendAndConfirm(tx);
|
|
11033
11102
|
}
|
|
11034
11103
|
}
|
|
@@ -48975,9 +49044,20 @@ function parseFixedBytes(value, label, expectedLength) {
|
|
|
48975
49044
|
}
|
|
48976
49045
|
return bytes;
|
|
48977
49046
|
}
|
|
49047
|
+
function parseTransferId(value) {
|
|
49048
|
+
try {
|
|
49049
|
+
return new web3_js_1.PublicKey(value.trim());
|
|
49050
|
+
}
|
|
49051
|
+
catch {
|
|
49052
|
+
return new web3_js_1.PublicKey(parseFixedBytes(value, "transferId", 32));
|
|
49053
|
+
}
|
|
49054
|
+
}
|
|
48978
49055
|
function formatBytesHex(value) {
|
|
48979
49056
|
return `0x${Buffer.from(value).toString("hex")}`;
|
|
48980
49057
|
}
|
|
49058
|
+
function formatTransferId(value) {
|
|
49059
|
+
return value.toBase58();
|
|
49060
|
+
}
|
|
48981
49061
|
function parseManagementMode(value) {
|
|
48982
49062
|
switch (value) {
|
|
48983
49063
|
case "managed":
|
|
@@ -49161,15 +49241,15 @@ function installLayerzeroOftCommands(program, context) {
|
|
|
49161
49241
|
});
|
|
49162
49242
|
program
|
|
49163
49243
|
.command("derive-aux-account")
|
|
49164
|
-
.argument("<transfer_id>", "32-byte hex
|
|
49244
|
+
.argument("<transfer_id>", "transfer id pubkey or 32-byte hex/base64")
|
|
49165
49245
|
.argument("<source_mint>")
|
|
49166
49246
|
.option("--signer <pubkey>", "Optional signer override for the derived seed")
|
|
49167
49247
|
.description("Derive the temporary auxiliary token account used during OFT sends")
|
|
49168
49248
|
.action(async (transferId, sourceMint, { signer }) => {
|
|
49169
|
-
const parsedTransferId =
|
|
49249
|
+
const parsedTransferId = parseTransferId(transferId);
|
|
49170
49250
|
const auxiliary = await context.glamClient.bridge.deriveOftAuxiliaryTokenAccount(parsedTransferId, new web3_js_1.PublicKey(sourceMint), signer ? new web3_js_1.PublicKey(signer) : undefined);
|
|
49171
49251
|
printJson({
|
|
49172
|
-
transferId:
|
|
49252
|
+
transferId: parsedTransferId,
|
|
49173
49253
|
seed: auxiliary.seed,
|
|
49174
49254
|
address: auxiliary.address,
|
|
49175
49255
|
tokenProgram: auxiliary.tokenProgram,
|
|
@@ -49200,16 +49280,12 @@ function installLayerzeroOftCommands(program, context) {
|
|
|
49200
49280
|
.option("--source-ata <pubkey>", "Optional explicit source token account")
|
|
49201
49281
|
.option("--managed", "Keep the inflight transfer managed until reconcile", false)
|
|
49202
49282
|
.option("--lookup-table <pubkey>", "Optional extra address lookup table", collectPublicKeys, [])
|
|
49203
|
-
.option("--transfer-id <hex_or_base64>", "Optional 32-byte transfer id")
|
|
49204
49283
|
.option("-y, --yes", "Skip confirmation", false)
|
|
49205
49284
|
.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);
|
|
49285
|
+
.action(async (amount, destinationChain, destinationRecipient, { nativeFee, minAmount, lzTokenFee, options, composeMsg, nonceAccount, sourceAta, managed, lookupTable, yes, }) => {
|
|
49286
|
+
const transferId = web3_js_1.Keypair.generate().publicKey;
|
|
49211
49287
|
await (0, utils_1.executeTxWithErrorHandling)(() => context.glamClient.bridge.oft.send({
|
|
49212
|
-
transferId
|
|
49288
|
+
transferId,
|
|
49213
49289
|
sourceMint: glam_sdk_1.USDT,
|
|
49214
49290
|
sourceAmount: (0, glam_sdk_1.fromUiAmount)(amount, 6),
|
|
49215
49291
|
destinationChain,
|
|
@@ -49238,43 +49314,7 @@ function installLayerzeroOftCommands(program, context) {
|
|
|
49238
49314
|
}), {
|
|
49239
49315
|
skip: yes,
|
|
49240
49316
|
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}`);
|
|
49317
|
+
}, (txSig) => `LayerZero OFT transfer submitted: ${txSig}\nTransfer ID: ${transferId}`);
|
|
49278
49318
|
});
|
|
49279
49319
|
}
|
|
49280
49320
|
function installBridgeCommands(program, context) {
|
|
@@ -49291,93 +49331,71 @@ function installBridgeCommands(program, context) {
|
|
|
49291
49331
|
printJson({
|
|
49292
49332
|
pubkey: registryPda,
|
|
49293
49333
|
...registry,
|
|
49334
|
+
transfers: registry.transfers.slice(0, toSortableNumber(registry.managedTransferCount)),
|
|
49294
49335
|
});
|
|
49295
49336
|
});
|
|
49296
49337
|
program
|
|
49297
49338
|
.command("records")
|
|
49298
49339
|
.description("List bridge transfer records for the active vault")
|
|
49299
49340
|
.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) -
|
|
49341
|
+
const registry = await context.glamClient.bridge.fetchRegistry();
|
|
49342
|
+
if (!registry) {
|
|
49343
|
+
printJson([]);
|
|
49344
|
+
return;
|
|
49345
|
+
}
|
|
49346
|
+
const records = await Promise.all(registry.transfers
|
|
49347
|
+
.slice(0, toSortableNumber(registry.managedTransferCount))
|
|
49348
|
+
.map((transfer) => context.glamClient.bridge.fetchTransferRecord(transfer.transferId)));
|
|
49349
|
+
printJson(records.sort((left, right) => toSortableNumber(right.committedSlot) -
|
|
49314
49350
|
toSortableNumber(left.committedSlot)));
|
|
49315
49351
|
});
|
|
49316
49352
|
program
|
|
49317
49353
|
.command("record")
|
|
49318
|
-
.argument("<transfer_id>", "32-byte hex
|
|
49354
|
+
.argument("<transfer_id>", "transfer id pubkey or 32-byte hex/base64")
|
|
49319
49355
|
.description("View a single bridge transfer record")
|
|
49320
49356
|
.action(async (transferId) => {
|
|
49321
|
-
const parsedTransferId =
|
|
49322
|
-
const
|
|
49323
|
-
const record = await context.glamClient.extBridgeProgram.account.bridgeTransferRecord.fetchNullable(recordPda);
|
|
49357
|
+
const parsedTransferId = parseTransferId(transferId);
|
|
49358
|
+
const record = await context.glamClient.bridge.fetchTransferRecordNullable(parsedTransferId);
|
|
49324
49359
|
if (!record) {
|
|
49325
|
-
console.error(`Bridge transfer record not found
|
|
49360
|
+
console.error(`Bridge transfer record not found for transfer ${formatTransferId(parsedTransferId)}`);
|
|
49326
49361
|
process.exit(1);
|
|
49327
49362
|
}
|
|
49328
|
-
printJson(
|
|
49329
|
-
pubkey: recordPda,
|
|
49330
|
-
...record,
|
|
49331
|
-
});
|
|
49332
|
-
});
|
|
49333
|
-
program
|
|
49334
|
-
.command("settle")
|
|
49335
|
-
.argument("<transfer_id>", "32-byte hex or base64 transfer id")
|
|
49336
|
-
.option("-y, --yes", "Skip confirmation", false)
|
|
49337
|
-
.action(async (transferId, { yes }) => {
|
|
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}`);
|
|
49363
|
+
printJson(record);
|
|
49344
49364
|
});
|
|
49345
49365
|
program
|
|
49346
|
-
.command("
|
|
49347
|
-
.
|
|
49366
|
+
.command("validate")
|
|
49367
|
+
.alias("validate-managed-transfer")
|
|
49368
|
+
.argument("<transfer_id>", "transfer id pubkey or 32-byte hex/base64")
|
|
49369
|
+
.description("Validate a managed bridge transfer")
|
|
49348
49370
|
.option("-y, --yes", "Skip confirmation", false)
|
|
49349
49371
|
.action(async (transferId, { yes }) => {
|
|
49350
|
-
const parsedTransferId =
|
|
49351
|
-
|
|
49352
|
-
await (0, utils_1.executeTxWithErrorHandling)(() => context.glamClient.bridge.reconcileManagedTransfer(parsedTransferId, context.txOptions), {
|
|
49372
|
+
const parsedTransferId = parseTransferId(transferId);
|
|
49373
|
+
await (0, utils_1.executeTxWithErrorHandling)(() => context.glamClient.bridge.validateManagedTransfer(parsedTransferId, context.txOptions), {
|
|
49353
49374
|
skip: yes,
|
|
49354
|
-
message: `Confirm
|
|
49355
|
-
}, (txSig) => `Transfer
|
|
49375
|
+
message: `Confirm validating transfer ${parsedTransferId}?`,
|
|
49376
|
+
}, (txSig) => `Transfer validated: ${txSig}`);
|
|
49356
49377
|
});
|
|
49357
49378
|
program
|
|
49358
|
-
.command("
|
|
49359
|
-
.
|
|
49360
|
-
.argument("<reason>", "Failure reason code", parseInt)
|
|
49379
|
+
.command("price")
|
|
49380
|
+
.description("Price all managed bridge transfers")
|
|
49361
49381
|
.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), {
|
|
49382
|
+
.action(async ({ yes }) => {
|
|
49383
|
+
await (0, utils_1.executeTxWithErrorHandling)(() => context.glamClient.bridge.priceManagedTransfers(context.txOptions), {
|
|
49366
49384
|
skip: yes,
|
|
49367
|
-
message:
|
|
49368
|
-
}, (txSig) => `
|
|
49385
|
+
message: "Confirm pricing all managed transfers?",
|
|
49386
|
+
}, (txSig) => `Managed transfers priced: ${txSig}`);
|
|
49369
49387
|
});
|
|
49370
49388
|
program
|
|
49371
|
-
.command("
|
|
49372
|
-
.argument("<transfer_id>", "32-byte hex
|
|
49389
|
+
.command("settle")
|
|
49390
|
+
.argument("<transfer_id>", "transfer id pubkey or 32-byte hex/base64")
|
|
49391
|
+
.description("Settle a managed bridge transfer")
|
|
49373
49392
|
.option("-y, --yes", "Skip confirmation", false)
|
|
49374
49393
|
.action(async (transferId, { yes }) => {
|
|
49375
|
-
const parsedTransferId =
|
|
49376
|
-
|
|
49377
|
-
await (0, utils_1.executeTxWithErrorHandling)(() => context.glamClient.bridge.cleanupTransferRecord(parsedTransferId, context.txOptions), {
|
|
49394
|
+
const parsedTransferId = parseTransferId(transferId);
|
|
49395
|
+
await (0, utils_1.executeTxWithErrorHandling)(() => context.glamClient.bridge.settleManagedTransfer(parsedTransferId, context.txOptions), {
|
|
49378
49396
|
skip: yes,
|
|
49379
|
-
message: `Confirm
|
|
49380
|
-
}, (txSig) => `Transfer
|
|
49397
|
+
message: `Confirm settling transfer ${parsedTransferId}?`,
|
|
49398
|
+
}, (txSig) => `Transfer settled: ${txSig}`);
|
|
49381
49399
|
});
|
|
49382
49400
|
const oft = program.command("oft").description("LayerZero OFT");
|
|
49383
49401
|
installLayerzeroOftCommands(oft, context);
|
|
@@ -50308,7 +50326,7 @@ program
|
|
|
50308
50326
|
initialize(config, skipSimulation);
|
|
50309
50327
|
await (0, idl_1.idlCheck)(context.glamClient);
|
|
50310
50328
|
})
|
|
50311
|
-
.version("1.0.14-alpha.
|
|
50329
|
+
.version("1.0.14-alpha.3");
|
|
50312
50330
|
program
|
|
50313
50331
|
.command("env")
|
|
50314
50332
|
.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.3",
|
|
4
4
|
"description": "CLI for interacting with the GLAM Protocol",
|
|
5
5
|
"main": "./main.js",
|
|
6
6
|
"bin": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"node": ">=20.20.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@glamsystems/glam-sdk": "1.0.14-alpha.
|
|
24
|
+
"@glamsystems/glam-sdk": "1.0.14-alpha.3",
|
|
25
25
|
"@switchboard-xyz/common": "^3.0.0",
|
|
26
26
|
"commander": "^11.1.0",
|
|
27
27
|
"decimal.js": "^10.6.0",
|