upsert_external_position
Create or update an external position configuration.
Handler narrative
- Load the GLAM state or program account required by the instruction and verify the signer.
- Verify that the integration is enabled on the vault and that the caller has the required delegate permission or owner authority.
- Validate the instruction-specific policy, then invoke the external protocol with the vault authority where required.
- Create or update an external position configuration. Creates the observation state PDA on first call for a position.
Required conditions
- The submitted accounts must match the declared account list, signer requirements, writable requirements, fixed program addresses, and account relationships shown below.
- The GLAM state account is the source of truth for owner, enabled integrations, delegate permissions, policies, assets, borrowable assets, timelock settings, mint linkage, and pricing records.
- The vault account must be the PDA controlled by the core protocol program and derived conceptually from the state account; instructions use it as the vault authority for SOL, token accounts, and external positions.
- The vault integration ACL must enable this integration before the instruction is accepted; that enablement is defined on the GLAM state account.
- If the signer is not the owner, the delegate ACL on the GLAM state must contain the exact protocol permission required by this instruction; registering a delegate alone is insufficient.
- Instruction-specific destination accounts must satisfy the external protocol's own account model; GLAM validates the accounts it needs for authorization and policy enforcement, then passes the remaining protocol accounts through CPI.
- Creation-style flows require the target account or PDA to be uninitialized or intentionally updatable, the fee payer to be writable, and the System Program to be present when rent or allocation is needed.
Accounts
Uses the standard Big Seven account pattern, plus the instruction-specific accounts below.
| Account | Role | Description |
|---|---|---|
| observation_state | writable | Program-derived account used by this instruction; clients should prefer SDK helpers when available. |
Arguments
| Argument | Type | Notes |
|---|---|---|
| config | ExternalPositionConfig | Configuration object; field details are listed below. Fields: |
Policy & permissions
Enable the External Position Interface integration before observations affect vault pricing.
Caller must be the owner or a delegate with the explicit protocol permission required by this instruction.
TypeScript SDK usage
await glamClient.epi.upsertExternalPosition({
positionId,
positionType: { valued: {} },
sourceType: { trusted: {} },
denomination,
enabled: true,
freshnessOverrideSecs: 0,
submitAllowlist: [],
validateAllowlist: [],
configureAllowlist: [],
});Cross-instruction constraints
- No additional cross-instruction constraint is documented beyond account initialization, authority checks, and policy validation.