@glamsystems/glam-cli 1.0.14-alpha.1 → 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 +289 -196
- 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","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","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","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","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":"set_layerzero_oft_policy","docs":["Stores the LayerZero OFT route allowlist for this vault."],"discriminator":[184,54,57,172,193,178,200,70],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"}],"args":[{"name":"policy","type":{"defined":{"name":"LayerzeroOftPolicy"}}}]},{"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":"LayerzeroOftPolicy","type":{"kind":"struct","fields":[{"name":"routes","type":{"vec":{"defined":{"name":"LayerzeroOftRoute"}}}}]}},{"name":"LayerzeroOftRoute","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
|
}
|
|
@@ -4198,19 +4199,52 @@ class BaseClient {
|
|
|
4198
4199
|
}
|
|
4199
4200
|
const fetchPromise = this.fetchGlobalConfig(options)
|
|
4200
4201
|
.then(async (globalConfig) => {
|
|
4201
|
-
|
|
4202
|
-
const
|
|
4202
|
+
const assets = globalConfig.assetMetas.map((am) => am.asset);
|
|
4203
|
+
const tokenProgramsByAsset = new Map();
|
|
4204
|
+
try {
|
|
4205
|
+
// Fast path when every global-config mint account is available.
|
|
4206
|
+
const mintInfos = await (0, accounts_1.fetchMintsAndTokenPrograms)(this.connection, assets);
|
|
4207
|
+
assets.forEach((asset, i) => {
|
|
4208
|
+
tokenProgramsByAsset.set(asset.toBase58(), mintInfos[i].tokenProgram);
|
|
4209
|
+
});
|
|
4210
|
+
}
|
|
4211
|
+
catch {
|
|
4212
|
+
// Local validators may clone a newer global config than the set of
|
|
4213
|
+
// mint accounts they have available. Resolve what we can and let
|
|
4214
|
+
// downstream callers request only the assets they actually use.
|
|
4215
|
+
const accountsInfo = await this.connection.getMultipleAccountsInfo(assets, "confirmed");
|
|
4216
|
+
accountsInfo.forEach((accountInfo, i) => {
|
|
4217
|
+
const asset = assets[i];
|
|
4218
|
+
const assetKey = asset.toBase58();
|
|
4219
|
+
if (accountInfo) {
|
|
4220
|
+
tokenProgramsByAsset.set(assetKey, (0, accounts_1.parseMintAccountInfo)(accountInfo, asset).tokenProgram);
|
|
4221
|
+
return;
|
|
4222
|
+
}
|
|
4223
|
+
const fallback = assets_1.ASSETS_MAINNET.get(assetKey);
|
|
4224
|
+
if (fallback) {
|
|
4225
|
+
tokenProgramsByAsset.set(assetKey, fallback.programId);
|
|
4226
|
+
}
|
|
4227
|
+
});
|
|
4228
|
+
}
|
|
4203
4229
|
// Transforms onchain asset meta to client asset meta
|
|
4204
|
-
const assetMetaMap = new Map(globalConfig.assetMetas.
|
|
4205
|
-
asset.toBase58()
|
|
4206
|
-
{
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4230
|
+
const assetMetaMap = new Map(globalConfig.assetMetas.flatMap(({ asset, decimals, oracle, oracleSource }) => {
|
|
4231
|
+
const programId = tokenProgramsByAsset.get(asset.toBase58());
|
|
4232
|
+
if (!programId) {
|
|
4233
|
+
return [];
|
|
4234
|
+
}
|
|
4235
|
+
return [
|
|
4236
|
+
[
|
|
4237
|
+
asset.toBase58(),
|
|
4238
|
+
{
|
|
4239
|
+
asset,
|
|
4240
|
+
decimals,
|
|
4241
|
+
oracle,
|
|
4242
|
+
oracleSource,
|
|
4243
|
+
programId,
|
|
4244
|
+
},
|
|
4245
|
+
],
|
|
4246
|
+
];
|
|
4247
|
+
}));
|
|
4214
4248
|
if (useCache) {
|
|
4215
4249
|
this._assetMetas = assetMetaMap;
|
|
4216
4250
|
}
|
|
@@ -8141,10 +8175,11 @@ class VaultHoldings {
|
|
|
8141
8175
|
}
|
|
8142
8176
|
exports.VaultHoldings = VaultHoldings;
|
|
8143
8177
|
class PriceClient {
|
|
8144
|
-
constructor(base, klend, kvaults, getJupiterApi) {
|
|
8178
|
+
constructor(base, klend, kvaults, bridge, getJupiterApi) {
|
|
8145
8179
|
this.base = base;
|
|
8146
8180
|
this.klend = klend;
|
|
8147
8181
|
this.kvaults = kvaults;
|
|
8182
|
+
this.bridge = bridge;
|
|
8148
8183
|
this.getJupiterApi = getJupiterApi;
|
|
8149
8184
|
this._stateModel = null;
|
|
8150
8185
|
this._lookupTables = new utils_1.PkSet();
|
|
@@ -8770,6 +8805,9 @@ class PriceClient {
|
|
|
8770
8805
|
const epiRefreshIx = await this.priceEpiValidatedPositionsIx();
|
|
8771
8806
|
if (epiRefreshIx)
|
|
8772
8807
|
pricingIxs.push(epiRefreshIx);
|
|
8808
|
+
const priceBridgeIxs = await this.bridge.txBuilder.priceManagedTransfersIxs();
|
|
8809
|
+
if (priceBridgeIxs)
|
|
8810
|
+
pricingIxs.push(...priceBridgeIxs);
|
|
8773
8811
|
return pricingIxs.filter(Boolean);
|
|
8774
8812
|
}
|
|
8775
8813
|
async validateAumIx() {
|
|
@@ -10375,19 +10413,15 @@ const anchor_1 = __webpack_require__(4);
|
|
|
10375
10413
|
const crypto_1 = __webpack_require__(87);
|
|
10376
10414
|
const web3_js_1 = __webpack_require__(5);
|
|
10377
10415
|
const base_1 = __webpack_require__(58);
|
|
10416
|
+
const kamino_1 = __webpack_require__(67);
|
|
10417
|
+
const vault_1 = __webpack_require__(65);
|
|
10378
10418
|
const bridgeRegistry_1 = __webpack_require__(88);
|
|
10379
10419
|
const accounts_1 = __webpack_require__(33);
|
|
10380
10420
|
const lookupTables_1 = __webpack_require__(44);
|
|
10381
10421
|
const integrationPolicies_1 = __webpack_require__(29);
|
|
10422
|
+
const glamPDAs_1 = __webpack_require__(37);
|
|
10382
10423
|
const constants_1 = __webpack_require__(34);
|
|
10383
10424
|
const LAYERZERO_OFT_PROTOCOL = 1 << 2;
|
|
10384
|
-
function toFixedArray32(value, label) {
|
|
10385
|
-
const bytes = Array.from(Buffer.from(value));
|
|
10386
|
-
if (bytes.length !== 32) {
|
|
10387
|
-
throw new Error(`${label} must be exactly 32 bytes`);
|
|
10388
|
-
}
|
|
10389
|
-
return bytes;
|
|
10390
|
-
}
|
|
10391
10425
|
function appendU16Le(parts, value) {
|
|
10392
10426
|
const out = Buffer.alloc(2);
|
|
10393
10427
|
out.writeUInt16LE(value, 0);
|
|
@@ -10480,15 +10514,47 @@ function getBridgeSessionPda(glamState, transferId, bridgeProgramId) {
|
|
|
10480
10514
|
return web3_js_1.PublicKey.findProgramAddressSync([
|
|
10481
10515
|
Buffer.from(constants_1.SEED_BRIDGE_SESSION),
|
|
10482
10516
|
glamState.toBuffer(),
|
|
10483
|
-
|
|
10517
|
+
transferId.toBuffer(),
|
|
10484
10518
|
], bridgeProgramId)[0];
|
|
10485
10519
|
}
|
|
10486
|
-
function
|
|
10487
|
-
return
|
|
10488
|
-
|
|
10489
|
-
|
|
10490
|
-
|
|
10491
|
-
|
|
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
|
+
};
|
|
10492
10558
|
}
|
|
10493
10559
|
function toRouteManagementModeArg(managementMode) {
|
|
10494
10560
|
if (managementMode &&
|
|
@@ -10532,7 +10598,7 @@ async function deriveOftAuxiliaryAccountSeed(glamState, transferId) {
|
|
|
10532
10598
|
const digest = await sha256(Buffer.concat([
|
|
10533
10599
|
Buffer.from("oft-auxiliary-account"),
|
|
10534
10600
|
glamState.toBuffer(),
|
|
10535
|
-
|
|
10601
|
+
transferId.toBuffer(),
|
|
10536
10602
|
]));
|
|
10537
10603
|
return digest.subarray(0, 16).toString("hex");
|
|
10538
10604
|
}
|
|
@@ -10581,10 +10647,10 @@ class TxBuilder extends base_1.BaseTxBuilder {
|
|
|
10581
10647
|
async deleteLayerzeroOftRouteIx(route, signer) {
|
|
10582
10648
|
return await this.client.base.extBridgeProgram.methods
|
|
10583
10649
|
.deleteLayerzeroOftRoute(normalizeRoute(route))
|
|
10584
|
-
.
|
|
10650
|
+
.accounts({
|
|
10585
10651
|
glamState: this.client.base.statePda,
|
|
10586
10652
|
glamSigner: signer || this.client.base.signer,
|
|
10587
|
-
glamProtocolProgram: this.client.base.protocolProgram.programId,
|
|
10653
|
+
// glamProtocolProgram: this.client.base.protocolProgram.programId,
|
|
10588
10654
|
})
|
|
10589
10655
|
.instruction();
|
|
10590
10656
|
}
|
|
@@ -10592,10 +10658,9 @@ class TxBuilder extends base_1.BaseTxBuilder {
|
|
|
10592
10658
|
if (params.providerInstructions.length !== 1) {
|
|
10593
10659
|
throw new Error("OFT transfers require exactly one provider instruction");
|
|
10594
10660
|
}
|
|
10595
|
-
const transferId =
|
|
10661
|
+
const transferId = params.transferId;
|
|
10596
10662
|
const registryPda = getBridgeRegistryPda(this.client.base.statePda, this.client.base.extBridgeProgram.programId);
|
|
10597
10663
|
const sessionPda = getBridgeSessionPda(this.client.base.statePda, transferId, this.client.base.extBridgeProgram.programId);
|
|
10598
|
-
const transferRecordPda = getBridgeTransferRecordPda(this.client.base.statePda, transferId, this.client.base.extBridgeProgram.programId);
|
|
10599
10664
|
const integrationAuthority = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from(constants_1.SEED_INTEGRATION_AUTHORITY)], this.client.base.extBridgeProgram.programId)[0];
|
|
10600
10665
|
const { tokenProgram } = await (0, accounts_1.fetchMintAndTokenProgram)(this.client.base.connection, params.sourceMint);
|
|
10601
10666
|
const sourceTokenAccount = params.sourceTokenAccount ||
|
|
@@ -10651,17 +10716,16 @@ class TxBuilder extends base_1.BaseTxBuilder {
|
|
|
10651
10716
|
glamState: this.client.base.statePda,
|
|
10652
10717
|
glamVault: this.client.base.vaultPda,
|
|
10653
10718
|
glamSigner: txOptions.signer || this.client.base.signer,
|
|
10654
|
-
integrationAuthority,
|
|
10655
10719
|
cpiProgram: tokenProgram,
|
|
10656
10720
|
glamProtocolProgram: this.client.base.protocolProgram.programId,
|
|
10657
|
-
systemProgram: web3_js_1.SystemProgram.programId,
|
|
10658
10721
|
instructions: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
10659
10722
|
bridgeRegistry: registryPda,
|
|
10660
10723
|
bridgeSession: sessionPda,
|
|
10661
|
-
transferRecord: transferRecordPda,
|
|
10662
10724
|
sourceTokenAccount,
|
|
10663
10725
|
sourceMint: params.sourceMint,
|
|
10664
10726
|
auxiliaryTokenAccount,
|
|
10727
|
+
integrationAuthority,
|
|
10728
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
10665
10729
|
});
|
|
10666
10730
|
commitMethod.remainingAccounts(commitRemainingAccounts);
|
|
10667
10731
|
const commitIx = await commitMethod.instruction();
|
|
@@ -10670,11 +10734,62 @@ class TxBuilder extends base_1.BaseTxBuilder {
|
|
|
10670
10734
|
tx,
|
|
10671
10735
|
additionalSigners: params.providerSigners || [],
|
|
10672
10736
|
sessionPda,
|
|
10673
|
-
transferRecordPda,
|
|
10674
10737
|
auxiliaryTokenAccount,
|
|
10675
10738
|
sourceTokenAccount,
|
|
10676
10739
|
};
|
|
10677
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
|
+
}
|
|
10678
10793
|
}
|
|
10679
10794
|
class LayerzeroOftBridgeProtocolClient {
|
|
10680
10795
|
constructor(bridge) {
|
|
@@ -10700,9 +10815,6 @@ class BridgeClient {
|
|
|
10700
10815
|
getSessionPda(transferId) {
|
|
10701
10816
|
return getBridgeSessionPda(this.base.statePda, transferId, this.base.extBridgeProgram.programId);
|
|
10702
10817
|
}
|
|
10703
|
-
getTransferRecordPda(transferId) {
|
|
10704
|
-
return getBridgeTransferRecordPda(this.base.statePda, transferId, this.base.extBridgeProgram.programId);
|
|
10705
|
-
}
|
|
10706
10818
|
getLayerzeroNoncePda(endpointProgram, sender, destinationChain, destinationRecipient) {
|
|
10707
10819
|
return deriveLayerzeroNoncePda(endpointProgram, sender, destinationChain, destinationRecipient);
|
|
10708
10820
|
}
|
|
@@ -10844,7 +10956,21 @@ class BridgeClient {
|
|
|
10844
10956
|
return await this.base.extBridgeProgram.account.bridgeSession.fetchNullable(this.getSessionPda(transferId));
|
|
10845
10957
|
}
|
|
10846
10958
|
async fetchTransferRecord(transferId) {
|
|
10847
|
-
|
|
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;
|
|
10848
10974
|
}
|
|
10849
10975
|
async addLayerzeroOftRoute(route, txOptions = {}) {
|
|
10850
10976
|
const glamSigner = txOptions.signer || this.base.signer;
|
|
@@ -10876,7 +11002,7 @@ class BridgeClient {
|
|
|
10876
11002
|
return await this.txBuilder.buildOftTransferTx(params, txOptions);
|
|
10877
11003
|
}
|
|
10878
11004
|
async buildLayerzeroOftSendTx(params, txOptions = {}) {
|
|
10879
|
-
const resolvedTransferId = params.transferId || web3_js_1.Keypair.generate().publicKey
|
|
11005
|
+
const resolvedTransferId = params.transferId || web3_js_1.Keypair.generate().publicKey;
|
|
10880
11006
|
const { tokenProgram } = await (0, accounts_1.fetchMintAndTokenProgram)(this.base.connection, params.sourceMint);
|
|
10881
11007
|
const signer = txOptions.signer || this.base.signer;
|
|
10882
11008
|
const sourceTokenAccount = params.sourceTokenAccount ||
|
|
@@ -10939,58 +11065,39 @@ class BridgeClient {
|
|
|
10939
11065
|
};
|
|
10940
11066
|
}
|
|
10941
11067
|
async settleManagedTransfer(transferId, txOptions = {}) {
|
|
11068
|
+
const integrationAuthority = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from(constants_1.SEED_INTEGRATION_AUTHORITY)], this.base.extBridgeProgram.programId)[0];
|
|
10942
11069
|
const ix = await this.base.extBridgeProgram.methods
|
|
10943
|
-
.settleManagedTransfer(
|
|
10944
|
-
|
|
10945
|
-
glamState: this.base.statePda,
|
|
10946
|
-
glamSigner: txOptions.signer || this.base.signer,
|
|
10947
|
-
transferRecord: this.getTransferRecordPda(transferId),
|
|
11070
|
+
.settleManagedTransfer({
|
|
11071
|
+
transferId,
|
|
10948
11072
|
})
|
|
10949
|
-
.instruction();
|
|
10950
|
-
const tx = await this.txBuilder.buildVersionedTx([ix], txOptions);
|
|
10951
|
-
return await this.base.sendAndConfirm(tx);
|
|
10952
|
-
}
|
|
10953
|
-
async reconcileManagedTransfer(transferId, txOptions = {}) {
|
|
10954
|
-
const ix = await this.base.extBridgeProgram.methods
|
|
10955
|
-
.reconcileManagedTransfer()
|
|
10956
11073
|
.accountsPartial({
|
|
10957
11074
|
glamState: this.base.statePda,
|
|
11075
|
+
glamVault: this.base.vaultPda,
|
|
10958
11076
|
glamSigner: txOptions.signer || this.base.signer,
|
|
10959
11077
|
glamProtocolProgram: this.base.protocolProgram.programId,
|
|
10960
|
-
|
|
11078
|
+
bridgeRegistry: this.getRegistryPda(),
|
|
11079
|
+
integrationAuthority,
|
|
11080
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
10961
11081
|
})
|
|
10962
11082
|
.instruction();
|
|
10963
11083
|
const tx = await this.txBuilder.buildVersionedTx([ix], txOptions);
|
|
10964
11084
|
return await this.base.sendAndConfirm(tx);
|
|
10965
11085
|
}
|
|
10966
|
-
async
|
|
10967
|
-
const integrationAuthority = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from(constants_1.SEED_INTEGRATION_AUTHORITY)], this.base.extBridgeProgram.programId)[0];
|
|
11086
|
+
async validateManagedTransfer(transferId, txOptions = {}) {
|
|
10968
11087
|
const ix = await this.base.extBridgeProgram.methods
|
|
10969
|
-
.
|
|
11088
|
+
.validateManagedTransfer({
|
|
11089
|
+
transferId,
|
|
11090
|
+
})
|
|
10970
11091
|
.accounts({
|
|
10971
11092
|
glamState: this.base.statePda,
|
|
10972
|
-
// glamVault: this.base.vaultPda,
|
|
10973
11093
|
glamSigner: txOptions.signer || this.base.signer,
|
|
10974
|
-
// integrationAuthority,
|
|
10975
|
-
// glamProtocolProgram: this.base.protocolProgram.programId,
|
|
10976
|
-
// systemProgram: SystemProgram.programId,
|
|
10977
|
-
// bridgeRegistry: this.getRegistryPda(),
|
|
10978
|
-
transferRecord: this.getTransferRecordPda(transferId),
|
|
10979
11094
|
})
|
|
10980
11095
|
.instruction();
|
|
10981
11096
|
const tx = await this.txBuilder.buildVersionedTx([ix], txOptions);
|
|
10982
11097
|
return await this.base.sendAndConfirm(tx);
|
|
10983
11098
|
}
|
|
10984
|
-
async
|
|
10985
|
-
const
|
|
10986
|
-
.cleanupTransferRecord()
|
|
10987
|
-
.accounts({
|
|
10988
|
-
glamState: this.base.statePda,
|
|
10989
|
-
glamSigner: txOptions.signer || this.base.signer,
|
|
10990
|
-
transferRecord: this.getTransferRecordPda(transferId),
|
|
10991
|
-
})
|
|
10992
|
-
.instruction();
|
|
10993
|
-
const tx = await this.txBuilder.buildVersionedTx([ix], txOptions);
|
|
11099
|
+
async priceManagedTransfers(txOptions = {}) {
|
|
11100
|
+
const tx = await this.txBuilder.priceManagedTransfersTx(txOptions);
|
|
10994
11101
|
return await this.base.sendAndConfirm(tx);
|
|
10995
11102
|
}
|
|
10996
11103
|
}
|
|
@@ -48937,9 +49044,20 @@ function parseFixedBytes(value, label, expectedLength) {
|
|
|
48937
49044
|
}
|
|
48938
49045
|
return bytes;
|
|
48939
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
|
+
}
|
|
48940
49055
|
function formatBytesHex(value) {
|
|
48941
49056
|
return `0x${Buffer.from(value).toString("hex")}`;
|
|
48942
49057
|
}
|
|
49058
|
+
function formatTransferId(value) {
|
|
49059
|
+
return value.toBase58();
|
|
49060
|
+
}
|
|
48943
49061
|
function parseManagementMode(value) {
|
|
48944
49062
|
switch (value) {
|
|
48945
49063
|
case "managed":
|
|
@@ -49123,15 +49241,15 @@ function installLayerzeroOftCommands(program, context) {
|
|
|
49123
49241
|
});
|
|
49124
49242
|
program
|
|
49125
49243
|
.command("derive-aux-account")
|
|
49126
|
-
.argument("<transfer_id>", "32-byte hex
|
|
49244
|
+
.argument("<transfer_id>", "transfer id pubkey or 32-byte hex/base64")
|
|
49127
49245
|
.argument("<source_mint>")
|
|
49128
49246
|
.option("--signer <pubkey>", "Optional signer override for the derived seed")
|
|
49129
49247
|
.description("Derive the temporary auxiliary token account used during OFT sends")
|
|
49130
49248
|
.action(async (transferId, sourceMint, { signer }) => {
|
|
49131
|
-
const parsedTransferId =
|
|
49249
|
+
const parsedTransferId = parseTransferId(transferId);
|
|
49132
49250
|
const auxiliary = await context.glamClient.bridge.deriveOftAuxiliaryTokenAccount(parsedTransferId, new web3_js_1.PublicKey(sourceMint), signer ? new web3_js_1.PublicKey(signer) : undefined);
|
|
49133
49251
|
printJson({
|
|
49134
|
-
transferId:
|
|
49252
|
+
transferId: parsedTransferId,
|
|
49135
49253
|
seed: auxiliary.seed,
|
|
49136
49254
|
address: auxiliary.address,
|
|
49137
49255
|
tokenProgram: auxiliary.tokenProgram,
|
|
@@ -49162,16 +49280,12 @@ function installLayerzeroOftCommands(program, context) {
|
|
|
49162
49280
|
.option("--source-ata <pubkey>", "Optional explicit source token account")
|
|
49163
49281
|
.option("--managed", "Keep the inflight transfer managed until reconcile", false)
|
|
49164
49282
|
.option("--lookup-table <pubkey>", "Optional extra address lookup table", collectPublicKeys, [])
|
|
49165
|
-
.option("--transfer-id <hex_or_base64>", "Optional 32-byte transfer id")
|
|
49166
49283
|
.option("-y, --yes", "Skip confirmation", false)
|
|
49167
49284
|
.description("Bridge USDT through the checked-in direct LayerZero USDT0 OFT route")
|
|
49168
|
-
.action(async (amount, destinationChain, destinationRecipient, { nativeFee, minAmount, lzTokenFee, options, composeMsg, nonceAccount, sourceAta, managed, lookupTable,
|
|
49169
|
-
const
|
|
49170
|
-
? parseFixedBytes(transferId, "transferId", 32)
|
|
49171
|
-
: web3_js_1.Keypair.generate().publicKey.toBuffer();
|
|
49172
|
-
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;
|
|
49173
49287
|
await (0, utils_1.executeTxWithErrorHandling)(() => context.glamClient.bridge.oft.send({
|
|
49174
|
-
transferId
|
|
49288
|
+
transferId,
|
|
49175
49289
|
sourceMint: glam_sdk_1.USDT,
|
|
49176
49290
|
sourceAmount: (0, glam_sdk_1.fromUiAmount)(amount, 6),
|
|
49177
49291
|
destinationChain,
|
|
@@ -49200,43 +49314,7 @@ function installLayerzeroOftCommands(program, context) {
|
|
|
49200
49314
|
}), {
|
|
49201
49315
|
skip: yes,
|
|
49202
49316
|
message: `Confirm LayerZero OFT send of ${amount} USDT to ${destinationRecipient} on chain ${destinationChain}?`,
|
|
49203
|
-
}, (txSig) => `LayerZero OFT transfer submitted: ${txSig}\nTransfer ID: ${
|
|
49204
|
-
});
|
|
49205
|
-
program
|
|
49206
|
-
.command("send")
|
|
49207
|
-
.argument("<amount>", "Source amount in UI units", parseFloat)
|
|
49208
|
-
.argument("<source_mint>")
|
|
49209
|
-
.argument("<destination_chain>", "", parseInt)
|
|
49210
|
-
.argument("<destination_recipient>")
|
|
49211
|
-
.requiredOption("--provider-ix-file <path>", "JSON file with serialized provider instructions")
|
|
49212
|
-
.requiredOption("--provider-receipt <pubkey>", "Provider receipt account, usually the LayerZero nonce PDA")
|
|
49213
|
-
.option("--source-ata <pubkey>", "Optional explicit source token account")
|
|
49214
|
-
.option("--managed", "Keep the inflight transfer managed until reconcile", false)
|
|
49215
|
-
.option("--decimals <decimals>", "Source mint decimals", parseInt, 6)
|
|
49216
|
-
.option("--transfer-id <hex_or_base64>", "Optional 32-byte transfer id")
|
|
49217
|
-
.option("-y, --yes", "Skip confirmation", false)
|
|
49218
|
-
.description("Bridge tokens through a LayerZero OFT provider instruction")
|
|
49219
|
-
.action(async (amount, sourceMint, destinationChain, destinationRecipient, { providerIxFile, providerReceipt, sourceAta, managed, decimals, transferId, yes, }) => {
|
|
49220
|
-
const resolvedTransferId = transferId
|
|
49221
|
-
? parseFixedBytes(transferId, "transferId", 32)
|
|
49222
|
-
: web3_js_1.Keypair.generate().publicKey.toBuffer();
|
|
49223
|
-
const transferIdHex = formatBytesHex(resolvedTransferId);
|
|
49224
|
-
const providerIxs = parseInstructionFile(providerIxFile);
|
|
49225
|
-
await (0, utils_1.executeTxWithErrorHandling)(() => context.glamClient.bridge.sendOft({
|
|
49226
|
-
transferId: resolvedTransferId,
|
|
49227
|
-
sourceMint: new web3_js_1.PublicKey(sourceMint),
|
|
49228
|
-
sourceAmount: (0, glam_sdk_1.fromUiAmount)(amount, decimals),
|
|
49229
|
-
providerInstructions: providerIxs.instructions,
|
|
49230
|
-
providerReceipt: new web3_js_1.PublicKey(providerReceipt),
|
|
49231
|
-
sourceTokenAccount: sourceAta
|
|
49232
|
-
? new web3_js_1.PublicKey(sourceAta)
|
|
49233
|
-
: undefined,
|
|
49234
|
-
managed,
|
|
49235
|
-
providerSigners: providerIxs.additionalSigners,
|
|
49236
|
-
}, context.txOptions), {
|
|
49237
|
-
skip: yes,
|
|
49238
|
-
message: `Confirm LayerZero OFT send of ${amount} tokens to ${destinationRecipient} on chain ${destinationChain}?`,
|
|
49239
|
-
}, (txSig) => `LayerZero OFT transfer submitted: ${txSig}\nTransfer ID: ${transferIdHex}`);
|
|
49317
|
+
}, (txSig) => `LayerZero OFT transfer submitted: ${txSig}\nTransfer ID: ${transferId}`);
|
|
49240
49318
|
});
|
|
49241
49319
|
}
|
|
49242
49320
|
function installBridgeCommands(program, context) {
|
|
@@ -49253,93 +49331,71 @@ function installBridgeCommands(program, context) {
|
|
|
49253
49331
|
printJson({
|
|
49254
49332
|
pubkey: registryPda,
|
|
49255
49333
|
...registry,
|
|
49334
|
+
transfers: registry.transfers.slice(0, toSortableNumber(registry.managedTransferCount)),
|
|
49256
49335
|
});
|
|
49257
49336
|
});
|
|
49258
49337
|
program
|
|
49259
49338
|
.command("records")
|
|
49260
49339
|
.description("List bridge transfer records for the active vault")
|
|
49261
49340
|
.action(async () => {
|
|
49262
|
-
const
|
|
49263
|
-
|
|
49264
|
-
|
|
49265
|
-
|
|
49266
|
-
|
|
49267
|
-
|
|
49268
|
-
|
|
49269
|
-
|
|
49270
|
-
printJson(records
|
|
49271
|
-
.map((record) => ({
|
|
49272
|
-
pubkey: record.publicKey,
|
|
49273
|
-
...record.account,
|
|
49274
|
-
}))
|
|
49275
|
-
.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) -
|
|
49276
49350
|
toSortableNumber(left.committedSlot)));
|
|
49277
49351
|
});
|
|
49278
49352
|
program
|
|
49279
49353
|
.command("record")
|
|
49280
|
-
.argument("<transfer_id>", "32-byte hex
|
|
49354
|
+
.argument("<transfer_id>", "transfer id pubkey or 32-byte hex/base64")
|
|
49281
49355
|
.description("View a single bridge transfer record")
|
|
49282
49356
|
.action(async (transferId) => {
|
|
49283
|
-
const parsedTransferId =
|
|
49284
|
-
const
|
|
49285
|
-
const record = await context.glamClient.extBridgeProgram.account.bridgeTransferRecord.fetchNullable(recordPda);
|
|
49357
|
+
const parsedTransferId = parseTransferId(transferId);
|
|
49358
|
+
const record = await context.glamClient.bridge.fetchTransferRecordNullable(parsedTransferId);
|
|
49286
49359
|
if (!record) {
|
|
49287
|
-
console.error(`Bridge transfer record not found
|
|
49360
|
+
console.error(`Bridge transfer record not found for transfer ${formatTransferId(parsedTransferId)}`);
|
|
49288
49361
|
process.exit(1);
|
|
49289
49362
|
}
|
|
49290
|
-
printJson(
|
|
49291
|
-
pubkey: recordPda,
|
|
49292
|
-
...record,
|
|
49293
|
-
});
|
|
49363
|
+
printJson(record);
|
|
49294
49364
|
});
|
|
49295
49365
|
program
|
|
49296
|
-
.command("
|
|
49297
|
-
.
|
|
49298
|
-
.
|
|
49299
|
-
.
|
|
49300
|
-
const parsedTransferId = parseFixedBytes(transferId, "transferId", 32);
|
|
49301
|
-
const transferIdHex = formatBytesHex(parsedTransferId);
|
|
49302
|
-
await (0, utils_1.executeTxWithErrorHandling)(() => context.glamClient.bridge.settleManagedTransfer(parsedTransferId, context.txOptions), {
|
|
49303
|
-
skip: yes,
|
|
49304
|
-
message: `Confirm marking transfer ${transferIdHex} as settled?`,
|
|
49305
|
-
}, (txSig) => `Transfer settled: ${txSig}`);
|
|
49306
|
-
});
|
|
49307
|
-
program
|
|
49308
|
-
.command("reconcile")
|
|
49309
|
-
.argument("<transfer_id>", "32-byte hex or base64 transfer id")
|
|
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")
|
|
49310
49370
|
.option("-y, --yes", "Skip confirmation", false)
|
|
49311
49371
|
.action(async (transferId, { yes }) => {
|
|
49312
|
-
const parsedTransferId =
|
|
49313
|
-
|
|
49314
|
-
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), {
|
|
49315
49374
|
skip: yes,
|
|
49316
|
-
message: `Confirm
|
|
49317
|
-
}, (txSig) => `Transfer
|
|
49375
|
+
message: `Confirm validating transfer ${parsedTransferId}?`,
|
|
49376
|
+
}, (txSig) => `Transfer validated: ${txSig}`);
|
|
49318
49377
|
});
|
|
49319
49378
|
program
|
|
49320
|
-
.command("
|
|
49321
|
-
.
|
|
49322
|
-
.argument("<reason>", "Failure reason code", parseInt)
|
|
49379
|
+
.command("price")
|
|
49380
|
+
.description("Price all managed bridge transfers")
|
|
49323
49381
|
.option("-y, --yes", "Skip confirmation", false)
|
|
49324
|
-
.action(async (
|
|
49325
|
-
|
|
49326
|
-
const transferIdHex = formatBytesHex(parsedTransferId);
|
|
49327
|
-
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), {
|
|
49328
49384
|
skip: yes,
|
|
49329
|
-
message:
|
|
49330
|
-
}, (txSig) => `
|
|
49385
|
+
message: "Confirm pricing all managed transfers?",
|
|
49386
|
+
}, (txSig) => `Managed transfers priced: ${txSig}`);
|
|
49331
49387
|
});
|
|
49332
49388
|
program
|
|
49333
|
-
.command("
|
|
49334
|
-
.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")
|
|
49335
49392
|
.option("-y, --yes", "Skip confirmation", false)
|
|
49336
49393
|
.action(async (transferId, { yes }) => {
|
|
49337
|
-
const parsedTransferId =
|
|
49338
|
-
|
|
49339
|
-
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), {
|
|
49340
49396
|
skip: yes,
|
|
49341
|
-
message: `Confirm
|
|
49342
|
-
}, (txSig) => `Transfer
|
|
49397
|
+
message: `Confirm settling transfer ${parsedTransferId}?`,
|
|
49398
|
+
}, (txSig) => `Transfer settled: ${txSig}`);
|
|
49343
49399
|
});
|
|
49344
49400
|
const oft = program.command("oft").description("LayerZero OFT");
|
|
49345
49401
|
installLayerzeroOftCommands(oft, context);
|
|
@@ -49353,6 +49409,7 @@ function installBridgeCommands(program, context) {
|
|
|
49353
49409
|
"use strict";
|
|
49354
49410
|
|
|
49355
49411
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
49412
|
+
exports.parsePositionId = parsePositionId;
|
|
49356
49413
|
exports.installEpiCommands = installEpiCommands;
|
|
49357
49414
|
const tslib_1 = __webpack_require__(2);
|
|
49358
49415
|
const anchor_1 = __webpack_require__(4);
|
|
@@ -49372,18 +49429,57 @@ function parseHexOrBase64Bytes(value, label) {
|
|
|
49372
49429
|
}
|
|
49373
49430
|
return bytes;
|
|
49374
49431
|
}
|
|
49432
|
+
function encodePositionIdString(value) {
|
|
49433
|
+
const bytes = Buffer.from(value, "utf8");
|
|
49434
|
+
if (bytes.length === 0) {
|
|
49435
|
+
throw new Error("position must not be empty");
|
|
49436
|
+
}
|
|
49437
|
+
if (bytes.length > 32) {
|
|
49438
|
+
throw new Error("position must be a pubkey, exactly 32 decoded bytes, or a UTF-8 string up to 32 bytes");
|
|
49439
|
+
}
|
|
49440
|
+
const encoded = Buffer.alloc(32);
|
|
49441
|
+
bytes.copy(encoded);
|
|
49442
|
+
return Array.from(encoded);
|
|
49443
|
+
}
|
|
49375
49444
|
function parsePositionId(value) {
|
|
49445
|
+
const normalized = value.trim();
|
|
49376
49446
|
try {
|
|
49377
|
-
return Array.from(new web3_js_1.PublicKey(
|
|
49447
|
+
return Array.from(new web3_js_1.PublicKey(normalized).toBytes());
|
|
49378
49448
|
}
|
|
49379
49449
|
catch {
|
|
49380
|
-
|
|
49381
|
-
|
|
49382
|
-
|
|
49450
|
+
try {
|
|
49451
|
+
const bytes = parseHexOrBase64Bytes(normalized, "position");
|
|
49452
|
+
if (bytes.length === 32) {
|
|
49453
|
+
return Array.from(bytes);
|
|
49454
|
+
}
|
|
49383
49455
|
}
|
|
49384
|
-
|
|
49456
|
+
catch { }
|
|
49457
|
+
return encodePositionIdString(normalized);
|
|
49385
49458
|
}
|
|
49386
49459
|
}
|
|
49460
|
+
function formatPositionLabel(value, positionId) {
|
|
49461
|
+
const normalized = value.trim();
|
|
49462
|
+
try {
|
|
49463
|
+
new web3_js_1.PublicKey(normalized);
|
|
49464
|
+
return formatPositionId(positionId);
|
|
49465
|
+
}
|
|
49466
|
+
catch { }
|
|
49467
|
+
try {
|
|
49468
|
+
const bytes = parseHexOrBase64Bytes(normalized, "position");
|
|
49469
|
+
if (bytes.length === 32) {
|
|
49470
|
+
return formatPositionId(positionId);
|
|
49471
|
+
}
|
|
49472
|
+
}
|
|
49473
|
+
catch { }
|
|
49474
|
+
return `${JSON.stringify(normalized)} (${formatPositionId(positionId)})`;
|
|
49475
|
+
}
|
|
49476
|
+
function parsePosition(value) {
|
|
49477
|
+
const positionId = parsePositionId(value);
|
|
49478
|
+
return {
|
|
49479
|
+
positionId,
|
|
49480
|
+
positionLabel: formatPositionLabel(value, positionId),
|
|
49481
|
+
};
|
|
49482
|
+
}
|
|
49387
49483
|
function formatPositionId(positionId) {
|
|
49388
49484
|
return new web3_js_1.PublicKey(Uint8Array.from(positionId)).toBase58();
|
|
49389
49485
|
}
|
|
@@ -49462,7 +49558,7 @@ function installEpiCommands(program, context) {
|
|
|
49462
49558
|
program
|
|
49463
49559
|
.command("upsert-position")
|
|
49464
49560
|
.description("Create or update a tracked external position, including bridge transfer record PDAs")
|
|
49465
|
-
.argument("<position>", "tracked external position pubkey, transfer record PDA, or 32-byte position id")
|
|
49561
|
+
.argument("<position>", "tracked external position pubkey, transfer record PDA, UTF-8 string id, or 32-byte encoded position id")
|
|
49466
49562
|
.option("--denom <denom>", "observation denomination: usd or mint", "usd")
|
|
49467
49563
|
.option("--mint <pubkey>", "mint address when --denom mint")
|
|
49468
49564
|
.option("--freshness-secs <u32>", "freshness override in seconds, defaults to 0", "0")
|
|
@@ -49473,8 +49569,7 @@ function installEpiCommands(program, context) {
|
|
|
49473
49569
|
.option("--disabled", "upsert with enabled=false", false)
|
|
49474
49570
|
.option("-y, --yes", "Skip confirmation", false)
|
|
49475
49571
|
.action(async (position, options) => {
|
|
49476
|
-
const positionId =
|
|
49477
|
-
const positionLabel = formatPositionId(positionId);
|
|
49572
|
+
const { positionId, positionLabel } = parsePosition(position);
|
|
49478
49573
|
const { denomination, label } = await resolveDenomination(context, {
|
|
49479
49574
|
denom: options.denom,
|
|
49480
49575
|
mint: options.mint,
|
|
@@ -49504,7 +49599,7 @@ function installEpiCommands(program, context) {
|
|
|
49504
49599
|
program
|
|
49505
49600
|
.command("submit")
|
|
49506
49601
|
.description("Submit an observation for a tracked external position or transfer record PDA")
|
|
49507
|
-
.argument("<position>", "tracked external position pubkey, transfer record PDA, or 32-byte position id")
|
|
49602
|
+
.argument("<position>", "tracked external position pubkey, transfer record PDA, UTF-8 string id, or 32-byte encoded position id")
|
|
49508
49603
|
.argument("<amount>", "signed UI amount in the specified observation denomination")
|
|
49509
49604
|
.option("--denom <denom>", "observation denomination: usd or mint", "usd")
|
|
49510
49605
|
.option("--mint <pubkey>", "mint address when --denom mint")
|
|
@@ -49512,14 +49607,13 @@ function installEpiCommands(program, context) {
|
|
|
49512
49607
|
.option("--external-shares <raw-u64>", "external shares for tokenized positions, defaults to 0", "0")
|
|
49513
49608
|
.option("-y, --yes", "Skip confirmation", false)
|
|
49514
49609
|
.action(async (position, amount, options) => {
|
|
49515
|
-
const positionId =
|
|
49610
|
+
const { positionId, positionLabel } = parsePosition(position);
|
|
49516
49611
|
const { denomination, decimals, label } = await resolveDenomination(context, options);
|
|
49517
49612
|
const observationTimestamp = options.timestamp !== undefined
|
|
49518
49613
|
? parseSignedInteger(options.timestamp, "--timestamp")
|
|
49519
49614
|
: new anchor_1.BN(Math.floor(Date.now() / 1000));
|
|
49520
49615
|
const externalShares = parseUnsignedInteger(options.externalShares || "0", "--external-shares");
|
|
49521
49616
|
const amountBn = parseSignedUiAmount(amount, decimals, "amount");
|
|
49522
|
-
const positionLabel = formatPositionId(positionId);
|
|
49523
49617
|
await (0, utils_1.executeTxWithErrorHandling)(() => context.glamClient.epi.submitExternalObservation({
|
|
49524
49618
|
positionId,
|
|
49525
49619
|
amount: amountBn,
|
|
@@ -49534,16 +49628,15 @@ function installEpiCommands(program, context) {
|
|
|
49534
49628
|
program
|
|
49535
49629
|
.command("validate")
|
|
49536
49630
|
.description("Validate a pending observation for a tracked external position")
|
|
49537
|
-
.argument("<position>", "tracked external position pubkey, transfer record PDA, or 32-byte position id")
|
|
49631
|
+
.argument("<position>", "tracked external position pubkey, transfer record PDA, UTF-8 string id, or 32-byte encoded position id")
|
|
49538
49632
|
.option("--normalized-base-asset-amount <amount>", "signed UI amount in the vault base asset; omit to submit None")
|
|
49539
49633
|
.option("-y, --yes", "Skip confirmation", false)
|
|
49540
49634
|
.action(async (position, options) => {
|
|
49541
|
-
const positionId =
|
|
49635
|
+
const { positionId, positionLabel } = parsePosition(position);
|
|
49542
49636
|
const stateModel = await fetchStateModel(context);
|
|
49543
49637
|
const normalizedBaseAssetAmount = options.normalizedBaseAssetAmount === undefined
|
|
49544
49638
|
? null
|
|
49545
49639
|
: parseSignedUiAmount(options.normalizedBaseAssetAmount, stateModel.baseAssetDecimals, "--normalized-base-asset-amount");
|
|
49546
|
-
const positionLabel = formatPositionId(positionId);
|
|
49547
49640
|
const normalizedAmountLabel = options.normalizedBaseAssetAmount === undefined
|
|
49548
49641
|
? "None"
|
|
49549
49642
|
: `${options.normalizedBaseAssetAmount} ${stateModel.baseAssetMint.toBase58()}`;
|
|
@@ -50233,7 +50326,7 @@ program
|
|
|
50233
50326
|
initialize(config, skipSimulation);
|
|
50234
50327
|
await (0, idl_1.idlCheck)(context.glamClient);
|
|
50235
50328
|
})
|
|
50236
|
-
.version("1.0.14-alpha.
|
|
50329
|
+
.version("1.0.14-alpha.3");
|
|
50237
50330
|
program
|
|
50238
50331
|
.command("env")
|
|
50239
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",
|