@keetanetwork/anchor 0.0.99 → 0.0.101

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.
@@ -1 +1 @@
1
- {"version":3,"file":"chaining.js","sourceRoot":"","sources":["../../src/lib/chaining.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,+BAA+B,CAAC;AAE1D,OAAO,EAAE,4BAA4B,EAAE,kCAAkC,EAAE,oBAAoB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAEhL,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAE3F,OAAO,EAAE,UAAU,EAAE,6BAA6B,EAAE,MAAM,EAAE,MAAM,gDAAgD,CAAC;AACnH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAC3D,OAAO,8BAA8B,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAMvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAmB7C,CAAC;AASD,CAAC;AAID,CAAC;AAOD,CAAC;AA4KF,SAAS,0BAA0B,CAAC,CAAsB,EAAE,CAAsB;IACjF,OAAM,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC;AAED;;;;GAIG;AACH,SAAS,YAAY,CAAC,IAAmB;IACxC,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QACxB,OAAM,C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C,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;oBACrD,CAAC;yBAAM,IAAI,IAAI,CAAC,KAAK,YAAY,kBAAkB,EAAE,CAAC;wBACrD,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;oBACrD,CAAC;gBACF,CAAC;YACF,CAAC;iBAAM,CAAC;gBACP,IAAI,IAAI,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;oBAChC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,0BAA0B,EAAE,kCAAkC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;gBACjG,CAAC;qBAAM,IAAI,cAAc,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,gBAAgB,EAAE,CAAC;oBAC7E,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,0BAA0B,EAAE,wDAAwD,CAAC,CAAC;gBAC1G,CAAC;qBAAM,CAAC;oBACP,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACtB,CAAC;YACF,CAAC;QACF,CAAC;QAED,IAAI,cAAc,IAAI,CAAC,OAAO,EAAE,gBAAgB,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtE,OAAM,CAAC,IAAI,CAAC,CAAC;QACd,CAAC;QAED,OAAM,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;CACD","sourcesContent":["import type { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';\nimport * as KeetaNet from \"@keetanetwork/keetanet-client\";\nimport type { AnchorTokenLocationMetadata, AssetLocationLike, AssetFeeBreakdown, AssetFeeLineItemType, AssetTransferInstructions, AssetWithRails, FiatPushRails, KeetaAssetMovementTransaction, KeetaPersistentForwardingAddressDetails, MovableAssetSearchCanonical, PersistentAddressAssetFeeBreakdown, PickChainLocation, Rail, RailOrRailWithExtendedDetails, RecipientResolved, ResolvedFeeLineItem, SimulatedAssetTransferInstructions, UnresolvedFeeLineItem, AssetOrAssetWithLocation } from \"../services/asset-movement/common.js\";\nimport { convertAssetLocationToString, convertAssetSearchInputToCanonical, doesAssetOrPairMatch, isChainLocation, toAssetLocation } from \"../services/asset-movement/common.js\";\nimport type { Resolver } from \"./index.js\";\nimport { getDefaultResolver } from '../config.js';\nimport type { ISOCurrencyCode } from '@keetanetwork/currency-info';\nimport { Currency } from '@keetanetwork/currency-info';\nimport type { Account, GenericAccount, TokenAddress } from '@keetanetwork/keetanet-client/lib/account.js';\nimport { isAssetLocationLike } from '../services/asset-movement/lib/location.generated.js';\nimport type { ToValuizable } from './resolver.js';\nimport { isFiatRail, isMovableAssetSearchCanonical, isRail } from '../services/asset-movement/common.generated.js';\nimport { assertNever } from './utils/never.js';\nimport { withRetry } from './utils/retry.js';\nimport type { PublicRetryOptions, RetryOptions } from './utils/retry.js';\nimport KeetaFXAnchorClient from '../services/fx/client.js';\nimport KeetaAssetMovementAnchorClient from '../services/asset-movement/client.js';\nimport type { ExternalChainAsset, EVMChecksumCache } from './asset.js';\nimport { isExternalChainAsset, isMovableAssetEqual } from './asset.js';\nimport type { Logger } from './log/index.js';\nimport type { BlockHash } from '@keetanetwork/keetanet-client/lib/block/index.js';\nimport type { AnchorExternalInput } from './anchor-external.js';\nimport type { AnchorMetadataLegalField } from './metadata.types.js';\nimport type { ClientRenderableContent } from './metadata.types.js';\nimport { AnchorExternalBuilder } from './anchor-external.js';\nimport { KeetaAnchorError } from './error.js';\n\ntype FXQuoteOrEstimate = NonNullable<Awaited<ReturnType<KeetaFXAnchorClient['getQuotesOrEstimates']>>>[number];\ntype AssetMovementProvider = NonNullable<Awaited<ReturnType<KeetaAssetMovementAnchorClient['getProvidersForTransfer']>>>[number];\ntype AssetMovementTransfer = Awaited<ReturnType<AssetMovementProvider['initiateTransfer']>>;\ntype FXExchange = Awaited<ReturnType<FXQuoteOrEstimate['createExchange']>>;\n\ninterface ChainStepResolutionBase<Type extends 'fx' | 'assetMovement' | 'keetaSend' | 'forwarded'> {\n\ttype: Type;\n\tvalueIn: bigint;\n\tvalueOut: bigint;\n\tstep: Type extends 'keetaSend' ? null : (\n\t\tType extends 'forwarded' ? AssetMovementGraphNode : Extract<GraphNodeLike, { type: Type }>\n\t);\n}\n\ninterface ChainStepResolutionFX extends ChainStepResolutionBase<'fx'> {\n\ttype: 'fx';\n\tresult: FXQuoteOrEstimate;\n};\n\ntype SendingToType = 'SELF' | 'NEXT_STEP' | 'FINAL_DESTINATION';\n\ninterface ChainStepResolutionAssetMovement extends ChainStepResolutionBase<'assetMovement'> {\n\tusingInstruction: AssetTransferInstructions;\n\tsendingTo: SendingToType;\n\ttransfer: AssetMovementTransfer;\n\tprovider: AssetMovementProvider;\n};\n\ninterface ChainStepResolutionKeetaSend extends ChainStepResolutionBase<'keetaSend'> {\n\tusingInstruction: Extract<AssetTransferInstructions, { type: 'KEETA_SEND' }>;\n};\n\ninterface ChainStepResolutionForwarded extends ChainStepResolutionBase<'forwarded'> {\n\tpersistentAddress: KeetaPersistentForwardingAddressDetails;\n\tprovider: AssetMovementProvider;\n\t/** Present when simulateTransfer succeeded during plan computation (non-forwardingOnly). */\n\tsimulatedTransfer?: Awaited<ReturnType<AssetMovementProvider['simulateTransfer']>>;\n};\n\nexport type Disclaimer = Exclude<AnchorMetadataLegalField['disclaimers'], undefined>[number];\ntype ProviderDisclaimers = {\n\tproviderID: string;\n\tdisclaimers: Disclaimer[];\n}\ntype PlanDisclaimers = ProviderDisclaimers[];\n\nexport type ChainStepResolution = ChainStepResolutionFX | ChainStepResolutionAssetMovement | ChainStepResolutionKeetaSend | ChainStepResolutionForwarded;\n\ntype AnchorChainingPathComputedPlan = {\n\tsteps: ChainStepResolution[];\n\ttotalValueIn: bigint;\n\ttotalValueOut: bigint;\n};\n\ntype ExecutedStepFX = {\n\ttype: 'fx';\n\tplan: ChainStepResolutionFX;\n\texchange: FXExchange;\n};\n\ntype ExecutedStepAssetMovement = {\n\ttype: 'assetMovement';\n\tplan: ChainStepResolutionAssetMovement;\n};\n\ntype ExecutedStepKeetaSend = {\n\ttype: 'keetaSend';\n\tplan: ChainStepResolutionKeetaSend;\n};\n\ntype ExecutedStepForwarded = {\n\ttype: 'forwarded';\n\tplan: ChainStepResolutionForwarded;\n\tobservedTransaction: KeetaAssetMovementTransaction;\n};\n\n\nexport type ExecutedStep = ExecutedStepFX | ExecutedStepAssetMovement | ExecutedStepKeetaSend | ExecutedStepForwarded;\n\nexport type AnchorChainingPathExecuteResult = {\n\tsteps: ExecutedStep[];\n};\n\nexport type AnchorChainingPathExecuteOptions = {\n\trequireSendAuth?: boolean;\n\tabortSignal?: AbortSignal;\n\tpoll?: PublicRetryOptions;\n};\n\nexport type AnchorChainingPathState =\n\t| { status: 'idle' }\n\t| { status: 'executing'; completedSteps: ExecutedStep[]; currentStepIndex: number }\n\t| { status: 'completed'; result: AnchorChainingPathExecuteResult }\n\t| { status: 'failed'; error: Error; completedSteps: ExecutedStep[]; failedAtStepIndex: number };\n\ninterface StepNeededActionEventPayloadBase<ActionType, ActionPayload, CompletedPayload extends readonly unknown[] = []> {\n\ttype: ActionType;\n\n\tmarkCompleted: (...args: CompletedPayload) => void;\n\tmarkFailed: (error?: unknown) => void;\n\n\taction: ActionPayload;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\ninterface StepNeededActionEventAssetMovement extends StepNeededActionEventPayloadBase<'assetMovementUserExecutionRequired', { assetMovementTransfer: AssetMovementTransfer; }, []> {}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\ninterface StepNeededActionEventKeetaSend extends StepNeededActionEventPayloadBase<'keetaSendAuthRequired', {\n\tsendToAddress: GenericAccount;\n\tvalue: bigint;\n\ttoken: TokenAddress;\n\texternal?: string;\n}, [ { sent: boolean | BlockHash; }]> {}\n\ntype StepNeededActionEventPayload = StepNeededActionEventKeetaSend | StepNeededActionEventAssetMovement;\n\ntype AnchorChainingPathEventMap = {\n\tstateChange: [state: AnchorChainingPathState];\n\tstepExecuted: [step: ExecutedStep, index: number];\n\tcompleted: [result: AnchorChainingPathExecuteResult];\n\tfailed: [error: Error, completedSteps: ExecutedStep[], failedAtStepIndex: number];\n\tstepNeedsAction: [StepNeededActionEventPayload];\n\ttransactionObserved: [payload: AnchorChainingTransactionObservedEvent];\n}\n\nexport type AnchorChainingTransactionObservedSource = 'getTransferStatus' | 'listTransactions';\n\nexport type AnchorChainingTransactionObservedEvent = {\n\tstepIndex: number;\n\tplanStep: ChainStepResolution;\n\ttransaction: KeetaAssetMovementTransaction;\n\tsource: AnchorChainingTransactionObservedSource;\n};\n\ninterface RailSupportedOperations {\n\tcreatePersistentForwarding?: boolean;\n\tinitiateTransfer?: boolean;\n\tsimulateTransfer?: boolean;\n}\n\ninterface RailWithSupportedOperations {\n\trail: Rail;\n\tsupportedOperations?: RailSupportedOperations;\n}\n\ninterface AnchorChainingAssetAndLocation<AssetType extends AnchorChainingAsset = AnchorChainingAsset, Location extends AssetLocationLike = AssetLocationLike> {\n\tasset: AssetType;\n\tlocation: Location;\n\trail: Rail;\n\tsupportedOperations?: RailSupportedOperations;\n\tvalue?: bigint;\n\n}\n\ninterface AnchorChainingDestination extends AnchorChainingAssetAndLocation {\n\trecipient: RecipientResolved;\n}\n\nexport interface AnchorChainingPathInput {\n\tsource: AnchorChainingAssetAndLocation;\n\tdestination: AnchorChainingDestination;\n}\n\nexport interface AnchorChainingConfig {\n\tclient: KeetaNet.UserClient;\n\tresolver?: Resolver;\n\tsigner?: InstanceType<typeof KeetaNetLib.Account>;\n\taccount?: InstanceType<typeof KeetaNetLib.Account>;\n\tlogger?: Logger;\n}\n\ninterface BaseGraphNodeLike<Type extends 'fx' | 'assetMovement', AssetType extends AnchorChainingAsset> {\n\ttype: Type;\n\tproviderID: string;\n\n\tfrom: AnchorChainingAssetAndLocation<AssetType>;\n\tto: AnchorChainingAssetAndLocation<AssetType>;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\ninterface FXGraphNode extends BaseGraphNodeLike<'fx', Exclude<AnchorChainingAsset, ExternalChainAsset>> {}\ninterface AssetMovementGraphNode extends BaseGraphNodeLike<'assetMovement', AnchorChainingAsset> {\n\t/**\n\t * Operations the provider itself publishes, independent of any rail-specific\n\t * declaration. Mirrors what `provider.isOperationSupported()` answers at plan\n\t * time, so a pure validation can reach the same verdict as computing a plan.\n\t *\n\t * Distinct from the per-side `supportedOperations`, which describes one rail\n\t * and is absent for providers that publish no rail-level detail.\n\t */\n\tproviderOperations?: RailSupportedOperations;\n}\nexport type GraphNodeLike = FXGraphNode | AssetMovementGraphNode;\n\ntype KeetaLocationLike = Extract<AssetLocationLike, `chain:keeta:${bigint}`> | PickChainLocation<'keeta'>;\ninterface KeetaSendStepLike {\n\ttype: 'keetaSend';\n\n\tproviderID?: null;\n\n\tfrom: AnchorChainingAssetAndLocation<AnchorChainingAsset, KeetaLocationLike>;\n\tto: AnchorChainingAssetAndLocation<AnchorChainingAsset, KeetaLocationLike>;\n}\n\nexport type AnchorChainingStepLike = GraphNodeLike | KeetaSendStepLike;\n\nexport type AnchorChainingAsset = TokenAddress | ISOCurrencyCode | ExternalChainAsset;\n\nfunction isAnchorChainingAssetEqual(a: AnchorChainingAsset, b: AnchorChainingAsset): boolean {\n\treturn(isMovableAssetEqual(a, b));\n}\n\n/**\n * Returns true for nodes that keep assets on Keeta: FX nodes, plus\n * asset-movement nodes whose from and to share the same Keeta chain location\n * (custodial FX anchors that don't actually move funds off-chain).\n */\nfunction isFXLikeNode(node: GraphNodeLike): boolean {\n\tif (node.type === 'fx') {\n\t\treturn(true);\n\t}\n\tconst fromStr = convertAssetLocationToString(node.from.location);\n\tconst toStr = convertAssetLocationToString(node.to.location);\n\treturn(fromStr === toStr && fromStr.startsWith('chain:keeta:'));\n}\n\n\ninterface AssetMovementResolvedRails {\n\tcommon: RailWithSupportedOperations[];\n\tinbound: RailWithSupportedOperations[];\n\toutbound: RailWithSupportedOperations[];\n}\n\nexport type AnchorChainingListAssetsSideFilter = {\n\tlocation?: AssetLocationLike | undefined;\n\tasset?: AnchorChainingAsset | undefined;\n\trail?: Rail | undefined;\n};\n\ntype AnchorChainingListAssetsShared = {\n\tmaxStepCount?: number;\n\tonlyAllowFXLike?: boolean;\n};\n\nexport type AnchorChainingListAssetsFilter =\n\t| ({ from: AnchorChainingListAssetsSideFilter; to?: never } & AnchorChainingListAssetsShared)\n\t| ({ to: AnchorChainingListAssetsSideFilter; from?: never } & AnchorChainingListAssetsShared)\n\t| ({ from?: never; to?: never } & AnchorChainingListAssetsShared);\n\nexport type ForwardingOnlyMethod = 'explicit' | 'implied';\n\nexport type ForwardingOnlyOptions = {\n\tmethod: ForwardingOnlyMethod;\n\t/** Max asset-movement legs (default 2, matching deposit UX). */\n\tmaxLegs?: number;\n};\n\nconst DEFAULT_FORWARDING_MAX_LEGS = 2;\n\nfunction normalizeForwardingOnlyOptions(forwardingOnly: boolean | ForwardingOnlyOptions | undefined): ForwardingOnlyOptions | undefined {\n\tif (!forwardingOnly) {\n\t\treturn(undefined);\n\t}\n\n\tif (forwardingOnly === true) {\n\t\treturn({ method: 'explicit', maxLegs: DEFAULT_FORWARDING_MAX_LEGS });\n\t}\n\n\treturn({\n\t\tmaxLegs: DEFAULT_FORWARDING_MAX_LEGS,\n\t\t...forwardingOnly\n\t});\n}\n\nexport type AnchorChainingResolveAssetsFilter = {\n\tfrom?: AnchorChainingListAssetsSideFilter;\n\tto?: AnchorChainingListAssetsSideFilter;\n\tmaxStepCount?: number;\n\tonlyAllowFXLike?: boolean;\n\t/**\n\t * When set, only consider persistent-forwarding-eligible crypto hops\n\t * (asset-movement, non-Keeta origin). `true` means `{ method: 'explicit' }`.\n\t * Depth is controlled by `maxStepCount` when provided; otherwise defaults to\n\t * {@link DEFAULT_FORWARDING_MAX_LEGS} (same as getPlans' maxLegs default).\n\t */\n\tforwardingOnly?: boolean | Pick<ForwardingOnlyOptions, 'method'>;\n};\n\nexport const DEFAULT_MAX_PATH_LENGTH = 5;\nexport const DEFAULT_MAX_PATHS = 50;\n\nexport type AnchorChainingFindPathsOptions = {\n\t/**\n\t * Maximum number of legs a path may contain. Defaults to DEFAULT_MAX_PATH_LENGTH,\n\t * or to forwarding `maxLegs` when `forwardingOnly` is set.\n\t */\n\tmaxPathLength?: number;\n\t/**\n\t * Maximum number of paths to collect before halting the search. Defaults to DEFAULT_MAX_PATHS.\n\t */\n\tmaxPaths?: number;\n\t/**\n\t * When set, only traverse persistent-forwarding-eligible crypto hops.\n\t * `true` means `{ method: 'explicit' }` with default maxLegs.\n\t */\n\tforwardingOnly?: boolean | ForwardingOnlyOptions;\n};\n\nexport interface AnchorChainingResolveAssetsResult {\n\tfrom: AnchorChainingAssetInfo[];\n\tto: AnchorChainingAssetInfo[];\n}\n\nexport interface AnchorChainingAssetInfo {\n\tasset: AnchorChainingAsset;\n\tlocation: AssetLocationLike;\n\trails: {\n\t\tinbound: Rail[];\n\t\toutbound: Rail[];\n\t};\n\n\tdistance: {\n\t\tpathLength: number;\n\t} | null;\n}\n\ntype AnchorChainingAssetInfoWithMetadata = AnchorChainingAssetInfo & {\n\tmetadata?: AnchorTokenLocationMetadata;\n}\n\ninterface AnchorChainingResolveAssetsWithMetadataResult {\n\tfrom: AnchorChainingAssetInfoWithMetadata[];\n\tto: AnchorChainingAssetInfoWithMetadata[];\n}\n\ntype AnchorChainingWithMetadataOptions = {\n\tproviderID?: string;\n};\n\ntype GetAccountForActionPayload = {\n\ttype: 'assetMovement';\n\tproviderMethod: 'initiateTransfer';\n\tprovider?: AssetMovementProvider;\n} | {\n\ttype: 'fx';\n\tproviderMethod: 'getAccountForAction';\n}\n\ntype AccountLike = InstanceType<typeof KeetaNetLib.Account> | undefined | ((providerMethodPayload: GetAccountForActionPayload) => Promise<Account> | Account);\ninterface AnchorChainingAccountOverrides {\n\taccount?: AccountLike;\n\tsigner?: AccountLike;\n}\n\n/**\n * Graph-invariant index for resolveAssets, computed once per graph and reused\n * across every resolveAssets / listAssets call. Rebuilding these per call (they\n * depend only on the graph, not the filter) is what makes fan-out patterns --\n * e.g. one listAssets per source asset -- O(callers * nodes) and blow up on a\n * large graph.\n */\ninterface ResolveIndex {\n\tnodes: GraphNodeLike[];\n\t/** Rail-free (asset, location) key per node side, for marking and results. */\n\tfromAssetKeys: string[];\n\ttoAssetKeys: string[];\n\t/** Rail-inclusive join keys: edge i -> j exists iff toKeys[i] === fromKeys[j]. */\n\tfromKeys: string[];\n\ttoKeys: string[];\n\tnodesByFromKey: Map<string, number[]>;\n\tnodesByToKey: Map<string, number[]>;\n\t/** Rail-free (asset, location) buckets, for finding filter start nodes by key. */\n\tnodesByFromAssetKey: Map<string, number[]>;\n\tnodesByToAssetKey: Map<string, number[]>;\n\trailInfo: Map<string, { asset: AnchorChainingAsset; location: AssetLocationLike; inbound: Set<Rail>; outbound: Set<Rail> }>;\n}\n\nexport type ForwardingAssetRef = {\n\tasset: AnchorChainingAsset;\n\tlocation: AssetLocationLike;\n};\n\nconst forwardingAssetKeyCache: EVMChecksumCache = new Map();\n\nfunction forwardingAssetKey(asset: AnchorChainingAsset, location: AssetLocationLike): string {\n\treturn(`${convertAssetSearchInputToCanonical(asset, forwardingAssetKeyCache)}@${convertAssetLocationToString(location)}`);\n}\n\nfunction isCryptoChainLocation(location: AssetLocationLike): boolean {\n\treturn(toAssetLocation(location).type === 'chain');\n}\n\n/**\n * Whether a rail's supportedOperations qualify for forwarding-only filtering.\n * - explicit: createPersistentForwarding must be true\n * - implied: supportedOperations omitted, or createPersistentForwarding is true\n * (a partial object like `{ initiateTransfer: true }` does not qualify)\n */\nexport function supportsPersistentForwarding(\n\tsupportedOperations: RailSupportedOperations | undefined,\n\tmethod: ForwardingOnlyMethod\n): boolean {\n\tif (method === 'explicit') {\n\t\treturn(supportedOperations?.createPersistentForwarding === true);\n\t}\n\n\tif (supportedOperations === undefined) {\n\t\treturn(true);\n\t}\n\n\treturn(supportedOperations.createPersistentForwarding === true);\n}\n\n/**\n * Validate request-level invariants (value affinity) before any network call.\n * Pure: derives the amount/affinity and throws the same messages the inline\n * affinity block in #computePlan used to throw, so observable behavior is\n * unchanged.\n */\nfunction validateRequest(request: AnchorChainingPathInput): { affinity: 'to' | 'from'; amount: bigint } {\n\tif (request.source.value !== undefined && request.destination.value !== undefined) {\n\t\tthrow(new Error('Must have source.value or destination.value but not both'));\n\t} else if (request.source.value !== undefined) {\n\t\treturn({ affinity: 'from', amount: request.source.value });\n\t} else if (request.destination.value !== undefined) {\n\t\treturn({ affinity: 'to', amount: request.destination.value });\n\t} else {\n\t\tthrow(new Error('Must have source.value or destination.value'));\n\t}\n}\n\n/**\n * Whether #computePlan's default-mode scan would select persistent forwarding\n * for this step. Mirrors that selection exactly, including the non-Keeta\n * restriction: a Keeta-source leg is always a user-initiated send, never PFR,\n * even when the provider advertises createPersistentForwarding.\n *\n * Only meaningful outside forwarding-only mode, where every leg is forwarded.\n */\nfunction stepUsesPFR(path: AnchorChainingStepLike[], index: number): boolean {\n\tconst step = path[index];\n\tif (!step || step.type !== 'assetMovement') {\n\t\treturn(false);\n\t}\n\n\tconst priorStep = index > 0 ? path[index - 1] : null;\n\tconst isAmpToAmpTransition = priorStep?.type === 'assetMovement';\n\tconst pfrSupported = step.from.supportedOperations?.createPersistentForwarding === true;\n\tconst initiateForbidden = step.from.supportedOperations?.initiateTransfer === false;\n\tconst sourceIsKeeta = isChainLocation(toAssetLocation(step.from.location), 'keeta');\n\n\treturn(!sourceIsKeeta && (initiateForbidden || (isAmpToAmpTransition && pfrSupported)));\n}\n\n/**\n * Validate structural invariants of a resolved path before any network call,\n * so a structurally-invalid plan fails fast instead of after wasted provider\n * round-trips. Pure: hoists the structural throws that live inline in\n * #computePlan's forwarding-only scan, PFR scan and resolveStep branches,\n * preserving each message verbatim.\n *\n * The three scans run in the same order as #computePlan (forwarding-only, then\n * PFR, then per-step), and each mirrors its selection logic exactly, so the\n * first error thrown here is the same one #computePlan would have thrown.\n *\n * Persistent-forwarding selection depends on the plan options, so callers that\n * intend to compute a forwarding-only plan must pass forwardingOnly:true to get\n * the matching rules. The two modes are mutually exclusive in #computePlan:\n * forwarding-only applies PFR to every leg (chaining each into the next leg's\n * persistent address), while the default mode allows PFR only as the final step.\n */\nfunction validatePathStructure(path: AnchorChainingStepLike[], request: AnchorChainingPathInput, affinity: 'to' | 'from', forwardingOnly: boolean, keetaLocation: string): void {\n\t/*\n\t * Forwarding-only requires every asset-movement leg to qualify for\n\t * persistent forwarding. #computePlan walks backwards here because each leg\n\t * forwards into the next leg's address; the checks below are the\n\t * order-independent subset, so a forward walk would report the same first\n\t * failure for a single-issue path. The backwards walk is kept to match.\n\t */\n\tif (forwardingOnly) {\n\t\tfor (let index = path.length - 1; index >= 0; index--) {\n\t\t\tconst step = path[index];\n\t\t\tif (!step || step.type !== 'assetMovement') {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst pfrEligible = supportsPersistentForwarding(step.from.supportedOperations, 'implied');\n\t\t\tconst sourceIsKeeta = isChainLocation(toAssetLocation(step.from.location), 'keeta');\n\n\t\t\tif (sourceIsKeeta || !pfrEligible) {\n\t\t\t\tthrow(new Error(`Forwarding-only plan requires persistent forwarding support on every leg, but step ${index} at ${convertAssetLocationToString(step.from.location)} does not qualify`));\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * Only the final leg forwards to the request recipient; earlier legs\n\t\t\t * forward to the next leg's persistent address, which is not known\n\t\t\t * until the plan is computed.\n\t\t\t */\n\t\t\tif (index === path.length - 1 && typeof request.destination.recipient !== 'string') {\n\t\t\t\tthrow(new Error(`Forwarding-only plan requires the destination recipient to be a resolved address string`));\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!forwardingOnly) {\n\t\tfor (let index = 0; index < path.length; index++) {\n\t\t\tconst step = path[index];\n\t\t\tif (!step || step.type !== 'assetMovement') {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst pfrSupported = step.from.supportedOperations?.createPersistentForwarding === true;\n\n\t\t\tif (!stepUsesPFR(path, index)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (!pfrSupported) {\n\t\t\t\tthrow(new Error(`Asset movement provider ${step.providerID} source rail ${step.from.rail} at ${convertAssetLocationToString(step.from.location)} declares initiateTransfer:false but does not support createPersistentForwarding`));\n\t\t\t}\n\n\t\t\tif (index !== path.length - 1) {\n\t\t\t\tthrow(new Error(`Persistent-forwarding (PersistentForwardingRelay-only) asset movement steps are currently only supported as the last step in a chain (step ${index} of ${path.length})`));\n\t\t\t}\n\n\t\t\tif (typeof request.destination.recipient !== 'string') {\n\t\t\t\tthrow(new Error(`Persistent-forwarding step at index ${index} requires the chain's destination recipient to be a resolved address string`));\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (let index = 0; index < path.length; index++) {\n\t\tconst step = path[index];\n\t\tif (!step) {\n\t\t\tthrow(new Error(`Step ${index} is not defined`));\n\t\t}\n\n\t\tif (step.type === 'assetMovement') {\n\t\t\tif (affinity === 'to') {\n\t\t\t\tthrow(new Error(`Chaining with affinity 'to' is not currently supported for asset movement steps, as it requires looking up transfer quotes/estimates which is not currently implemented`));\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * Chaining out of an asset-movement step to a non-Keeta intermediate\n\t\t\t * location requires simulateTransfer to compute the deposit amount.\n\t\t\t * #computePlan only reaches that branch when the step is not last, the\n\t\t\t * next step is not persistent-forwarded (which supplies its own address\n\t\t\t * instead), and the next location is not this network's Keeta chain\n\t\t\t * (where funds are parked in the user's account instead).\n\t\t\t *\n\t\t\t * Only reported when the metadata positively says the operation is\n\t\t\t * absent, and guessing when it is unknown would reject paths that\n\t\t\t * compute fine. Most providers publish no rail-level detail at all, so\n\t\t\t * the provider-level operations are what usually settles it; they are\n\t\t\t * the same source `isOperationSupported` consults when planning.\n\t\t\t */\n\t\t\tconst nextPathStep = index !== path.length - 1 ? path[index + 1] : undefined;\n\t\t\tconst cannotSimulateTransfer = step.providerOperations?.simulateTransfer === false ||\n\t\t\t\tstep.from.supportedOperations?.simulateTransfer === false;\n\t\t\tif (\n\t\t\t\t!forwardingOnly &&\n\t\t\t\tnextPathStep !== undefined &&\n\t\t\t\t!stepUsesPFR(path, index + 1) &&\n\t\t\t\tnextPathStep.from.location !== keetaLocation &&\n\t\t\t\tcannotSimulateTransfer\n\t\t\t) {\n\t\t\t\tthrow(new Error(`Asset movement provider ${step.providerID} does not support simulateTransfer, which is required for chaining at non-keeta intermediate location ${convertAssetLocationToString(nextPathStep.from.location)}`));\n\t\t\t}\n\t\t} else if (step.type === 'keetaSend') {\n\t\t\tif (path.length !== 1) {\n\t\t\t\tthrow(new Error(`Direct same-location/same-asset send steps must be the only step in the path`));\n\t\t\t}\n\t\t\tif (!KeetaNet.lib.Account.isInstance(step.from.asset) || !KeetaNet.lib.Account.isInstance(step.to.asset)) {\n\t\t\t\tthrow(new Error(`Expected assets to be token accounts for KEETA_SEND rail`));\n\t\t\t}\n\t\t\tif (!step.from.asset.comparePublicKey(step.to.asset)) {\n\t\t\t\tthrow(new Error(`For KEETA_SEND step, from and to asset must be the same account`));\n\t\t\t}\n\n\t\t\tlet keetaRecipientDestination = null;\n\t\t\tif (KeetaNet.lib.Account.isInstance(request.destination.recipient)) {\n\t\t\t\tkeetaRecipientDestination = request.destination.recipient;\n\t\t\t} else if (typeof request.destination.recipient === 'string') {\n\t\t\t\ttry {\n\t\t\t\t\tkeetaRecipientDestination = KeetaNet.lib.Account.fromPublicKeyString(request.destination.recipient);\n\t\t\t\t} catch {\n\t\t\t\t\t/* ignore errors */\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!keetaRecipientDestination) {\n\t\t\t\tthrow(new Error(`Expected destination recipient to be a public key string for KEETA_SEND step`));\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Whether a graph node is a forwarding-eligible crypto hop (asset-movement,\n * crypto locations, non-Keeta origin, and createPersistentForwarding per method).\n */\nfunction isForwardingEligibleNode(node: GraphNodeLike, method: ForwardingOnlyMethod): boolean {\n\tif (node.type !== 'assetMovement') {\n\t\treturn(false);\n\t}\n\n\tif (!isCryptoChainLocation(node.from.location) || !isCryptoChainLocation(node.to.location)) {\n\t\treturn(false);\n\t}\n\n\tif (isChainLocation(toAssetLocation(node.from.location), 'keeta')) {\n\t\treturn(false);\n\t}\n\n\treturn(supportsPersistentForwarding(node.from.supportedOperations, method));\n}\n\n/**\n * Adjacency over crypto persistent-forwarding edges only - excludes FX edges and\n * any hop that starts on Keeta.\n */\nexport function buildForwardingAdjacency(nodes: GraphNodeLike[]): Map<string, ForwardingAssetRef[]> {\n\tconst adjacency = new Map<string, ForwardingAssetRef[]>();\n\n\tfor (const node of nodes) {\n\t\tif (!isForwardingEligibleNode(node, 'explicit')) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst key = forwardingAssetKey(node.from.asset, node.from.location);\n\t\tconst list = adjacency.get(key) ?? [];\n\t\tlist.push({ asset: node.to.asset, location: node.to.location });\n\t\tadjacency.set(key, list);\n\t}\n\n\treturn(adjacency);\n}\n\n/** Whether `dest` is reachable from `source` over <=`maxLegs` forwarding edges. */\nexport function hasForwardingRoute(\n\tadjacency: Map<string, ForwardingAssetRef[]>,\n\tsource: ForwardingAssetRef,\n\tdest: ForwardingAssetRef,\n\tmaxLegs: number = DEFAULT_FORWARDING_MAX_LEGS\n): boolean {\n\tconst destKey = forwardingAssetKey(dest.asset, dest.location);\n\tlet frontier = [ forwardingAssetKey(source.asset, source.location) ];\n\n\tfor (let depth = 0; depth < maxLegs; depth++) {\n\t\tconst next: string[] = [];\n\n\t\tfor (const key of frontier) {\n\t\t\tfor (const edge of adjacency.get(key) ?? []) {\n\t\t\t\tconst edgeKey = forwardingAssetKey(edge.asset, edge.location);\n\t\t\t\tif (edgeKey === destKey) {\n\t\t\t\t\treturn(true);\n\t\t\t\t}\n\n\t\t\t\tnext.push(edgeKey);\n\t\t\t}\n\t\t}\n\n\t\tfrontier = next;\n\t}\n\n\treturn(false);\n}\n\nclass AnchorGraph {\n\tclient: KeetaNet.UserClient;\n\tresolver: Resolver;\n\tlogger?: Logger | undefined;\n\n\treadonly assetMovementClient: KeetaAssetMovementAnchorClient;\n\treadonly fxClient: KeetaFXAnchorClient;\n\treadonly #assetMovementProviderCache = new Map<string, Promise<AssetMovementProvider | null>>();\n\treadonly #assetNameCache = new Map<MovableAssetSearchCanonical, ISOCurrencyCode | TokenAddress | ExternalChainAsset>();\n\treadonly #evmChecksumCache: EVMChecksumCache = new Map();\n\t#graphNodePromise: Promise<GraphNodeLike[]> | null = null;\n\t#assetMovementProviderIdsByAssetLocation: Promise<Map<string, Set<string>>> | null = null;\n\t#resolveIndexPromise: Promise<ResolveIndex> | null = null;\n\n\tconstructor(args: { client: KeetaNet.UserClient; resolver: Resolver; logger?: Logger | undefined; }) {\n\t\tthis.resolver = args.resolver;\n\t\tthis.client = args.client;\n\t\tthis.logger = args.logger;\n\t\tthis.assetMovementClient = new KeetaAssetMovementAnchorClient(this.client, {\n\t\t\tresolver: this.resolver,\n\t\t\t...(this.logger ? { logger: this.logger } : {})\n\t\t});\n\t\tthis.fxClient = new KeetaFXAnchorClient(this.client, {\n\t\t\tresolver: this.resolver,\n\t\t\t...(this.logger ? { logger: this.logger } : {})\n\t\t});\n\t}\n\n\treadonly #assetLocationKeyCache = new WeakMap<object, string>();\n\t#assetLocationKey = (side: { asset: AnchorChainingAsset; location: AssetLocationLike }) => {\n\t\tconst cached = this.#assetLocationKeyCache.get(side);\n\t\tif (cached !== undefined) {\n\t\t\treturn(cached);\n\t\t}\n\t\tconst key = `${convertAssetSearchInputToCanonical(side.asset, this.#evmChecksumCache)}@${convertAssetLocationToString(side.location)}`;\n\t\tthis.#assetLocationKeyCache.set(side, key);\n\t\treturn(key);\n\t};\n\n\tgetAssetMovementProviderById(providerID: string): Promise<AssetMovementProvider | null> {\n\t\tlet providerPromise = this.#assetMovementProviderCache.get(providerID);\n\t\tif (providerPromise === undefined) {\n\t\t\tproviderPromise = this.assetMovementClient.getProviderByID(providerID).catch((error: unknown) => {\n\t\t\t\t// Don't cache failures -- evict so a later call can retry.\n\t\t\t\tthis.#assetMovementProviderCache.delete(providerID);\n\t\t\t\tthrow(error);\n\t\t\t});\n\t\t\tthis.#assetMovementProviderCache.set(providerID, providerPromise);\n\t\t}\n\n\t\treturn(providerPromise);\n\t}\n\n\tasync #getAssetMovementProviderIdsByAssetLocation(): Promise<Map<string, Set<string>>> {\n\t\tif (this.#assetMovementProviderIdsByAssetLocation === null) {\n\t\t\tthis.#assetMovementProviderIdsByAssetLocation = (async () => {\n\t\t\t\tconst map = new Map<string, Set<string>>();\n\t\t\t\tfor (const node of await this.computeGraphNodes()) {\n\t\t\t\t\tif (node.type !== 'assetMovement') {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tfor (const side of [ node.from, node.to ] as const) {\n\t\t\t\t\t\tconst key = this.#assetLocationKey(side);\n\t\t\t\t\t\tlet providerIDs = map.get(key);\n\t\t\t\t\t\tif (!providerIDs) {\n\t\t\t\t\t\t\tproviderIDs = new Set<string>();\n\t\t\t\t\t\t\tmap.set(key, providerIDs);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tproviderIDs.add(node.providerID);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn(map);\n\t\t\t})();\n\t\t}\n\n\t\treturn(await this.#assetMovementProviderIdsByAssetLocation);\n\t}\n\n\tasync getAssetMovementProvidersForAsset(asset: AnchorChainingAsset, location: AssetLocationLike): Promise<null | { [providerID: string]: { provider: AssetMovementProvider; }}> {\n\t\tconst providerIDs = (await this.#getAssetMovementProviderIdsByAssetLocation()).get(this.#assetLocationKey({ asset, location }));\n\t\tif (!providerIDs || providerIDs.size === 0) {\n\t\t\treturn(null);\n\t\t}\n\n\t\tlet retval: null | { [providerID: string]: { provider: AssetMovementProvider; }} = null;\n\n\t\tconst resolved = await Promise.all([ ...providerIDs ].map(async (providerID) => {\n\t\t\tconst provider = await this.getAssetMovementProviderById(providerID);\n\t\t\treturn({ providerID, provider });\n\t\t}));\n\n\t\tfor (const { providerID, provider } of resolved) {\n\t\t\tif (!provider) {\n\t\t\t\tthis.logger?.debug('AnchorGraph::getAssetMovementProvidersForAsset', `No provider found for providerID ${providerID}, although provider was previously known to exist in the graph nodes`);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (!retval) {\n\t\t\t\tretval = {};\n\t\t\t}\n\t\t\tretval[providerID] = { provider };\n\t\t}\n\n\t\treturn(retval);\n\t}\n\n\tasync #computeFXNodes() {\n\t\tconst fxServices = await this.resolver.lookup('fx', {});\n\n\t\tif (!fxServices) {\n\t\t\treturn([]);\n\t\t}\n\n\t\tconst networkLocation = `chain:keeta:${this.client.network}` satisfies AssetLocationLike;\n\n\t\tconst providerLookupResult = await Promise.all(Object.entries(fxServices).map(async ([ providerID, service ]) => {\n\t\t\ttry {\n\t\t\t\tconst fromEntries = await service.from('array');\n\n\t\t\t\tif (!fromEntries) {\n\t\t\t\t\treturn(null);\n\t\t\t\t}\n\n\t\t\t\tconst operations = await service.operations('object');\n\t\t\t\tif (!operations.createExchange) {\n\t\t\t\t\tthis.logger?.debug('AnchorGraph::computeFXNodes', `FX service ${providerID} does not support createExchange operation, skipping`);\n\t\t\t\t\treturn(null);\n\t\t\t\t}\n\n\t\t\t\tconst pathNodes = await Promise.all(fromEntries.map(async function(fromEntry) {\n\t\t\t\t\tconst pathNodesResult: GraphNodeLike[] = [];\n\n\t\t\t\t\tconst parsedEntry = await fromEntry('object');\n\n\t\t\t\t\tconst [ fromCodes, toCodes ] = await Promise.all([\n\t\t\t\t\t\tparsedEntry.currencyCodes('array'),\n\t\t\t\t\t\tparsedEntry.to('array')\n\t\t\t\t\t]);\n\n\t\t\t\t\tfor (const from of fromCodes) {\n\t\t\t\t\t\tconst fromResolved = await from('string');\n\t\t\t\t\t\tif (!fromResolved) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst fromAccount = KeetaNet.lib.Account.fromPublicKeyString(fromResolved).assertKeyType(KeetaNet.lib.Account.AccountKeyAlgorithm.TOKEN);\n\n\t\t\t\t\t\tfor (const to of toCodes) {\n\t\t\t\t\t\t\tconst toResolved = await to('string');\n\t\t\t\t\t\t\tif (!toResolved) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst toAccount = KeetaNet.lib.Account.fromPublicKeyString(toResolved).assertKeyType(KeetaNet.lib.Account.AccountKeyAlgorithm.TOKEN);\n\n\t\t\t\t\t\t\tif (fromAccount.comparePublicKey(toAccount)) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tpathNodesResult.push({\n\t\t\t\t\t\t\t\ttype: 'fx',\n\t\t\t\t\t\t\t\tproviderID: providerID,\n\t\t\t\t\t\t\t\tfrom: { asset: fromAccount, location: networkLocation, rail: 'KEETA_SEND' },\n\t\t\t\t\t\t\t\tto: { asset: toAccount, location: networkLocation, rail: 'KEETA_SEND' }\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn(pathNodesResult);\n\t\t\t\t}));\n\n\t\t\t\treturn(pathNodes.flat());\n\t\t\t} catch (error) {\n\t\t\t\tthis.logger?.warn('AnchorGraph::computeFXNodes', `Failed to parse FX service metadata for provider ${providerID} -- ignoring:`, error);\n\t\t\t\treturn(null);\n\t\t\t}\n\t\t}));\n\n\t\treturn(providerLookupResult.flat().filter((node): node is GraphNodeLike => !!node));\n\t}\n\n\tasync #resolveAssetName(name: MovableAssetSearchCanonical): Promise<ISOCurrencyCode | TokenAddress | ExternalChainAsset> {\n\t\tif (KeetaNet.lib.Account.isInstance(name) && name.isToken()) {\n\t\t\treturn(name);\n\t\t}\n\n\t\tif (typeof name === 'string') {\n\t\t\ttry {\n\t\t\t\treturn(KeetaNet.lib.Account.fromPublicKeyString(name).assertKeyType(KeetaNet.lib.Account.AccountKeyAlgorithm.TOKEN));\n\t\t\t} catch {\n\t\t\t\t/* ignore error and continue with other resolution methods */\n\t\t\t}\n\t\t}\n\n\t\tlet found = this.#assetNameCache.get(name);\n\t\tif (found) {\n\t\t\treturn(found);\n\t\t}\n\n\t\tif (isExternalChainAsset(name)) {\n\t\t\tfound = name;\n\t\t} else if (Currency.isCurrencyCode(name)) {\n\t\t\tfound = name;\n\t\t} else if (Currency.isISOCurrencyNumber(name)) {\n\t\t\tfound = new Currency(name).code;\n\t\t} else {\n\t\t\tconst lookupRet = await this.resolver.lookupToken(name);\n\t\t\tif (lookupRet) {\n\t\t\t\tfound = KeetaNet.lib.Account.toAccount(lookupRet.token);\n\t\t\t}\n\t\t}\n\n\t\tif (!found) {\n\t\t\tthrow(new Error(`Unable to resolve asset name: ${name}`));\n\t\t}\n\n\t\tthis.#assetNameCache.set(name, found);\n\n\t\treturn(found);\n\t}\n\n\tasync #computeAssetRails(assetInput: ToValuizable<RailOrRailWithExtendedDetails>): Promise<RailWithSupportedOperations> {\n\t\ttry {\n\t\t\tconst railResolved = await assetInput('string');\n\n\t\t\tif (!isRail(railResolved)) {\n\t\t\t\tthrow(new Error(`Invalid rail format: ${railResolved}`));\n\t\t\t}\n\n\t\t\treturn({ rail: railResolved });\n\t\t} catch {\n\t\t\t/* ignore error */\n\t\t}\n\n\t\tconst extendedDetailsResolved = await assetInput('object');\n\n\t\tif (!extendedDetailsResolved || typeof extendedDetailsResolved !== 'object' || Array.isArray(extendedDetailsResolved)) {\n\t\t\tthrow(new Error(`Invalid asset format, expected string or object with extended details`));\n\t\t}\n\n\t\tif (!('rail' in extendedDetailsResolved)) {\n\t\t\tthrow(new Error(`Invalid asset format, missing 'rail' field in extended details`));\n\t\t}\n\n\t\tconst railResolved = await extendedDetailsResolved.rail?.('string');\n\n\t\tif (!isRail(railResolved)) {\n\t\t\tthrow(new Error(`Invalid rail format in extended details: ${railResolved}`));\n\t\t}\n\n\t\tlet supportedOperations: RailSupportedOperations | undefined;\n\t\tif ('supportedOperations' in extendedDetailsResolved && extendedDetailsResolved.supportedOperations) {\n\t\t\tconst opsResolved = await extendedDetailsResolved.supportedOperations('object');\n\t\t\tif (opsResolved && typeof opsResolved === 'object' && !Array.isArray(opsResolved)) {\n\t\t\t\tconst parsed: RailSupportedOperations = {};\n\t\t\t\tif ('createPersistentForwarding' in opsResolved && opsResolved.createPersistentForwarding) {\n\t\t\t\t\tconst val = await opsResolved.createPersistentForwarding('boolean');\n\t\t\t\t\tif (typeof val === 'boolean') {\n\t\t\t\t\t\tparsed.createPersistentForwarding = val;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ('initiateTransfer' in opsResolved && opsResolved.initiateTransfer) {\n\t\t\t\t\tconst val = await opsResolved.initiateTransfer('boolean');\n\t\t\t\t\tif (typeof val === 'boolean') {\n\t\t\t\t\t\tparsed.initiateTransfer = val;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (Object.keys(parsed).length > 0) {\n\t\t\t\t\tsupportedOperations = parsed;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst result: RailWithSupportedOperations = { rail: railResolved };\n\t\tif (supportedOperations) {\n\t\t\tresult.supportedOperations = supportedOperations;\n\t\t}\n\n\t\treturn(result);\n\t}\n\n\tasync #computeAssetMovementPairSide(pairSideInput: ToValuizable<AssetWithRails>): Promise<{ rails: AssetMovementResolvedRails; location: AssetLocationLike; id: AnchorChainingAsset; }> {\n\t\tconst pairSideResolved = await pairSideInput('object');\n\n\t\tlet location: AssetLocationLike;\n\t\tif (pairSideResolved.location) {\n\t\t\tconst locationRaw = await pairSideResolved.location('string');\n\t\t\tif (!isAssetLocationLike(locationRaw)) {\n\t\t\t\tthrow(new Error(`Invalid location format: ${locationRaw}`));\n\t\t\t}\n\n\t\t\tlocation = locationRaw;\n\t\t} else {\n\t\t\tlocation = `chain:keeta:${this.client.network}`;\n\t\t}\n\n\t\tconst railsResolved = await pairSideResolved.rails('object');\n\n\t\tconst rails: AssetMovementResolvedRails = {\n\t\t\tcommon: await Promise.all((await railsResolved.common?.('array'))?.map(async (commonInput) => {\n\t\t\t\treturn(await this.#computeAssetRails(commonInput));\n\t\t\t}) ?? []),\n\t\t\tinbound: await Promise.all((await railsResolved.inbound?.('array'))?.map(async (commonInput) => {\n\t\t\t\treturn(await this.#computeAssetRails(commonInput));\n\t\t\t}) ?? []),\n\t\t\toutbound: await Promise.all((await railsResolved.outbound?.('array'))?.map(async (commonInput) => {\n\t\t\t\treturn(await this.#computeAssetRails(commonInput));\n\t\t\t}) ?? [])\n\t\t};\n\n\t\tconst id = await pairSideResolved.id('string');\n\t\tif (!isMovableAssetSearchCanonical(id)) {\n\t\t\tthrow(new Error(`Invalid asset id format: ${id}`));\n\t\t}\n\n\t\treturn({\n\t\t\trails: rails,\n\t\t\tlocation: location,\n\t\t\tid: await this.#resolveAssetName(id)\n\t\t});\n\t}\n\n\tasync #computeAssetMovementNodes() {\n\t\tconst assetMovementServices = await this.resolver.lookup('assetMovement', {});\n\n\t\tif (!assetMovementServices) {\n\t\t\treturn([]);\n\t\t}\n\n\t\tconst providerResults = await Promise.all(Object.entries(assetMovementServices).map(async ([ providerID, service ]) => {\n\t\t\ttry {\n\t\t\t\tconst supportedOperationsMetadata = await service.operations('object');\n\n\t\t\t\tconst supportedAssetsEntries = await service.supportedAssets('array');\n\n\t\t\t\tif (!supportedAssetsEntries) {\n\t\t\t\t\tthis.logger?.debug('AnchorGraph::computeAssetMovementNodes', `No supported assets found for provider ${providerID}`);\n\t\t\t\t\treturn(null);\n\t\t\t\t}\n\n\t\t\t\tconst pathNodesResult = await Promise.all(supportedAssetsEntries.map(async (assetEntry): Promise<GraphNodeLike[]> => {\n\t\t\t\t\tconst parsedEntry = await assetEntry('object');\n\n\t\t\t\t\tconst pathsResolved = await parsedEntry.paths('array');\n\t\t\t\t\tconst pathPromises = await Promise.allSettled(pathsResolved.map(async (pathResolvedInput): Promise<GraphNodeLike[]> => {\n\t\t\t\t\t\tconst pathResolved = await pathResolvedInput('object');\n\n\t\t\t\t\t\tconst pairResolved = await pathResolved.pair('array');\n\n\t\t\t\t\t\tconst [ fromResolved, toResolved ] = await Promise.all([\n\t\t\t\t\t\t\tthis.#computeAssetMovementPairSide(pairResolved[0]),\n\t\t\t\t\t\t\tthis.#computeAssetMovementPairSide(pairResolved[1])\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * What the provider publishes for itself. An operation the\n\t\t\t\t\t\t * service does not expose cannot be called on any of its rails,\n\t\t\t\t\t\t * which is the same thing `isOperationSupported` reports when a\n\t\t\t\t\t\t * plan is computed.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tconst providerOperations: RailSupportedOperations = {\n\t\t\t\t\t\t\tcreatePersistentForwarding: supportedOperationsMetadata.createPersistentForwarding !== undefined,\n\t\t\t\t\t\t\tinitiateTransfer: supportedOperationsMetadata.initiateTransfer !== undefined,\n\t\t\t\t\t\t\tsimulateTransfer: supportedOperationsMetadata.simulateTransfer !== undefined\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tfunction getProviderSupportedOperationsForRail(railSpecific?: RailSupportedOperations): RailSupportedOperations {\n\t\t\t\t\t\t\tconst retval: RailSupportedOperations = { ...providerOperations };\n\n\t\t\t\t\t\t\tif (railSpecific) {\n\t\t\t\t\t\t\t\tretval.createPersistentForwarding = railSpecific.createPersistentForwarding ?? false;\n\t\t\t\t\t\t\t\tretval.initiateTransfer = railSpecific.initiateTransfer ?? false;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn(retval);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst makeFromTo = (input: {\n\t\t\t\t\t\t\tasset: { id: AnchorChainingAsset; location: AssetLocationLike; };\n\t\t\t\t\t\t\trail: { rail: Rail; supportedOperations?: RailSupportedOperations | undefined; }\n\t\t\t\t\t\t}) => {\n\t\t\t\t\t\t\tconst retval: Extract<GraphNodeLike, { type: 'assetMovement' }>['from' | 'to'] = {\n\t\t\t\t\t\t\t\tasset: input.asset.id,\n\t\t\t\t\t\t\t\tlocation: input.asset.location,\n\t\t\t\t\t\t\t\trail: input.rail.rail\n\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\tif (input.rail.supportedOperations !== undefined) {\n\t\t\t\t\t\t\t\tretval.supportedOperations = getProviderSupportedOperationsForRail(input.rail.supportedOperations);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn(retval);\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tconst pathNodes: GraphNodeLike[] = [];\n\t\t\t\t\t\tfor (const [ src, dest ] of [\n\t\t\t\t\t\t\t[ fromResolved, toResolved ],\n\t\t\t\t\t\t\t[ toResolved, fromResolved ]\n\t\t\t\t\t\t] as const) {\n\t\t\t\t\t\t\tfor (const inboundRail of [ ...(src.rails.common ?? []), ...(src.rails.inbound ?? []) ]) {\n\t\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\t * Drop edges whose source rail explicitly cannot\n\t\t\t\t\t\t\t\t * initiate a transfer and also cannot create a\n\t\t\t\t\t\t\t\t * persistent forwarding address.\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\tconst inboundSupportedOperations = getProviderSupportedOperationsForRail(inboundRail.supportedOperations);\n\t\t\t\t\t\t\t\tif (inboundSupportedOperations.initiateTransfer === false && inboundSupportedOperations.createPersistentForwarding === false) {\n\t\t\t\t\t\t\t\t\tthis.logger?.debug('AnchorGraph::computeAssetMovementNodes', `Skipping ${providerID} edge from ${convertAssetLocationToString(src.location)} via rail ${inboundRail.rail}: neither initiateTransfer nor createPersistentForwarding supported`);\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tfor (const outboundRail of [ ...(dest.rails.common ?? []), ...(dest.rails.outbound ?? []) ]) {\n\t\t\t\t\t\t\t\t\tpathNodes.push({\n\t\t\t\t\t\t\t\t\t\ttype: 'assetMovement',\n\t\t\t\t\t\t\t\t\t\tproviderID: providerID,\n\t\t\t\t\t\t\t\t\t\tproviderOperations: providerOperations,\n\t\t\t\t\t\t\t\t\t\tfrom: makeFromTo({ asset: src, rail: inboundRail }),\n\t\t\t\t\t\t\t\t\t\tto: makeFromTo({ asset: dest, rail: outboundRail })\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn(pathNodes);\n\t\t\t\t\t}));\n\n\t\t\t\t\tconst allPaths = [];\n\n\t\t\t\t\tfor (const resolved of pathPromises) {\n\t\t\t\t\t\tif (resolved.status === 'rejected') {\n\t\t\t\t\t\t\tthis.logger?.debug('AnchorGraph::computeAssetMovementNodes', `error fetching nodes for provider ${providerID}:`, resolved.reason);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tallPaths.push(...resolved.value);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn(allPaths);\n\t\t\t\t}));\n\n\t\t\t\treturn(pathNodesResult.flat());\n\t\t\t} catch (error) {\n\t\t\t\tthis.logger?.warn('AnchorGraph::computeAssetMovementNodes', `Failed to parse asset movement service metadata for provider ${providerID} -- ignoring:`, error);\n\t\t\t\treturn(null);\n\t\t\t}\n\t\t}));\n\n\t\treturn(providerResults.flat().filter((node): node is GraphNodeLike => !!node));\n\t}\n\n\tasync computeGraphNodes(): Promise<GraphNodeLike[]> {\n\t\tif (this.#graphNodePromise === null) {\n\t\t\tthis.#graphNodePromise = (async () => {\n\t\t\t\tconst receivedNodes = await Promise.all([\n\t\t\t\t\tthis.#computeFXNodes(),\n\t\t\t\t\tthis.#computeAssetMovementNodes()\n\t\t\t\t]);\n\n\t\t\t\treturn(receivedNodes.flat());\n\t\t\t})();\n\t\t}\n\n\t\treturn(await this.#graphNodePromise);\n\t}\n\n\tasync findPaths(input: AnchorChainingPathInput, options?: AnchorChainingFindPathsOptions): Promise<GraphNodeLike[][]> {\n\t\tconst forwardingOpts = normalizeForwardingOnlyOptions(options?.forwardingOnly);\n\t\tconst maxPathLength = forwardingOpts\n\t\t\t? Math.min(\n\t\t\t\toptions?.maxPathLength ?? Infinity,\n\t\t\t\tforwardingOpts.maxLegs ?? DEFAULT_FORWARDING_MAX_LEGS\n\t\t\t)\n\t\t\t: (options?.maxPathLength ?? DEFAULT_MAX_PATH_LENGTH);\n\t\tif (maxPathLength < 1) {\n\t\t\tthrow(new Error(`maxPathLength must be at least 1, got ${maxPathLength}`));\n\t\t}\n\t\tconst maxPaths = options?.maxPaths ?? DEFAULT_MAX_PATHS;\n\t\tif (maxPaths < 1) {\n\t\t\tthrow(new Error(`maxPaths must be at least 1, got ${maxPaths}`));\n\t\t}\n\n\t\tconst allNodes = await this.computeGraphNodes();\n\t\tconst graph = forwardingOpts\n\t\t\t? allNodes.filter((node) => isForwardingEligibleNode(node, forwardingOpts.method))\n\t\t\t: allNodes;\n\n\t\tconst nodesWithNext: { node: GraphNodeLike, next: number[] }[] = graph.map(function(node) {\n\t\t\treturn({ node, next: [] });\n\t\t});\n\n\t\tconst sideKey = (side: GraphNodeLike['from' | 'to']): string =>\n\t\t\t`${side.rail}:${this.#assetLocationKey(side)}`;\n\n\t\tconst fromKeys = graph.map(node => sideKey(node.from));\n\t\tconst toKeys = graph.map(node => sideKey(node.to));\n\n\t\tconst nodesByFromKey = new Map<string, number[]>();\n\t\tfor (let j = 0; j < fromKeys.length; j++) {\n\t\t\tconst key = fromKeys[j];\n\t\t\tif (key === undefined) {\n\t\t\t\tthrow(new Error(`Invalid node index during adjacency construction: ${j}`));\n\t\t\t}\n\t\t\tlet bucket = nodesByFromKey.get(key);\n\t\t\tif (!bucket) {\n\t\t\t\tbucket = [];\n\t\t\t\tnodesByFromKey.set(key, bucket);\n\t\t\t}\n\t\t\tbucket.push(j);\n\t\t}\n\n\t\tfor (let i = 0; i < nodesWithNext.length; i++) {\n\t\t\tconst ni = nodesWithNext[i];\n\t\t\tconst toKey = toKeys[i];\n\t\t\tif (!ni || toKey === undefined) {\n\t\t\t\tthrow(new Error(`Invalid node index during adjacency construction: ${i}`));\n\t\t\t}\n\t\t\tconst successors = nodesByFromKey.get(toKey);\n\t\t\tif (!successors) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor (const j of successors) {\n\t\t\t\tconst nj = nodesWithNext[j];\n\t\t\t\tif (!nj) {\n\t\t\t\t\tthrow(new Error(`Invalid node index during adjacency construction: ${j}`));\n\t\t\t\t}\n\t\t\t\t// We can ignore chaining one fx anchor to itself\n\t\t\t\tif (ni.node.type === 'fx' && nj.node.type === 'fx' && ni.node.providerID === nj.node.providerID) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tni.next.push(j);\n\t\t\t}\n\t\t}\n\n\t\tconst paths: GraphNodeLike[][] = [];\n\n\t\tconst sourceKey = `${input.source.rail}:${this.#assetLocationKey(input.source)}`;\n\t\tconst destinationKey = `${input.destination.rail}:${this.#assetLocationKey(input.destination)}`;\n\n\t\t// Node indices whose `from` side matches the requested source -- the\n\t\t// possible starting legs.\n\t\tconst sourceIndices: number[] = [];\n\t\tfor (let index = 0; index < fromKeys.length; index++) {\n\t\t\tif (fromKeys[index] === sourceKey) {\n\t\t\t\tsourceIndices.push(index);\n\t\t\t}\n\t\t}\n\n\t\tlet truncated = false;\n\n\t\t// Depth-limited DFS that records a path only when its length equals the\n\t\t// current depthLimit, so each distinct path is collected exactly once as\n\t\t// we deepen.\n\t\tconst dfs = (\n\t\t\tcurrentIndex: number,\n\t\t\tdepthLimit: number,\n\t\t\tvisitedAssets: Set<string>,\n\t\t\tpath: GraphNodeLike[]\n\t\t): void => {\n\t\t\tif (paths.length >= maxPaths) {\n\t\t\t\ttruncated = true;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst cur = nodesWithNext[currentIndex];\n\t\t\tconst assetLocationStr = fromKeys[currentIndex];\n\n\t\t\tif (!cur || assetLocationStr === undefined) {\n\t\t\t\tthrow(new Error(`Invalid node index: ${currentIndex}`));\n\t\t\t}\n\n\t\t\tif (visitedAssets.has(assetLocationStr)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvisitedAssets.add(assetLocationStr);\n\n\t\t\tconst newPath = [ ...path, cur.node ];\n\n\t\t\tif (newPath.length === depthLimit && toKeys[currentIndex] === destinationKey) {\n\t\t\t\tpaths.push(newPath);\n\t\t\t}\n\n\t\t\tif (newPath.length < depthLimit) {\n\t\t\t\tfor (const nextIndex of cur.next) {\n\t\t\t\t\tdfs(nextIndex, depthLimit, visitedAssets, newPath);\n\t\t\t\t\tif (paths.length >= maxPaths) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvisitedAssets.delete(assetLocationStr);\n\t\t};\n\n\t\tfor (let depthLimit = 1; depthLimit <= maxPathLength && paths.length < maxPaths; depthLimit++) {\n\t\t\tfor (const index of sourceIndices) {\n\t\t\t\tdfs(index, depthLimit, new Set<string>(), []);\n\t\t\t\tif (paths.length >= maxPaths) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (truncated) {\n\t\t\tthis.logger?.debug('AnchorGraph::findPaths', `Path search hit the maxPaths cap of ${maxPaths}; returning the ${maxPaths} shortest paths (up to maxPathLength ${maxPathLength}).`);\n\t\t}\n\n\t\treturn(paths);\n\t}\n\n\tasync #getResolveIndex(): Promise<ResolveIndex> {\n\t\tif (this.#resolveIndexPromise === null) {\n\t\t\tthis.#resolveIndexPromise = (async () => {\n\t\t\t\tconst nodes = await this.computeGraphNodes();\n\n\t\t\t\tconst fromAssetKeys = nodes.map(node => this.#assetLocationKey(node.from));\n\t\t\t\tconst toAssetKeys = nodes.map(node => this.#assetLocationKey(node.to));\n\t\t\t\tconst fromKeys = nodes.map((node, i) => `${node.from.rail}:${fromAssetKeys[i]}`);\n\t\t\t\tconst toKeys = nodes.map((node, i) => `${node.to.rail}:${toAssetKeys[i]}`);\n\n\t\t\t\tconst nodesByFromKey = new Map<string, number[]>();\n\t\t\t\tconst nodesByToKey = new Map<string, number[]>();\n\t\t\t\tconst nodesByFromAssetKey = new Map<string, number[]>();\n\t\t\t\tconst nodesByToAssetKey = new Map<string, number[]>();\n\t\t\t\tconst railInfo: ResolveIndex['railInfo'] = new Map();\n\n\t\t\t\tconst addToBucket = (map: Map<string, number[]>, key: string | undefined, index: number) => {\n\t\t\t\t\tif (key === undefined) {\n\t\t\t\t\t\tthrow(new Error(`Invalid node index during resolve-index construction: ${index}`));\n\t\t\t\t\t}\n\t\t\t\t\tlet bucket = map.get(key);\n\t\t\t\t\tif (!bucket) {\n\t\t\t\t\t\tbucket = [];\n\t\t\t\t\t\tmap.set(key, bucket);\n\t\t\t\t\t}\n\t\t\t\t\tbucket.push(index);\n\t\t\t\t};\n\n\t\t\t\tconst addRail = (assetKey: string | undefined, side: GraphNodeLike['from' | 'to'], railSide: 'inbound' | 'outbound', index: number) => {\n\t\t\t\t\tif (assetKey === undefined) {\n\t\t\t\t\t\tthrow(new Error(`Invalid node index during resolve-index construction: ${index}`));\n\t\t\t\t\t}\n\t\t\t\t\tlet info = railInfo.get(assetKey);\n\t\t\t\t\tif (!info) {\n\t\t\t\t\t\tinfo = { asset: side.asset, location: side.location, inbound: new Set(), outbound: new Set() };\n\t\t\t\t\t\trailInfo.set(assetKey, info);\n\t\t\t\t\t}\n\t\t\t\t\tinfo[railSide].add(side.rail);\n\t\t\t\t};\n\n\t\t\t\tfor (let i = 0; i < nodes.length; i++) {\n\t\t\t\t\tconst node = nodes[i];\n\t\t\t\t\tif (!node) {\n\t\t\t\t\t\tthrow(new Error(`Invalid node index during resolve-index construction: ${i}`));\n\t\t\t\t\t}\n\t\t\t\t\taddToBucket(nodesByFromKey, fromKeys[i], i);\n\t\t\t\t\taddToBucket(nodesByToKey, toKeys[i], i);\n\t\t\t\t\taddToBucket(nodesByFromAssetKey, fromAssetKeys[i], i);\n\t\t\t\t\taddToBucket(nodesByToAssetKey, toAssetKeys[i], i);\n\t\t\t\t\t// Match buildResultMap's node/side ordering (to side before from\n\t\t\t\t\t// side) so the representative asset/location for a key is stable.\n\t\t\t\t\taddRail(toAssetKeys[i], node.to, 'inbound', i);\n\t\t\t\t\taddRail(fromAssetKeys[i], node.from, 'outbound', i);\n\t\t\t\t}\n\n\t\t\t\treturn({ nodes, fromAssetKeys, toAssetKeys, fromKeys, toKeys, nodesByFromKey, nodesByToKey, nodesByFromAssetKey, nodesByToAssetKey, railInfo });\n\t\t\t})();\n\t\t}\n\n\t\treturn(await this.#resolveIndexPromise);\n\t}\n\n\tasync resolveAssets(filter: AnchorChainingResolveAssetsFilter = {}): Promise<AnchorChainingResolveAssetsResult> {\n\t\tconst { from: fromFilterInput, to: toFilterInput, maxStepCount, onlyAllowFXLike } = filter;\n\t\tconst forwardingOpts = normalizeForwardingOnlyOptions(filter.forwardingOnly);\n\t\tconst forwardingMethod = forwardingOpts?.method;\n\t\tconst traversalStepLimit = forwardingOpts\n\t\t\t? (maxStepCount ?? forwardingOpts.maxLegs ?? DEFAULT_FORWARDING_MAX_LEGS)\n\t\t\t: maxStepCount;\n\n\t\tconst keetaNetworkLocation = `chain:keeta:${this.client.network}` satisfies AssetLocationLike;\n\n\t\t// When onlyAllowFXLike, default omitted locations to the Keeta network location\n\t\tconst fromFilter = (onlyAllowFXLike && fromFilterInput !== undefined && fromFilterInput.location === undefined)\n\t\t\t? { ...fromFilterInput, location: keetaNetworkLocation }\n\t\t\t: fromFilterInput;\n\t\tconst toFilter = (onlyAllowFXLike && toFilterInput !== undefined && toFilterInput.location === undefined)\n\t\t\t? { ...toFilterInput, location: keetaNetworkLocation }\n\t\t\t: toFilterInput;\n\n\t\t// Graph-invariant structures (keys, adjacency buckets, per-asset rail\n\t\t// aggregation) are built once and reused across every call, so a fan-out\n\t\t// of many filtered resolveAssets/listAssets calls doesn't rebuild them n\n\t\t// times.\n\t\tconst { nodes, fromAssetKeys, toAssetKeys, fromKeys, toKeys, nodesByFromKey, nodesByToKey, nodesByFromAssetKey, nodesByToAssetKey, railInfo } = await this.#getResolveIndex();\n\n\t\tconst nodeAllowed = (node: GraphNodeLike): boolean => {\n\t\t\tif (onlyAllowFXLike && !isFXLikeNode(node)) {\n\t\t\t\treturn(false);\n\t\t\t}\n\t\t\tif (forwardingMethod !== undefined && !isForwardingEligibleNode(node, forwardingMethod)) {\n\t\t\t\treturn(false);\n\t\t\t}\n\t\t\treturn(true);\n\t\t};\n\n\t\tconst sideMatchesFilter = (\n\t\t\tside: GraphNodeLike['from' | 'to'],\n\t\t\tf: AnchorChainingListAssetsSideFilter\n\t\t): boolean => {\n\t\t\tif (f.location !== undefined && convertAssetLocationToString(side.location) !== convertAssetLocationToString(f.location)) {\n\t\t\t\treturn(false);\n\t\t\t}\n\t\t\tif (f.asset !== undefined && !isAnchorChainingAssetEqual(side.asset, f.asset)) {\n\t\t\t\treturn(false);\n\t\t\t}\n\t\t\tif (f.rail !== undefined && side.rail !== f.rail) {\n\t\t\t\treturn(false);\n\t\t\t}\n\t\t\treturn(true);\n\t\t};\n\n\t\t// The start nodes for a traversal are those whose relevant side matches the\n\t\t// filter. When the filter pins both asset and location (the common case) we\n\t\t// look them up by key in O(matches); otherwise we fall back to scanning all\n\t\t// nodes. The key path avoids running isAnchorChainingAssetEqual -- and thus\n\t\t// keccak -- per node, which on a large graph dominates fan-out patterns.\n\t\tconst assetBucketsForSide = { from: nodesByFromAssetKey, to: nodesByToAssetKey } as const;\n\t\tconst computeStartIndices = (f: AnchorChainingListAssetsSideFilter, side: 'from' | 'to'): number[] => {\n\t\t\tif (f.asset !== undefined && f.location !== undefined) {\n\t\t\t\tconst key = this.#assetLocationKey({ asset: f.asset, location: f.location });\n\t\t\t\tconst candidates = assetBucketsForSide[side].get(key) ?? [];\n\t\t\t\tif (f.rail === undefined) {\n\t\t\t\t\treturn(candidates);\n\t\t\t\t}\n\t\t\t\treturn(candidates.filter(i => nodes[i]?.[side].rail === f.rail));\n\t\t\t}\n\n\t\t\tconst out: number[] = [];\n\t\t\tfor (let i = 0; i < nodes.length; i++) {\n\t\t\t\tconst node = nodes[i];\n\t\t\t\tif (node && sideMatchesFilter(node[side], f)) {\n\t\t\t\t\tout.push(i);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn(out);\n\t\t};\n\n\t\t// Separate reachable sets and distance maps for backward (from) and forward (to) traversals.\n\t\tconst fromReachable = new Set<string>();\n\t\tconst fromDistances = new Map<string, number>();\n\t\tconst toReachable = new Set<string>();\n\t\tconst toDistances = new Map<string, number>();\n\n\t\tconst makeMarkFn = (reachable: Set<string>, distances: Map<string, number>) =>\n\t\t\t(key: string, depth?: number) => {\n\t\t\t\treachable.add(key);\n\t\t\t\tif (depth !== undefined) {\n\t\t\t\t\tconst existing = distances.get(key);\n\t\t\t\t\tif (existing === undefined || depth < existing) {\n\t\t\t\t\t\tdistances.set(key, depth);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\tconst markFromReachable = makeMarkFn(fromReachable, fromDistances);\n\t\tconst markToReachable = makeMarkFn(toReachable, toDistances);\n\n\t\tconst bfs = (\n\t\t\tstartIndices: number[],\n\t\t\tdirection: 'forward' | 'backward',\n\t\t\tmarkFn: (key: string, depth: number) => void\n\t\t) => {\n\t\t\tconst markKeys = direction === 'forward' ? toAssetKeys : fromAssetKeys;\n\t\t\tconst stepKeys = direction === 'forward' ? toKeys : fromKeys;\n\t\t\tconst neighborBuckets = direction === 'forward' ? nodesByFromKey : nodesByToKey;\n\n\t\t\tconst nodeVisited = new Set<number>();\n\t\t\tconst queue: { nodeIdx: number; depth: number }[] = [];\n\t\t\tfor (const i of startIndices) {\n\t\t\t\tif (!nodeVisited.has(i)) {\n\t\t\t\t\tnodeVisited.add(i);\n\t\t\t\t\tqueue.push({ nodeIdx: i, depth: 1 });\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet head = 0;\n\t\t\twhile (head < queue.length) {\n\t\t\t\tconst queueItem = queue[head];\n\t\t\t\thead++;\n\t\t\t\tif (!queueItem) {\n\t\t\t\t\tthrow(new Error(`Unexpected empty queue during BFS processing`));\n\t\t\t\t}\n\t\t\t\tconst { nodeIdx, depth } = queueItem;\n\t\t\t\tconst node = nodes[nodeIdx];\n\t\t\t\tconst markKey = markKeys[nodeIdx];\n\t\t\t\tconst stepKey = stepKeys[nodeIdx];\n\t\t\t\tif (!node || markKey === undefined || stepKey === undefined) {\n\t\t\t\t\tthrow(new Error(`Invalid node index during BFS processing: ${nodeIdx}`));\n\t\t\t\t}\n\t\t\t\tif (!nodeAllowed(node)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tmarkFn(markKey, depth);\n\t\t\t\tif (traversalStepLimit !== undefined && depth >= traversalStepLimit) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst neighbors = neighborBuckets.get(stepKey);\n\t\t\t\tif (!neighbors) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tfor (const neighborIdx of neighbors) {\n\t\t\t\t\tif (nodeVisited.has(neighborIdx)) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst neighbor = nodes[neighborIdx];\n\t\t\t\t\tif (!neighbor) {\n\t\t\t\t\t\tthrow(new Error(`Invalid node index during BFS processing: ${neighborIdx}`));\n\t\t\t\t\t}\n\t\t\t\t\tif (node.type === 'fx' && neighbor.type === 'fx' && node.providerID === neighbor.providerID) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tnodeVisited.add(neighborIdx);\n\t\t\t\t\tqueue.push({ nodeIdx: neighborIdx, depth: depth + 1 });\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tif (fromFilter) {\n\t\t\tbfs(computeStartIndices(fromFilter, 'from'), 'forward', markToReachable);\n\t\t}\n\t\tif (toFilter) {\n\t\t\tbfs(computeStartIndices(toFilter, 'to'), 'backward', markFromReachable);\n\t\t}\n\t\tif (!fromFilter && !toFilter) {\n\t\t\tfor (let i = 0; i < nodes.length; i++) {\n\t\t\t\tconst node = nodes[i];\n\t\t\t\tconst fromKey = fromAssetKeys[i];\n\t\t\t\tconst toKey = toAssetKeys[i];\n\t\t\t\tif (!node || fromKey === undefined || toKey === undefined) {\n\t\t\t\t\tthrow(new Error(`Invalid node index during reachability marking: ${i}`));\n\t\t\t\t}\n\t\t\t\tif (nodeAllowed(node)) {\n\t\t\t\t\tmarkFromReachable(fromKey);\n\t\t\t\t\tmarkFromReachable(toKey);\n\t\t\t\t\tmarkToReachable(fromKey);\n\t\t\t\t\tmarkToReachable(toKey);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Build result maps by collecting inbound/outbound rails for every reachable\n\t\t// (asset, location) pair. The common path reads the precomputed per-asset\n\t\t// rail aggregation (railInfo) and so is O(reachable). onlyAllowFXLike and\n\t\t// forwardingOnly need to exclude disallowed nodes' rails -- which railInfo\n\t\t// doesn't distinguish -- so they fall back to the O(nodes) scan.\n\t\tconst buildResultMapFast = (\n\t\t\treachable: Set<string>,\n\t\t\tdistances: Map<string, number>\n\t\t): Map<string, AnchorChainingAssetInfo> => {\n\t\t\tconst resultMap = new Map<string, AnchorChainingAssetInfo>();\n\t\t\tfor (const key of reachable) {\n\t\t\t\tconst info = railInfo.get(key);\n\t\t\t\tif (!info) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst distanceValue = distances.get(key);\n\t\t\t\tresultMap.set(key, {\n\t\t\t\t\tasset: info.asset,\n\t\t\t\t\tlocation: info.location,\n\t\t\t\t\trails: { inbound: [ ...info.inbound ], outbound: [ ...info.outbound ] },\n\t\t\t\t\tdistance: distanceValue !== undefined ? { pathLength: distanceValue } : null\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn(resultMap);\n\t\t};\n\n\t\tconst buildResultMapFiltered = (\n\t\t\treachable: Set<string>,\n\t\t\tdistances: Map<string, number>\n\t\t): Map<string, AnchorChainingAssetInfo> => {\n\t\t\tconst resultMap = new Map<string, AnchorChainingAssetInfo>();\n\t\t\tconst getOrCreate = (key: string, side: { asset: AnchorChainingAsset; location: AssetLocationLike }): AnchorChainingAssetInfo => {\n\t\t\t\tlet resultObj = resultMap.get(key);\n\t\t\t\tif (!resultObj) {\n\t\t\t\t\tconst distanceValue = distances.get(key);\n\n\t\t\t\t\tresultObj = {\n\t\t\t\t\t\tasset: side.asset,\n\t\t\t\t\t\tlocation: side.location,\n\t\t\t\t\t\trails: { inbound: [], outbound: [] },\n\t\t\t\t\t\tdistance: distanceValue !== undefined ? { pathLength: distanceValue } : null\n\t\t\t\t\t};\n\n\t\t\t\t\tresultMap.set(key, resultObj);\n\t\t\t\t}\n\t\t\t\treturn(resultObj);\n\t\t\t};\n\t\t\tfor (let i = 0; i < nodes.length; i++) {\n\t\t\t\tconst node = nodes[i];\n\t\t\t\tconst toKey = toAssetKeys[i];\n\t\t\t\tconst fromKey = fromAssetKeys[i];\n\t\t\t\tif (!node || toKey === undefined || fromKey === undefined) {\n\t\t\t\t\tthrow(new Error(`Invalid node index during result-map construction: ${i}`));\n\t\t\t\t}\n\t\t\t\tif (!nodeAllowed(node)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (reachable.has(toKey)) {\n\t\t\t\t\tconst entry = getOrCreate(toKey, node.to);\n\t\t\t\t\tif (!entry.rails.inbound.includes(node.to.rail)) {\n\t\t\t\t\t\tentry.rails.inbound.push(node.to.rail);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (reachable.has(fromKey)) {\n\t\t\t\t\tconst entry = getOrCreate(fromKey, node.from);\n\t\t\t\t\tif (!entry.rails.outbound.includes(node.from.rail)) {\n\t\t\t\t\t\tentry.rails.outbound.push(node.from.rail);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn(resultMap);\n\t\t};\n\n\t\tconst buildResultMap = (onlyAllowFXLike || forwardingMethod !== undefined) ? buildResultMapFiltered : buildResultMapFast;\n\n\t\tconst fromResultMap = buildResultMap(fromReachable, fromDistances);\n\t\tconst toResultMap = buildResultMap(toReachable, toDistances);\n\n\t\t// When onlyAllowFXLike, exclude the filter asset from the result set so that\n\t\t// \"what can USDC be swapped to?\" doesn't include USDC itself via a round-trip.\n\t\tif (onlyAllowFXLike) {\n\t\t\tif (fromFilter?.asset !== undefined) {\n\t\t\t\ttoResultMap.delete(this.#assetLocationKey({ asset: fromFilter.asset, location: fromFilter.location ?? keetaNetworkLocation }));\n\t\t\t}\n\t\t\tif (toFilter?.asset !== undefined) {\n\t\t\t\tfromResultMap.delete(this.#assetLocationKey({ asset: toFilter.asset, location: toFilter.location ?? keetaNetworkLocation }));\n\t\t\t}\n\t\t}\n\n\t\tconst filterMap = (\n\t\t\tmap: Map<string, AnchorChainingAssetInfo>,\n\t\t\tf: AnchorChainingListAssetsSideFilter,\n\t\t\trailSide: 'inbound' | 'outbound'\n\t\t): AnchorChainingAssetInfo[] =>\n\t\t\tArray.from(map.values()).filter(info => {\n\t\t\t\tif (f.location !== undefined && convertAssetLocationToString(info.location) !== convertAssetLocationToString(f.location)) {\n\t\t\t\t\treturn(false);\n\t\t\t\t}\n\t\t\t\tif (f.asset !== undefined && !isAnchorChainingAssetEqual(info.asset, f.asset)) {\n\t\t\t\t\treturn(false);\n\t\t\t\t}\n\t\t\t\tif (f.rail !== undefined && !info.rails[railSide].includes(f.rail)) {\n\t\t\t\t\treturn(false);\n\t\t\t\t}\n\t\t\t\treturn(true);\n\t\t\t});\n\n\t\tconst fromAssets = (fromFilter !== undefined && toFilter !== undefined)\n\t\t\t? filterMap(fromResultMap, fromFilter, 'outbound')\n\t\t\t: Array.from(fromResultMap.values());\n\t\tconst toAssets = (fromFilter !== undefined && toFilter !== undefined)\n\t\t\t? filterMap(toResultMap, toFilter, 'inbound')\n\t\t\t: Array.from(toResultMap.values());\n\n\t\treturn({ from: fromAssets, to: toAssets });\n\t}\n\n\tasync listAssets(filter: AnchorChainingListAssetsFilter = {}): Promise<AnchorChainingAssetInfo[]> {\n\t\tconst result = await this.resolveAssets(filter);\n\n\t\tif (filter.from) {\n\t\t\treturn(result.to);\n\t\t} else if (filter.to) {\n\t\t\treturn(result.from);\n\t\t} else {\n\t\t\treturn(result.to);\n\t\t}\n\t}\n\n\tasync getExternalAssetMetadata(\n\t\tasset: AnchorChainingAssetInfo['asset'],\n\t\tlocation: AnchorChainingAssetInfo['location'],\n\t\tproviderID?: string\n\t): Promise<AnchorTokenLocationMetadata | undefined> {\n\t\tif (!isExternalChainAsset(asset)) {\n\t\t\treturn(undefined);\n\t\t}\n\n\t\tconst providers = await this.getAssetMovementProvidersForAsset(asset, location);\n\t\tif (!providers) {\n\t\t\treturn(undefined);\n\t\t}\n\n\t\tif (providerID) {\n\t\t\tconst found = providers[providerID];\n\t\t\tif (!found) {\n\t\t\t\treturn(undefined);\n\t\t\t}\n\t\t\treturn(found.provider.getAssetMetadataForLocation(location, asset) ?? undefined);\n\t\t}\n\n\t\tfor (const { provider } of Object.values(providers)) {\n\t\t\tconst metadata = provider.getAssetMetadataForLocation(location, asset);\n\t\t\tif (metadata) {\n\t\t\t\treturn(metadata);\n\t\t\t}\n\t\t}\n\n\t\treturn(undefined);\n\t}\n\n\tasync #attachMetadata(\n\t\tassetInfo: AnchorChainingAssetInfo,\n\t\toptions?: AnchorChainingWithMetadataOptions\n\t): Promise<AnchorChainingAssetInfoWithMetadata> {\n\t\tconst metadata = await this.getExternalAssetMetadata(assetInfo.asset, assetInfo.location, options?.providerID);\n\t\tif (!metadata) {\n\t\t\treturn(assetInfo);\n\t\t}\n\t\treturn({ ...assetInfo, metadata });\n\t}\n\n\tasync resolveAssetsWithMetadata(\n\t\tfilter: AnchorChainingResolveAssetsFilter = {},\n\t\toptions?: AnchorChainingWithMetadataOptions\n\t): Promise<AnchorChainingResolveAssetsWithMetadataResult> {\n\t\tconst result = await this.resolveAssets(filter);\n\n\t\tconst [from, to] = await Promise.all([\n\t\t\tPromise.all(result.from.map((info) => this.#attachMetadata(info, options))),\n\t\t\tPromise.all(result.to.map((info) => this.#attachMetadata(info, options)))\n\t\t]);\n\n\t\treturn({ from, to });\n\t}\n\n\tasync listAssetsWithMetadata(\n\t\tfilter: AnchorChainingListAssetsFilter = {},\n\t\toptions?: AnchorChainingWithMetadataOptions\n\t): Promise<AnchorChainingAssetInfoWithMetadata[]> {\n\t\tconst result = await this.resolveAssetsWithMetadata(filter, options);\n\n\t\tif (filter.from) {\n\t\t\treturn(result.to);\n\t\t} else if (filter.to) {\n\t\t\treturn(result.from);\n\t\t} else {\n\t\t\treturn(result.to);\n\t\t}\n\t}\n\n\tasync buildForwardingAdjacency(): Promise<Map<string, ForwardingAssetRef[]>> {\n\t\treturn(buildForwardingAdjacency(await this.computeGraphNodes()));\n\t}\n}\n\nexport interface ComputePlanOptions {\n\toverrides?: AnchorChainingAccountOverrides;\n\t/**\n\t * Limit the number of plans to calculate, defaults to 3\n\t */\n\tlimit?: number;\n\t/**\n\t * When true, plan computation uses persistent forwarding for the final leg\n\t * instead of initiateTransfer, even when the source rail supports both.\n\t */\n\tforwardingOnly?: boolean;\n}\n\nexport interface GetPlansOptions extends Omit<ComputePlanOptions, 'forwardingOnly'> {\n\tincludeAllOutput?: boolean;\n\tforwardingOnly?: boolean | ForwardingOnlyOptions;\n\tmaxPathLength?: number;\n}\n\nfunction toComputePlanOptions(options?: GetPlansOptions, forwardingOpts?: ForwardingOnlyOptions): ComputePlanOptions | undefined {\n\tconst overrides = options?.overrides;\n\tconst forwardingOnly = forwardingOpts !== undefined;\n\n\tif (overrides === undefined && !forwardingOnly) {\n\t\treturn(undefined);\n\t}\n\n\treturn({\n\t\t...(overrides !== undefined ? { overrides } : {}),\n\t\t...(forwardingOnly ? { forwardingOnly: true } : {})\n\t});\n}\n\n/**\n * Whether a discovered path is eligible for forwarding-only plan resolution:\n * crypto chain hops only, no Keeta-origin legs, no FX, within maxLegs.\n */\nexport function isForwardingPath(path: AnchorChainingPath, options?: ForwardingOnlyOptions): boolean {\n\tconst maxLegs = options?.maxLegs ?? DEFAULT_FORWARDING_MAX_LEGS;\n\tconst method = options?.method ?? 'explicit';\n\tconst legs = path.path;\n\n\tif (legs.length < 1 || legs.length > maxLegs) {\n\t\treturn(false);\n\t}\n\n\treturn(legs.every((step) => {\n\t\tif (step.type !== 'assetMovement') {\n\t\t\treturn(false);\n\t\t}\n\n\t\tif (!isCryptoChainLocation(step.from.location) || !isCryptoChainLocation(step.to.location)) {\n\t\t\treturn(false);\n\t\t}\n\n\t\tif (isChainLocation(toAssetLocation(step.from.location), 'keeta')) {\n\t\t\treturn(false);\n\t\t}\n\n\t\treturn(supportsPersistentForwarding(step.from.supportedOperations, method));\n\t}));\n}\n\nfunction computeFeeTotalFromBreakdown(valueIn: bigint, fees: AssetFeeBreakdown | PersistentAddressAssetFeeBreakdown): bigint {\n\tlet feeFromLineItems = 0n;\n\n\tfor (const lineItem of fees.lineItems) {\n\t\tif ('value' in lineItem && lineItem.value !== undefined && lineItem.value !== '') {\n\t\t\tfeeFromLineItems += BigInt(lineItem.value);\n\t\t} else if (lineItem.purpose === 'VALUE_VARIABLE' && lineItem.basisPoints !== undefined) {\n\t\t\tfeeFromLineItems += valueIn * BigInt(lineItem.basisPoints) / 10000n;\n\t\t}\n\t}\n\n\tlet feeTotal = feeFromLineItems;\n\tif ('total' in fees && fees.total !== undefined && fees.total !== '') {\n\t\tfeeTotal = BigInt(fees.total);\n\t}\n\n\treturn(feeTotal);\n}\n\nfunction estimateValueOutFromPersistentForwardingFees(valueIn: bigint, fees?: PersistentAddressAssetFeeBreakdown): bigint {\n\tif (!fees) {\n\t\treturn(valueIn);\n\t}\n\n\tconst valueOut = valueIn - computeFeeTotalFromBreakdown(valueIn, fees);\n\treturn(valueOut < 1n ? 1n : valueOut);\n}\n\n/** @internal Exported for unit tests. */\nexport function estimateForwardingValueOut(valueIn: bigint, fees?: PersistentAddressAssetFeeBreakdown): bigint {\n\treturn(estimateValueOutFromPersistentForwardingFees(valueIn, fees));\n}\n\nexport type AnchorChainingFeeLineItemSource =\n\t| 'persistentAddress'\n\t| 'simulatedTransfer'\n\t| 'transferInstruction'\n\t| 'fxQuote'\n\t| 'fxEstimate';\n\nexport type AnchorChainingFeeLineItemMetadata = {\n\tstepIndex: number;\n\tstep: Exclude<ChainStepResolution, { type: 'keetaSend' }>;\n\tsource: AnchorChainingFeeLineItemSource;\n};\n\nexport type AnchorChainingFeeLineItem = {\n\tpurpose: AssetFeeLineItemType;\n\tasset: AssetOrAssetWithLocation;\n\tvalue?: string;\n\tbasisPoints?: number;\n\tdetails?: ClientRenderableContent;\n\tmetadata: AnchorChainingFeeLineItemMetadata;\n};\n\n/** Combined fee breakdown for a computed chaining plan. Does not include a total. */\nexport type AnchorChainingPlanFeeBreakdown = {\n\tlineItems: AnchorChainingFeeLineItem[];\n};\n\n/** List combined fees for a computed chaining plan. Keeta-send steps are omitted (treated as zero). */\nexport function listChainingPlanFees(plan: { plan: AnchorChainingPathComputedPlan }): AnchorChainingPlanFeeBreakdown {\n\tconst lineItems: AnchorChainingFeeLineItem[] = [];\n\n\tconst defaultFeeAsset = (step: Exclude<ChainStepResolution, { type: 'keetaSend' }>): AssetOrAssetWithLocation => {\n\t\tconst location = convertAssetLocationToString(step.step.from.location);\n\n\t\tif (step.type === 'fx') {\n\t\t\tconst token = step.result.isQuote ? step.result.quote.cost.token : step.result.estimate.expectedCost.token;\n\t\t\treturn({ id: token.publicKeyString.get(), location });\n\t\t}\n\n\t\tconst id = KeetaNet.lib.Account.isInstance(step.step.from.asset)\n\t\t\t? step.step.from.asset.publicKeyString.get()\n\t\t\t: step.step.from.asset;\n\n\t\treturn({ id, location });\n\t};\n\n\tfor (let stepIndex = 0; stepIndex < plan.plan.steps.length; stepIndex++) {\n\t\tconst step = plan.plan.steps[stepIndex];\n\t\tif (!step || step.type === 'keetaSend') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst appendBreakdown = (\n\t\t\tbreakdown: { lineItems: readonly (ResolvedFeeLineItem | UnresolvedFeeLineItem)[] },\n\t\t\tsource: AnchorChainingFeeLineItemSource\n\t\t) => {\n\t\t\tconst stepDefaultAsset = defaultFeeAsset(step);\n\t\t\tconst metadata = { stepIndex, step, source };\n\n\t\t\tfor (const item of breakdown.lineItems) {\n\t\t\t\tconst base = {\n\t\t\t\t\tpurpose: item.purpose,\n\t\t\t\t\tasset: item.asset ?? stepDefaultAsset,\n\t\t\t\t\tmetadata,\n\t\t\t\t\t...(item.details !== undefined ? { details: item.details } : {})\n\t\t\t\t};\n\n\t\t\t\tif ('value' in item && item.value !== undefined && item.value !== '') {\n\t\t\t\t\tlineItems.push({\n\t\t\t\t\t\t...base,\n\t\t\t\t\t\tvalue: item.value,\n\t\t\t\t\t\t...(item.purpose === 'VALUE_VARIABLE' && 'basisPoints' in item && item.basisPoints !== undefined ? { basisPoints: item.basisPoints } : {})\n\t\t\t\t\t});\n\t\t\t\t} else if (item.purpose === 'VALUE_VARIABLE' && 'basisPoints' in item && item.basisPoints !== undefined) {\n\t\t\t\t\tlineItems.push({\n\t\t\t\t\t\t...base,\n\t\t\t\t\t\tbasisPoints: item.basisPoints,\n\t\t\t\t\t\tvalue: (step.valueIn * BigInt(item.basisPoints) / 10000n).toString()\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tconst appendAssetFee = (\n\t\t\tassetFee: string | AssetFeeBreakdown | PersistentAddressAssetFeeBreakdown,\n\t\t\tsource: AnchorChainingFeeLineItemSource\n\t\t) => {\n\t\t\tif (typeof assetFee === 'string') {\n\t\t\t\tlineItems.push({\n\t\t\t\t\tpurpose: 'OTHER',\n\t\t\t\t\tasset: defaultFeeAsset(step),\n\t\t\t\t\tvalue: assetFee,\n\t\t\t\t\tmetadata: { stepIndex, step, source }\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tappendBreakdown(assetFee, source);\n\t\t};\n\n\t\tif (step.type === 'fx') {\n\t\t\tconst location = convertAssetLocationToString(step.step.from.location);\n\t\t\tif (step.result.isQuote) {\n\t\t\t\tlineItems.push({\n\t\t\t\t\tpurpose: 'PROVIDER',\n\t\t\t\t\tasset: { id: step.result.quote.cost.token.publicKeyString.get(), location },\n\t\t\t\t\tvalue: step.result.quote.cost.amount.toString(),\n\t\t\t\t\tmetadata: { stepIndex, step, source: 'fxQuote' }\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tlineItems.push({\n\t\t\t\t\tpurpose: 'PROVIDER',\n\t\t\t\t\tasset: { id: step.result.estimate.expectedCost.token.publicKeyString.get(), location },\n\t\t\t\t\tvalue: step.result.estimate.expectedCost.max.toString(),\n\t\t\t\t\tmetadata: { stepIndex, step, source: 'fxEstimate' }\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (step.type === 'assetMovement') {\n\t\t\tappendAssetFee(step.usingInstruction.assetFee, 'transferInstruction');\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (step.simulatedTransfer) {\n\t\t\tconst simulatedInstruction = step.simulatedTransfer.instructions.find((instr) => instr.type === step.step.from.rail);\n\t\t\tif (simulatedInstruction && 'assetFee' in simulatedInstruction) {\n\t\t\t\tappendAssetFee(simulatedInstruction.assetFee, 'simulatedTransfer');\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif (step.persistentAddress.fees) {\n\t\t\tappendBreakdown(step.persistentAddress.fees, 'persistentAddress');\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (step.valueIn > step.valueOut) {\n\t\t\tlineItems.push({\n\t\t\t\tpurpose: 'OTHER',\n\t\t\t\tasset: defaultFeeAsset(step),\n\t\t\t\tvalue: (step.valueIn - step.valueOut).toString(),\n\t\t\t\tmetadata: { stepIndex, step, source: 'persistentAddress' }\n\t\t\t});\n\t\t}\n\t}\n\n\treturn({ lineItems });\n}\n\n/**\n * Whether a resolved plan is anchor-to-anchor with no user intermediary steps.\n * The user may still fund the initial deposit address once.\n */\nexport function isForwardingPlan(plan: { plan: AnchorChainingPathComputedPlan }): { isForwardingOnly: true; } | { isForwardingOnly: false; providerID: string | null; } {\n\tconst steps = plan.plan.steps;\n\n\tif (steps.length === 0) {\n\t\treturn({ isForwardingOnly: false, providerID: null });\n\t}\n\n\tfor (const step of steps) {\n\t\tif (step.type === 'forwarded') {\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn({ isForwardingOnly: false, providerID: step.step?.providerID ?? null })\n\t}\n\n\treturn({ isForwardingOnly: true });\n}\n\n/** Deposit address for the first forwarding leg of a forwarding-only plan. */\nexport function getForwardingDepositAddress(plan: { plan: AnchorChainingPathComputedPlan }): string | null {\n\tconst firstStep = plan.plan.steps[0];\n\n\tif (!firstStep || firstStep.type !== 'forwarded') {\n\t\treturn(null);\n\t}\n\n\tconst address = firstStep.persistentAddress.address;\n\treturn(typeof address === 'string' ? address : null);\n}\n\nexport type AnchorChainingPathValidationResult =\n\t| { valid: true }\n\t| { valid: false; reason: string };\n\nexport interface AnchorChainingPathValidateOptions {\n\t/**\n\t * Validate against forwarding-only plan rules (every asset-movement leg must\n\t * qualify for persistent forwarding), matching ComputePlanOptions.\n\t */\n\tforwardingOnly?: boolean;\n}\n\nexport class AnchorChainingPath {\n\treadonly request: AnchorChainingPathInput;\n\treadonly path: AnchorChainingStepLike[];\n\treadonly parent: AnchorChaining;\n\n\tconstructor(input: {\n\t\trequest: AnchorChainingPathInput;\n\t\tpath: AnchorChainingStepLike[];\n\t\tparent: AnchorChaining;\n\t}) {\n\t\tthis.request = input.request;\n\t\tthis.path = input.path;\n\t\tthis.parent = input.parent;\n\t}\n\n\t/**\n\t * Synchronously check whether this path is structurally and request valid,\n\t * with no network call. Returns { valid: true } when the request value and\n\t * affinity are well formed and the path step shape is allowed.\n\t *\n\t * Persistent-forwarding rules differ between a default plan and a\n\t * forwarding-only plan, so pass the same forwardingOnly value you intend to\n\t * pass to getPlans/AnchorChainingPlan.create. Validating with the wrong mode\n\t * reports the wrong rules.\n\t *\n\t * This does NOT confirm the path will succeed: real feasibility (provider\n\t * availability, quotes, fees, simulated amounts) is only known when the plan\n\t * is computed via getPlans. Use it as a cheap check in a UI.\n\t */\n\tvalidate(options?: AnchorChainingPathValidateOptions): AnchorChainingPathValidationResult {\n\t\ttry {\n\t\t\tconst { affinity } = validateRequest(this.request);\n\t\t\tvalidatePathStructure(this.path, this.request, affinity, options?.forwardingOnly === true, this.keetaLocation);\n\t\t\treturn({ valid: true });\n\t\t} catch (error) {\n\t\t\treturn({ valid: false, reason: error instanceof Error ? error.message : String(error) });\n\t\t}\n\t}\n\n\tget logger(): Logger | undefined {\n\t\treturn(this.parent['logger']);\n\t}\n\n\t/** This client's Keeta chain location, as compared against in #computePlan. */\n\tprotected get keetaLocation(): string {\n\t\treturn(`chain:keeta:${this.parent['client'].network}`);\n\t}\n\n\tprotected async getAccountLike(action: GetAccountForActionPayload, override?: AccountLike): Promise<InstanceType<typeof KeetaNetLib.Account>> {\n\t\tlet found: InstanceType<typeof KeetaNetLib.Account> | undefined = undefined;\n\n\t\tif (this.parent['client'].account.isAccount()) {\n\t\t\tfound = this.parent['client'].account;\n\t\t} else if (this.parent['client'].signer !== null) {\n\t\t\tfound = this.parent['client'].signer;\n\t\t}\n\n\t\tif (override) {\n\t\t\tif (typeof override === 'function') {\n\t\t\t\tfound = await override(action);\n\t\t\t} else {\n\t\t\t\tfound = override;\n\t\t\t}\n\t\t}\n\n\t\tif (!found) {\n\t\t\tthrow(new Error(`Could not get account for ${action.type} action ${action.providerMethod}`));\n\t\t}\n\n\t\treturn(found);\n\t}\n\n\tprotected async getAccountsForAction(action: GetAccountForActionPayload, overrides?: AnchorChainingAccountOverrides): Promise<{ account: InstanceType<typeof KeetaNetLib.Account>; signer: InstanceType<typeof KeetaNetLib.Account> }> {\n\t\tconst [signer, account] = await Promise.all([\n\t\t\tthis.getAccountLike(action, overrides?.signer),\n\t\t\tthis.getAccountLike(action, overrides?.account)\n\t\t]);\n\n\t\treturn({ signer, account });\n\t}\n\n\tasync getProviderLegalDisclaimers(): Promise<PlanDisclaimers | null> {\n\t\tconst legalDisclaimerPromises: { key: string; promise: () => Promise<ProviderDisclaimers | null> }[] = [];\n\n\t\tfor (const step of this.path) {\n\t\t\tif (step.type === 'keetaSend') {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst key = `${step.type}:${step.providerID}`;\n\t\t\tif (legalDisclaimerPromises.find(entry => entry.key === key)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst promise = async () => {\n\t\t\t\ttry {\n\t\t\t\t\tlet disclaimers: ProviderDisclaimers['disclaimers'] | null | undefined = null;\n\t\t\t\t\tif (step.type === 'assetMovement') {\n\t\t\t\t\t\tconst provider = await this.parent.graph.getAssetMovementProviderById(step.providerID);\n\t\t\t\t\t\tdisclaimers = provider?.getLegalDisclaimers();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdisclaimers = await this.parent.graph.fxClient.getLegalDisclaimersById(step.providerID);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!disclaimers) {\n\t\t\t\t\t\treturn(null);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn({ providerID: step.providerID, disclaimers });\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.logger?.debug(`AnchorChainingPath::getProviderLegalDisclaimers`, `Error getting provider disclaimers for providerId: ${step.providerID}`, error);\n\t\t\t\t\tthrow(error)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlegalDisclaimerPromises.push({ key, promise });\n\t\t}\n\n\t\ttry {\n\t\t\tconst disclaimersOrNull = await Promise.all(legalDisclaimerPromises.map((entry) => entry.promise()));\n\t\t\tconst disclaimers = disclaimersOrNull.filter((entry) => entry !== null);\n\t\t\treturn(disclaimers);\n\t\t} catch (error) {\n\t\t\tthis.logger?.debug(`AnchorChainingPath::getProviderLegalDisclaimers`, 'Error getting legal disclaimers for path', error);\n\t\t\treturn(null);\n\t\t}\n\t}\n}\n\nexport class AnchorChainingPlanCreateError extends KeetaAnchorError {\n\tstatic override readonly name: string = 'AnchorChainingPlanCreateError';\n\tprivate readonly AnchorChainingPlanCreateErrorObjectTypeID!: string;\n\tprivate static readonly AnchorChainingPlanCreateErrorObjectTypeID = '940e318b-a6d1-4f8e-be69-e6de9bc99948';\n\n\treadonly failedAtStep: AnchorChainingStepLike;\n\treadonly rootError: unknown;\n\n\tconstructor(input: {\n\t\trootError: unknown;\n\t\tfailedAtStep: AnchorChainingStepLike;\n\t}) {\n\t\tlet message = 'Computing Plan Failed';\n\t\tif (KeetaAnchorError.isInstance(input.rootError)) {\n\t\t\tmessage = input.rootError.message;\n\t\t}\n\t\tsuper(message);\n\n\t\tObject.defineProperty(this, 'AnchorChainingPlanCreateErrorObjectTypeID', {\n\t\t\tvalue: AnchorChainingPlanCreateError.AnchorChainingPlanCreateErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\n\t\tthis.rootError = input.rootError;\n\t\tthis.failedAtStep = input.failedAtStep;\n\t}\n\n\tstatic isInstance(input: unknown): input is AnchorChainingPlanCreateError {\n\t\tif (!this.hasPropWithValue(input, 'AnchorChainingPlanCreateErrorObjectTypeID', AnchorChainingPlanCreateError.AnchorChainingPlanCreateErrorObjectTypeID)) {\n\t\t\treturn(false);\n\t\t}\n\n\t\treturn(true);\n\t}\n\n\tstatic resolveErrorResponse(input: unknown): AnchorPlanPathError {\n\t\tlet rootError;\n\t\tlet providerID = null;\n\n\t\tif (input instanceof AnchorChainingPlanCreateError) {\n\t\t\trootError = input.rootError;\n\t\t\tif (input.failedAtStep?.providerID) {\n\t\t\t\tproviderID = input.failedAtStep.providerID;\n\t\t\t}\n\t\t}\n\n\t\treturn({ success: false, error: rootError, failedAt: { providerID }})\n\t}\n}\n\nexport class AnchorChainingPlan extends AnchorChainingPath {\n\t#_plan: AnchorChainingPathComputedPlan | null = null;\n\n\t#state: AnchorChainingPathState = { status: 'idle' };\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t#listeners = new Map<string, Set<((...args: any[]) => void)>>();\n\t#options: ComputePlanOptions | undefined = undefined;\n\n\tprivate constructor(path: AnchorChainingPath, options?: ComputePlanOptions) {\n\t\tsuper({ ...path });\n\t\tthis.#options = options;\n\t}\n\n\tget plan(): AnchorChainingPathComputedPlan {\n\t\tif (!this.#_plan) {\n\t\t\tthrow(new Error(`Steps have not been computed yet`));\n\t\t}\n\n\t\treturn(this.#_plan);\n\t}\n\n\tlistFees(): AnchorChainingPlanFeeBreakdown {\n\t\treturn(listChainingPlanFees(this));\n\t}\n\n\tasync #computePlan() {\n\t\tif (this.#_plan) {\n\t\t\tthrow(new Error(`Steps have already been computed`));\n\t\t}\n\n\t\tconst affinityAndAmount = validateRequest(this.request);\n\t\tconst { affinity } = affinityAndAmount;\n\t\tvalidatePathStructure(this.path, this.request, affinity, this.#options?.forwardingOnly === true, this.keetaLocation);\n\n\t\tconst sharedClientOptions = {\n\t\t\tresolver: this.parent['resolver'],\n\t\t\t...(this.parent['logger'] ? { logger: this.parent['logger'] } : {})\n\t\t} as const;\n\n\t\tconst fxClient = new KeetaFXAnchorClient(this.parent['client'], sharedClientOptions);\n\n\t\tconst assetMovementClient = new KeetaAssetMovementAnchorClient(this.parent['client'], sharedClientOptions);\n\n\t\tconst findInstruction = <R extends AssetTransferInstructions['type']>(allInstructions: AssetTransferInstructions[], type: R): Extract<AssetTransferInstructions, { type: R }> => {\n\t\t\tconst found = allInstructions.find((instr): instr is Extract<AssetTransferInstructions, { type: R }> => {\n\t\t\t\treturn(instr.type === type);\n\t\t\t});\n\n\t\t\tif (!found) {\n\t\t\t\tthrow(new Error(`Expected to find instruction of type ${type} in next step's instructions`));\n\t\t\t}\n\n\t\t\treturn(found);\n\t\t};\n\n\t\t/**\n\t\t * Resolve persistent forwarding addresses for path steps whose source rail\n\t\t * cannot accept an initiated transfer.\n\t\t */\n\t\ttype ForwardedStepInfo = { provider: AssetMovementProvider; persistentAddress: KeetaPersistentForwardingAddressDetails };\n\t\tconst forwardedSteps = new Map<number, ForwardedStepInfo>();\n\t\tconst forwardingOnly = this.#options?.forwardingOnly === true;\n\n\t\tconst resolvePersistentForwardingForStep = async (scanIndex: number, destinationAddress: string): Promise<void> => {\n\t\t\tconst scanStep = this.path[scanIndex];\n\t\t\tif (!scanStep || scanStep.type !== 'assetMovement') {\n\t\t\t\tthrow(new Error(`Expected asset movement step at index ${scanIndex} for persistent forwarding`));\n\t\t\t}\n\n\t\t\tconst forwardedAssetPair = { from: scanStep.from.asset, to: scanStep.to.asset };\n\t\t\tconst forwardedProviders = await assetMovementClient.getProvidersForTransfer(\n\t\t\t\t{ asset: forwardedAssetPair, from: scanStep.from.location, to: scanStep.to.location },\n\t\t\t\t{ providerIDs: [ scanStep.providerID ] }\n\t\t\t);\n\t\t\tif (!forwardedProviders?.[0] || forwardedProviders.length === 0) {\n\t\t\t\tthrow(new Error(`Could not get asset movement provider ${scanStep.providerID} for persistent-forwarding step at index ${scanIndex}`));\n\t\t\t}\n\n\t\t\tconst forwardedProvider = forwardedProviders[0];\n\t\t\tif (!await forwardedProvider.isOperationSupported('createPersistentForwarding')) {\n\t\t\t\tthrow(new Error(`Asset movement provider ${scanStep.providerID} does not support createPersistentForwarding, but the source rail ${scanStep.from.rail} at ${convertAssetLocationToString(scanStep.from.location)} requires it (initiateTransfer is unsupported)`));\n\t\t\t}\n\t\t\tif (!forwardingOnly && !await forwardedProvider.isOperationSupported('simulateTransfer')) {\n\t\t\t\tthrow(new Error(`Asset movement provider ${scanStep.providerID} does not support simulateTransfer, which is required to compute valueOut for a persistent-forwarding step at ${convertAssetLocationToString(scanStep.from.location)}`));\n\t\t\t}\n\n\t\t\tconst { signer: forwardedSigner } = await this.getAccountsForAction({\n\t\t\t\ttype: 'assetMovement',\n\t\t\t\tproviderMethod: 'initiateTransfer',\n\t\t\t\tprovider: forwardedProvider\n\t\t\t}, this.#options?.overrides);\n\n\t\t\tlet persistentAddress: KeetaPersistentForwardingAddressDetails | undefined;\n\t\t\tif (await forwardedProvider.isOperationSupported('listPersistentForwarding')) {\n\t\t\t\ttry {\n\t\t\t\t\tconst existing = await forwardedProvider.listForwardingAddresses({\n\t\t\t\t\t\taccount: forwardedSigner,\n\t\t\t\t\t\tsearch: [{\n\t\t\t\t\t\t\tsourceLocation: scanStep.from.location,\n\t\t\t\t\t\t\tdestinationLocation: scanStep.to.location,\n\t\t\t\t\t\t\tasset: forwardedAssetPair,\n\t\t\t\t\t\t\tdestinationAddress\n\t\t\t\t\t\t}]\n\t\t\t\t\t});\n\n\t\t\t\t\tconst sourceLocationString = convertAssetLocationToString(scanStep.from.location);\n\t\t\t\t\tconst destLocationString = convertAssetLocationToString(scanStep.to.location);\n\t\t\t\t\tconst match = existing.addresses.find(addr => {\n\t\t\t\t\t\tif (addr.destinationAddress !== destinationAddress) {\n\t\t\t\t\t\t\treturn(false);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!addr.sourceLocation || convertAssetLocationToString(addr.sourceLocation) !== sourceLocationString) {\n\t\t\t\t\t\t\treturn(false);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!addr.destinationLocation || convertAssetLocationToString(addr.destinationLocation) !== destLocationString) {\n\t\t\t\t\t\t\treturn(false);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (addr.asset && !doesAssetOrPairMatch(addr.asset, forwardedAssetPair)) {\n\t\t\t\t\t\t\treturn(false);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn(true);\n\t\t\t\t\t});\n\t\t\t\t\tif (match) {\n\t\t\t\t\t\tpersistentAddress = match;\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.logger?.debug('AnchorChainingPlan::computePlan', `listForwardingAddresses lookup failed for step ${scanIndex}, will create a new address`, error);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!persistentAddress) {\n\t\t\t\tpersistentAddress = await forwardedProvider.createPersistentForwardingAddress({\n\t\t\t\t\taccount: forwardedSigner,\n\t\t\t\t\tsourceLocation: scanStep.from.location,\n\t\t\t\t\tdestinationLocation: scanStep.to.location,\n\t\t\t\t\tdestinationAddress,\n\t\t\t\t\tasset: forwardedAssetPair\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (typeof persistentAddress.address !== 'string') {\n\t\t\t\tthrow(new Error(`Persistent forwarding address for step ${scanIndex} is not a resolved string (got ${typeof persistentAddress.address})`));\n\t\t\t}\n\n\t\t\tforwardedSteps.set(scanIndex, { provider: forwardedProvider, persistentAddress });\n\t\t};\n\n\t\tif (forwardingOnly) {\n\t\t\tfor (let scanIndex = this.path.length - 1; scanIndex >= 0; scanIndex--) {\n\t\t\t\tconst scanStep = this.path[scanIndex];\n\t\t\t\tif (!scanStep || scanStep.type !== 'assetMovement') {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Accept explicit createPersistentForwarding:true or omitted supportedOperations\n\t\t\t\t// (implied). Reject partial ops that omit the flag - those imply false.\n\t\t\t\tconst pfrEligible = supportsPersistentForwarding(scanStep.from.supportedOperations, 'implied');\n\t\t\t\tconst sourceIsKeeta = isChainLocation(toAssetLocation(scanStep.from.location), 'keeta');\n\n\t\t\t\t// Defense in depth: validatePathStructure enforces this before any network call.\n\t\t\t\tif (sourceIsKeeta || !pfrEligible) {\n\t\t\t\t\tthrow(new Error(`Forwarding-only plan requires persistent forwarding support on every leg, but step ${scanIndex} at ${convertAssetLocationToString(scanStep.from.location)} does not qualify`));\n\t\t\t\t}\n\n\t\t\t\tlet destinationAddress: string;\n\t\t\t\tif (scanIndex === this.path.length - 1) {\n\t\t\t\t\tconst finalRecipient = this.request.destination.recipient;\n\t\t\t\t\tif (typeof finalRecipient !== 'string') {\n\t\t\t\t\t\tthrow(new Error(`Forwarding-only plan requires the destination recipient to be a resolved address string`));\n\t\t\t\t\t}\n\t\t\t\t\tdestinationAddress = finalRecipient;\n\t\t\t\t} else {\n\t\t\t\t\tconst nextForwarded = forwardedSteps.get(scanIndex + 1);\n\t\t\t\t\tif (!nextForwarded) {\n\t\t\t\t\t\tthrow(new Error(`Forwarding-only plan expected persistent forwarding to be resolved for next step ${scanIndex + 1}`));\n\t\t\t\t\t}\n\t\t\t\t\tconst nextAddress = nextForwarded.persistentAddress.address;\n\t\t\t\t\tif (typeof nextAddress !== 'string') {\n\t\t\t\t\t\tthrow(new Error(`Forwarding-only plan requires the next step persistent forwarding address to be a resolved string at index ${scanIndex + 1}`));\n\t\t\t\t\t}\n\t\t\t\t\tdestinationAddress = nextAddress;\n\t\t\t\t}\n\n\t\t\t\tawait resolvePersistentForwardingForStep(scanIndex, destinationAddress);\n\t\t\t}\n\t\t}\n\n\t\tfor (let scanIndex = 0; scanIndex < this.path.length; scanIndex++) {\n\t\t\tif (forwardingOnly) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst scanStep = this.path[scanIndex];\n\t\t\tif (!scanStep || scanStep.type !== 'assetMovement') {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * PFR is selected in two cases:\n\t\t\t * (a) the source rail explicitly cannot accept a managed transfer.\n\t\t\t * (b) the prior step is also an asset-movement step (AMP -> AMP\n\t\t\t * transition) and the source rail supports PFR.\n\t\t\t *\n\t\t\t * Persistent forwarding only applies to non-Keeta (external chain)\n\t\t\t * source rails: the model is that the prior step deposits into a chain\n\t\t\t * address the bridge observes and auto-forwards. A Keeta-source leg\n\t\t\t * (KEETA_SEND) is always a user-initiated send -- the prior step routes\n\t\t\t * its output back to the user, who then sends again -- so it is never\n\t\t\t * PFR, even when the provider advertises createPersistentForwarding at\n\t\t\t * the provider level (which its bare KEETA_SEND rails would otherwise\n\t\t\t * inherit). Treating an on-Keeta swap as PFR skips the required second\n\t\t\t * send.\n\t\t\t */\n\t\t\tconst priorStep = scanIndex > 0 ? this.path[scanIndex - 1] : null;\n\t\t\tconst isAmpToAmpTransition = priorStep?.type === 'assetMovement';\n\t\t\tconst pfrSupported = scanStep.from.supportedOperations?.createPersistentForwarding === true;\n\t\t\tconst initiateForbidden = scanStep.from.supportedOperations?.initiateTransfer === false;\n\t\t\tconst sourceIsKeeta = isChainLocation(toAssetLocation(scanStep.from.location), 'keeta');\n\n\t\t\tconst shouldUsePFR = !sourceIsKeeta && (initiateForbidden || (isAmpToAmpTransition && pfrSupported));\n\t\t\tif (!shouldUsePFR) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t/*\n\t\t\t * Defense in depth: validatePathStructure enforces these PFR rules before\n\t\t\t * any network call. They are kept here next to the operation so the\n\t\t\t * guarantee holds even if the early pass is bypassed. The typeof check\n\t\t\t * also narrows destinationAddress to string for the call below.\n\t\t\t */\n\t\t\tif (!pfrSupported) {\n\t\t\t\tthrow(new Error(`Asset movement provider ${scanStep.providerID} source rail ${scanStep.from.rail} at ${convertAssetLocationToString(scanStep.from.location)} declares initiateTransfer:false but does not support createPersistentForwarding`));\n\t\t\t}\n\n\t\t\tif (scanIndex !== this.path.length - 1) {\n\t\t\t\tthrow(new Error(`Persistent-forwarding (PersistentForwardingRelay-only) asset movement steps are currently only supported as the last step in a chain (step ${scanIndex} of ${this.path.length})`));\n\t\t\t}\n\n\t\t\tconst destinationAddress = this.request.destination.recipient;\n\t\t\tif (typeof destinationAddress !== 'string') {\n\t\t\t\tthrow(new Error(`Persistent-forwarding step at index ${scanIndex} requires the chain's destination recipient to be a resolved address string`));\n\t\t\t}\n\n\t\t\tawait resolvePersistentForwardingForStep(scanIndex, destinationAddress);\n\t\t}\n\n\t\tconst stepPromises: Promise<ChainStepResolution>[] = [];\n\t\tconst resolvingSteps = new Set<number>();\n\t\tconst precomputedValueOuts = new Map<number, bigint>();\n\t\tconst resolveStep = async (index: number): Promise<ChainStepResolution> => {\n\t\t\tconst step = this.path[index];\n\n\t\t\tif (!step) {\n\t\t\t\tthrow(new Error(`Step ${index} is not defined`));\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * Detect cycles\n\t\t\t */\n\t\t\tif (resolvingSteps.has(index)) {\n\t\t\t\tthrow(new Error(`Cyclic dependency detected in resolveStep: step ${index} is already being resolved`));\n\t\t\t}\n\n\t\t\tlet promise: Promise<ChainStepResolution> | undefined = stepPromises[index];\n\n\t\t\tif (!promise) {\n\t\t\t\tresolvingSteps.add(index);\n\n\t\t\t\tpromise = (async (): Promise<ChainStepResolution> => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (step.type === 'fx') {\n\t\t\t\t\t\t\tlet amount;\n\n\t\t\t\t\t\t\tif (affinity === 'from') {\n\t\t\t\t\t\t\t\tif (index === 0) {\n\t\t\t\t\t\t\t\t\tamount = affinityAndAmount.amount;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tconst previous = await resolveStep(index - 1);\n\t\t\t\t\t\t\t\t\tamount = previous.valueOut;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (affinity === 'to') {\n\t\t\t\t\t\t\t\tif (index === (this.path.length - 1)) {\n\t\t\t\t\t\t\t\t\t// XXX:TODO Move this to destination\n\t\t\t\t\t\t\t\t\tamount = affinityAndAmount.amount;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tconst next = await resolveStep(index + 1);\n\t\t\t\t\t\t\t\t\tamount = next.valueIn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tassertNever(affinity);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst fxAccountOptions = await this.getAccountsForAction({\n\t\t\t\t\t\t\t\ttype: 'fx',\n\t\t\t\t\t\t\t\tproviderMethod: 'getAccountForAction'\n\t\t\t\t\t\t\t}, this.#options?.overrides);\n\n\t\t\t\t\t\t\tconst quotesOrEstimates = await fxClient.getQuotesOrEstimates(\n\t\t\t\t\t\t\t\t{ from: step.from.asset, to: step.to.asset, amount, affinity },\n\t\t\t\t\t\t\t\tfxAccountOptions,\n\t\t\t\t\t\t\t\t{ providerIDs: [ step.providerID ] }\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif (!quotesOrEstimates?.[0] || quotesOrEstimates.length === 0) {\n\t\t\t\t\t\t\t\tthrow(new Error(`Could not get FX quote/estimate for provider ${step.providerID}`));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst result = quotesOrEstimates[0];\n\n\t\t\t\t\t\t\tif (!result.isQuote && result.estimate.canPerformExchange === false) {\n\t\t\t\t\t\t\t\tthrow(new Error(`FX estimate from provider ${step.providerID} indicates exchange cannot be performed`));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst convertedAmount = result.isQuote ? result.quote.convertedAmount : result.estimate.convertedAmount;\n\n\t\t\t\t\t\t\tlet valueIn;\n\t\t\t\t\t\t\tlet valueOut;\n\n\t\t\t\t\t\t\tif (affinity === 'to') {\n\t\t\t\t\t\t\t\tvalueOut = amount;\n\t\t\t\t\t\t\t\tvalueIn = convertedAmount;\n\t\t\t\t\t\t\t} else if (affinity === 'from') {\n\t\t\t\t\t\t\t\tvalueOut = convertedAmount;\n\t\t\t\t\t\t\t\tvalueIn = amount;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tassertNever(affinity);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn({ type: 'fx', step, valueIn, valueOut, result });\n\t\t\t\t\t\t} else if (step.type === 'assetMovement') {\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t * Defense in depth: validatePathStructure rejects affinity 'to' on\n\t\t\t\t\t\t\t * asset-movement steps before any network call. This guard keeps the\n\t\t\t\t\t\t\t * check next to the operation in case the early pass is bypassed.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tif (affinity === 'to') {\n\t\t\t\t\t\t\t\tthrow(new Error(`Chaining with affinity 'to' is not currently supported for asset movement steps, as it requires looking up transfer quotes/estimates which is not currently implemented`));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tlet depositValue: bigint;\n\t\t\t\t\t\t\tif (index === 0) {\n\t\t\t\t\t\t\t\tdepositValue = affinityAndAmount.amount;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tconst precomputedPrev = precomputedValueOuts.get(index - 1);\n\t\t\t\t\t\t\t\tif (precomputedPrev !== undefined) {\n\t\t\t\t\t\t\t\t\tdepositValue = precomputedPrev;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tconst previous = await resolveStep(index - 1);\n\t\t\t\t\t\t\t\t\tdepositValue = previous.valueOut;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst assetPair = { from: step.from.asset, to: step.to.asset };\n\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t * Forwarded step: prior step deposits into a pre-resolved persistent address.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tconst forwardedInfo = forwardedSteps.get(index);\n\t\t\t\t\t\t\tif (forwardedInfo) {\n\t\t\t\t\t\t\t\tconst { provider: forwardedProvider, persistentAddress } = forwardedInfo;\n\n\t\t\t\t\t\t\t\tlet estimatedValueOut = depositValue;\n\t\t\t\t\t\t\t\tlet simulatedTransfer: Awaited<ReturnType<typeof forwardedProvider.simulateTransfer>> | undefined;\n\t\t\t\t\t\t\t\tif (forwardingOnly) {\n\t\t\t\t\t\t\t\t\testimatedValueOut = estimateValueOutFromPersistentForwardingFees(depositValue, persistentAddress.fees);\n\t\t\t\t\t\t\t\t} else if (await forwardedProvider.isOperationSupported('simulateTransfer')) {\n\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\tconst { signer: forwardedSigner } = await this.getAccountsForAction({\n\t\t\t\t\t\t\t\t\t\t\ttype: 'assetMovement',\n\t\t\t\t\t\t\t\t\t\t\tproviderMethod: 'initiateTransfer',\n\t\t\t\t\t\t\t\t\t\t\tprovider: forwardedProvider\n\t\t\t\t\t\t\t\t\t\t}, this.#options?.overrides);\n\t\t\t\t\t\t\t\t\t\tsimulatedTransfer = await forwardedProvider.simulateTransfer({\n\t\t\t\t\t\t\t\t\t\t\taccount: forwardedSigner,\n\t\t\t\t\t\t\t\t\t\t\tasset: assetPair,\n\t\t\t\t\t\t\t\t\t\t\tfrom: { location: step.from.location },\n\t\t\t\t\t\t\t\t\t\t\tto: { location: step.to.location },\n\t\t\t\t\t\t\t\t\t\t\tvalue: depositValue\n\t\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\t\tconst simulatedInstruction = simulatedTransfer.instructions.find((instr): instr is Extract<SimulatedAssetTransferInstructions, { type: typeof step.from.rail }> => instr.type === step.from.rail);\n\t\t\t\t\t\t\t\t\t\tlet simulatedTotalReceive: string | undefined;\n\t\t\t\t\t\t\t\t\t\tif (simulatedInstruction) {\n\t\t\t\t\t\t\t\t\t\t\tsimulatedTotalReceive = simulatedInstruction.totalReceiveAmount;\n\t\t\t\t\t\t\t\t\t\t\tif (simulatedTotalReceive === undefined && 'value' in simulatedInstruction) {\n\t\t\t\t\t\t\t\t\t\t\t\tsimulatedTotalReceive = simulatedInstruction.value;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif (simulatedTotalReceive !== undefined) {\n\t\t\t\t\t\t\t\t\t\t\testimatedValueOut = BigInt(simulatedTotalReceive);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\t\t\t\tthis.logger?.debug('AnchorChainingPlan::resolveStep', `simulateTransfer for forwarded step ${index} valueOut estimation failed; falling back to depositValue`, error);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn({\n\t\t\t\t\t\t\t\t\ttype: 'forwarded',\n\t\t\t\t\t\t\t\t\tstep,\n\t\t\t\t\t\t\t\t\tvalueIn: depositValue,\n\t\t\t\t\t\t\t\t\tvalueOut: estimatedValueOut,\n\t\t\t\t\t\t\t\t\tpersistentAddress,\n\t\t\t\t\t\t\t\t\tprovider: forwardedProvider,\n\t\t\t\t\t\t\t\t\t...(simulatedTransfer !== undefined ? { simulatedTransfer } : {})\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (this.#options?.forwardingOnly) {\n\t\t\t\t\t\t\t\tthrow(new Error(`Forwarding-only plan requires persistent forwarding for step at index ${index}, but none was resolved`));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst providers = await assetMovementClient.getProvidersForTransfer(\n\t\t\t\t\t\t\t\t{ asset: assetPair, from: step.from.location, to: step.to.location },\n\t\t\t\t\t\t\t\t{ providerIDs: [ step.providerID ] }\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif (!providers?.[0] || providers.length === 0) {\n\t\t\t\t\t\t\t\tthrow(new Error(`Could not get asset movement provider ${step.providerID}`));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst provider = providers[0];\n\n\t\t\t\t\t\t\tconst { signer } = await this.getAccountsForAction({\n\t\t\t\t\t\t\t\ttype: 'assetMovement',\n\t\t\t\t\t\t\t\tproviderMethod: 'initiateTransfer',\n\t\t\t\t\t\t\t\tprovider\n\t\t\t\t\t\t\t}, this.#options?.overrides);\n\n\t\t\t\t\t\t\tlet resolvedRecipient: RecipientResolved | GenericAccount;\n\t\t\t\t\t\t\tlet sendingToType: SendingToType;\n\n\t\t\t\t\t\t\tif (index === this.path.length - 1) {\n\t\t\t\t\t\t\t\tresolvedRecipient = this.request.destination.recipient;\n\t\t\t\t\t\t\t\tsendingToType = 'FINAL_DESTINATION';\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tsendingToType = 'NEXT_STEP';\n\n\t\t\t\t\t\t\t\tconst nextPathStep = this.path[index + 1];\n\n\t\t\t\t\t\t\t\tif (!nextPathStep) {\n\t\t\t\t\t\t\t\t\tthrow(new Error(`Expected next step at index ${index + 1} for asset movement step at index ${index}`));\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\t * Next step is forwarded: recipient is its persistent address,\n\t\t\t\t\t\t\t\t * no need to resolve the next step's instructions.\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\tconst nextForwardedInfo = forwardedSteps.get(index + 1);\n\t\t\t\t\t\t\t\tif (nextForwardedInfo) {\n\t\t\t\t\t\t\t\t\tconst pfiAddress = nextForwardedInfo.persistentAddress.address;\n\t\t\t\t\t\t\t\t\tif (typeof pfiAddress !== 'string') {\n\t\t\t\t\t\t\t\t\t\tthrow(new Error(`Persistent forwarding address for next step ${index + 1} is not a resolved string`));\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tresolvedRecipient = pfiAddress;\n\t\t\t\t\t\t\t\t} else if (nextPathStep.from.location === this.keetaLocation) {\n\t\t\t\t\t\t\t\t\tconst { account } = await this.getAccountsForAction({\n\t\t\t\t\t\t\t\t\t\ttype: 'assetMovement',\n\t\t\t\t\t\t\t\t\t\tproviderMethod: 'initiateTransfer'\n\t\t\t\t\t\t\t\t\t}, this.#options?.overrides);\n\n\t\t\t\t\t\t\t\t\t// Store funds in-transit in the account instead of forwarding directly to provider.\n\t\t\t\t\t\t\t\t\tresolvedRecipient = account;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t\t * If the provider does not support simulateTransfer,\n\t\t\t\t\t\t\t\t\t * we cannot chain to this step.\n\t\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\t\tif (!await provider.isOperationSupported('simulateTransfer')) {\n\t\t\t\t\t\t\t\t\t\tthrow(new Error(`Asset movement provider ${step.providerID} does not support simulateTransfer, which is required for chaining at non-keeta intermediate location ${convertAssetLocationToString(nextPathStep.from.location)}`));\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tconst simulated = await provider.simulateTransfer({\n\t\t\t\t\t\t\t\t\t\taccount: signer,\n\t\t\t\t\t\t\t\t\t\tasset: assetPair,\n\t\t\t\t\t\t\t\t\t\tfrom: { location: step.from.location },\n\t\t\t\t\t\t\t\t\t\tto: { location: step.to.location },\n\t\t\t\t\t\t\t\t\t\tvalue: depositValue\n\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\tconst simulatedInstruction = simulated.instructions.find((instr): instr is Extract<SimulatedAssetTransferInstructions, { type: typeof step.from.rail }> => instr.type === step.from.rail);\n\t\t\t\t\t\t\t\t\tif (!simulatedInstruction) {\n\t\t\t\t\t\t\t\t\t\tthrow(new Error(`Simulated transfer for step ${index} did not return an instruction matching rail ${step.from.rail}`));\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tlet simulatedTotalReceive: string | undefined = simulatedInstruction.totalReceiveAmount;\n\t\t\t\t\t\t\t\t\tif (simulatedTotalReceive === undefined && 'value' in simulatedInstruction) {\n\t\t\t\t\t\t\t\t\t\tsimulatedTotalReceive = simulatedInstruction.value;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (simulatedTotalReceive === undefined) {\n\t\t\t\t\t\t\t\t\t\tthrow(new Error(`totalReceiveAmount must be defined for simulated transfer when chaining`));\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tprecomputedValueOuts.set(index, BigInt(simulatedTotalReceive));\n\n\t\t\t\t\t\t\t\t\tconst nextStep = await resolveStep(index + 1);\n\n\t\t\t\t\t\t\t\t\tif (nextStep.type === 'assetMovement' || nextStep.type === 'keetaSend') {\n\t\t\t\t\t\t\t\t\t\tif (nextStep.usingInstruction.type !== step.to.rail) {\n\t\t\t\t\t\t\t\t\t\t\tthrow(new Error(`Next step's usingInstruction type ${nextStep.usingInstruction.type} does not match expected ${step.to.rail} for recipient resolution`));\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tconst foundInstruction = nextStep.usingInstruction;\n\n\t\t\t\t\t\t\t\t\t\tconst isFiatPushRailFoundInstruction = (input: AssetTransferInstructions | SimulatedAssetTransferInstructions): input is Extract<AssetTransferInstructions, { type: FiatPushRails; }> => {\n\t\t\t\t\t\t\t\t\t\t\treturn(isFiatRail(input.type));\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tif (foundInstruction.type === 'KEETA_SEND') {\n\t\t\t\t\t\t\t\t\t\t\t// Structurally unreachable now that validatePathStructure requires a keetaSend step to be the sole step; kept as a defensive invariant.\n\t\t\t\t\t\t\t\t\t\t\tthrow(new Error(`Cannot currently chain from asset movement to KEETA_SEND step, as this implies multiple keeta locations in the path which is not currently supported`));\n\t\t\t\t\t\t\t\t\t\t} else if (isFiatPushRailFoundInstruction(foundInstruction)) {\n\t\t\t\t\t\t\t\t\t\t\tif (foundInstruction.depositMessage) {\n\t\t\t\t\t\t\t\t\t\t\t\tthrow(new Error(`Deposit message outbound is not currently supported for chaining`));\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tresolvedRecipient = foundInstruction.account;\n\t\t\t\t\t\t\t\t\t\t} else if (foundInstruction.type === 'EVM_SEND' || foundInstruction.type === 'SOLANA_SEND') {\n\t\t\t\t\t\t\t\t\t\t\tresolvedRecipient = foundInstruction.sendToAddress;\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tthrow(new Error(`Unsupported rail for chaining: ${step.to.rail}`));\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else if (nextStep.type === 'fx') {\n\t\t\t\t\t\t\t\t\t\tthrow(new Error(`Cannot currently chain from asset movement to fx step, as fx step does not have recipient information`));\n\t\t\t\t\t\t\t\t\t} else if (nextStep.type === 'forwarded') {\n\t\t\t\t\t\t\t\t\t\tthrow(new Error(`Internal invariant violation: forwarded step at index ${index + 1} reached simulate-cycle-break path; expected nextForwardedInfo branch to have handled it`));\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tassertNever(nextStep);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst recipientString = KeetaNet.lib.Account.isInstance(resolvedRecipient)\n\t\t\t\t\t\t\t\t? resolvedRecipient.publicKeyString.get()\n\t\t\t\t\t\t\t\t: resolvedRecipient;\n\n\t\t\t\t\t\t\tconst transfer = await provider.initiateTransfer({\n\t\t\t\t\t\t\t\taccount: signer,\n\t\t\t\t\t\t\t\tasset: assetPair,\n\t\t\t\t\t\t\t\tfrom: { location: step.from.location },\n\t\t\t\t\t\t\t\tto: {\n\t\t\t\t\t\t\t\t\tlocation: step.to.location,\n\t\t\t\t\t\t\t\t\trecipient: recipientString\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tvalue: depositValue\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tconst usingInstruction = findInstruction(transfer.instructions, step.from.rail);\n\n\t\t\t\t\t\t\tlet totalReceiveAmount: string | undefined = usingInstruction.totalReceiveAmount;\n\t\t\t\t\t\t\tif (totalReceiveAmount === undefined && 'value' in usingInstruction) {\n\t\t\t\t\t\t\t\ttotalReceiveAmount = usingInstruction.value;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (totalReceiveAmount === undefined) {\n\t\t\t\t\t\t\t\tthrow(new Error(`totalReceiveAmount must be defined for chaining`));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst actualValueOut = BigInt(totalReceiveAmount);\n\n\t\t\t\t\t\t\t// If we simulated to break a cycle, the next step's initiateTransfer was\n\t\t\t\t\t\t\t// keyed off the simulated valueOut; a mismatch here means the next step\n\t\t\t\t\t\t\t// is now misaligned, so fail at plan-time instead of letting execute() catch it.\n\t\t\t\t\t\t\tconst simulatedValueOut = precomputedValueOuts.get(index);\n\t\t\t\t\t\t\tif (simulatedValueOut !== undefined && simulatedValueOut !== actualValueOut) {\n\t\t\t\t\t\t\t\tthrow(new Error(`Simulated valueOut ${simulatedValueOut} for step ${index} does not match actual ${actualValueOut} from initiateTransfer`));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn({\n\t\t\t\t\t\t\t\ttype: 'assetMovement',\n\t\t\t\t\t\t\t\tstep: step,\n\t\t\t\t\t\t\t\tvalueIn: depositValue,\n\t\t\t\t\t\t\t\tusingInstruction: usingInstruction,\n\t\t\t\t\t\t\t\ttransfer: transfer,\n\t\t\t\t\t\t\t\tsendingTo: sendingToType,\n\t\t\t\t\t\t\t\tvalueOut: actualValueOut,\n\t\t\t\t\t\t\t\tprovider: provider\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t} else if (step.type === 'keetaSend') {\n\t\t\t\t\t\t\t// Defense in depth: validatePathStructure also enforces this early.\n\t\t\t\t\t\t\tif (this.path.length !== 1) {\n\t\t\t\t\t\t\t\tthrow(new Error(`Direct same-location/same-asset send steps must be the only step in the path`));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (!KeetaNet.lib.Account.isInstance(step.from.asset) || !KeetaNet.lib.Account.isInstance(step.to.asset)) {\n\t\t\t\t\t\t\t\tthrow(new Error(`Expected assets to be token accounts for KEETA_SEND rail`));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (!step.from.asset.comparePublicKey(step.to.asset)) {\n\t\t\t\t\t\t\t\tthrow(new Error(`For KEETA_SEND step, from and to asset must be the same account`));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tlet keetaRecipientDestination = null;\n\t\t\t\t\t\t\tif (KeetaNet.lib.Account.isInstance(this.request.destination.recipient)) {\n\t\t\t\t\t\t\t\tkeetaRecipientDestination = this.request.destination.recipient;\n\t\t\t\t\t\t\t} else if (typeof this.request.destination.recipient === 'string') {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tkeetaRecipientDestination = KeetaNet.lib.Account.fromPublicKeyString(this.request.destination.recipient);\n\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\t/* ignore errors */\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!keetaRecipientDestination) {\n\t\t\t\t\t\t\t\tthrow(new Error(`Expected destination recipient to be a public key string for KEETA_SEND step`));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn({\n\t\t\t\t\t\t\t\ttype: 'keetaSend',\n\t\t\t\t\t\t\t\tstep: null,\n\t\t\t\t\t\t\t\tvalueIn: affinityAndAmount.amount,\n\t\t\t\t\t\t\t\tvalueOut: affinityAndAmount.amount,\n\t\t\t\t\t\t\t\tusingInstruction: {\n\t\t\t\t\t\t\t\t\ttype: 'KEETA_SEND',\n\t\t\t\t\t\t\t\t\ttokenAddress: step.to.asset.publicKeyString.get(),\n\t\t\t\t\t\t\t\t\tsendToAddress: keetaRecipientDestination.publicKeyString.get(),\n\t\t\t\t\t\t\t\t\ttotalReceiveAmount: affinityAndAmount.amount.toString(),\n\t\t\t\t\t\t\t\t\tlocation: `chain:keeta:${this.parent['client'].network}`,\n\t\t\t\t\t\t\t\t\tvalue: String(affinityAndAmount.amount),\n\t\t\t\t\t\t\t\t\tassetFee: '0'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tassertNever(step);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tif (error instanceof AnchorChainingPlanCreateError) {\n\t\t\t\t\t\t\tthrow(error);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tthrow(new AnchorChainingPlanCreateError({\n\t\t\t\t\t\t\trootError: error,\n\t\t\t\t\t\t\tfailedAtStep: step\n\t\t\t\t\t\t}))\n\t\t\t\t\t}\n\t\t\t\t})();\n\n\t\t\t\tpromise.then(() => resolvingSteps.delete(index), () => resolvingSteps.delete(index));\n\t\t\t\tstepPromises[index] = promise;\n\t\t\t}\n\n\t\t\treturn(await promise);\n\t\t}\n\n\t\tconst steps = [];\n\t\tfor (let index = 0; index < this.path.length; index++) {\n\t\t\tsteps.push(await resolveStep(index));\n\t\t}\n\n\t\t// Direct same-location/same-asset send: no provider steps needed.\n\t\tif (steps.length === 0) {\n\t\t\treturn({\n\t\t\t\tsteps: [],\n\t\t\t\ttotalValueIn: affinityAndAmount.amount,\n\t\t\t\ttotalValueOut: affinityAndAmount.amount\n\t\t\t});\n\t\t}\n\n\t\tconst firstStep = steps[0];\n\t\tconst lastStep = steps[steps.length - 1];\n\n\t\tif (!firstStep || !lastStep) {\n\t\t\tthrow(new Error(`Steps array is empty`));\n\t\t}\n\n\t\tif (affinity === 'from') {\n\t\t\tif (firstStep.valueIn !== this.request.source.value) {\n\t\t\t\tthrow(new Error(`Computed valueIn for first step ${firstStep.valueIn} does not match request source value ${this.request.source.value}`));\n\t\t\t}\n\t\t} else if (affinity === 'to') {\n\t\t\tif (lastStep.valueOut !== this.request.destination.value) {\n\t\t\t\tthrow(new Error(`Computed valueOut for last step ${lastStep.valueOut} does not match requested destination value ${this.request.destination.value}`));\n\t\t\t}\n\t\t}\n\n\t\tif (lastStep.valueOut <= 0n) {\n\t\t\tthrow(new Error(`Computed valueOut for last step must be greater than 0, got ${lastStep.valueOut}`));\n\t\t}\n\n\t\treturn({\n\t\t\tsteps,\n\t\t\ttotalValueIn: firstStep.valueIn,\n\t\t\ttotalValueOut: lastStep.valueOut\n\t\t});\n\t}\n\n\tstatic async create(path: AnchorChainingPath, options?: ComputePlanOptions): Promise<AnchorChainingPlan> {\n\t\tconst instance = new this(path, options);\n\t\tinstance.#_plan = await instance.#computePlan();\n\t\treturn(instance);\n\t}\n\n\tget state(): AnchorChainingPathState {\n\t\treturn(this.#state);\n\t}\n\n\ton<E extends keyof AnchorChainingPathEventMap>(event: E, listener: (...args: AnchorChainingPathEventMap[E]) => void): void {\n\t\tlet listenerSet = this.#listeners.get(event);\n\t\tif (!listenerSet) {\n\t\t\tlistenerSet = new Set();\n\t\t\tthis.#listeners.set(event, listenerSet);\n\t\t}\n\t\tlistenerSet.add(listener);\n\t}\n\n\toff<E extends keyof AnchorChainingPathEventMap>(event: E, listener: (...args: AnchorChainingPathEventMap[E]) => void): void {\n\t\tthis.#listeners.get(event)?.delete(listener);\n\t}\n\n\t#setState(state: AnchorChainingPathState): void {\n\t\tthis.#state = state;\n\t\tthis.#emit('stateChange', state);\n\t}\n\n\tget logger(): Logger | undefined {\n\t\treturn(this.parent['logger']);\n\t}\n\n\t#emit<E extends keyof AnchorChainingPathEventMap>(event: E, ...args: AnchorChainingPathEventMap[E]): { sendCount: number; } {\n\t\tlet sendCount = 0;\n\n\t\tfor (const listener of (this.#listeners.get(event) ?? [])) {\n\t\t\ttry {\n\t\t\t\tlistener(...args);\n\t\t\t\tsendCount++;\n\t\t\t} catch (err) {\n\t\t\t\tthis.logger?.debug(`AnchorChainingPath::emit`, `Error in listener for event '${event}'`, err);\n\t\t\t}\n\t\t}\n\n\t\treturn({ sendCount });\n\t}\n\n\tasync #awaitStepCompletion<\n\t\tType extends StepNeededActionEventPayload['type'],\n\t\tRet extends Parameters<Extract<StepNeededActionEventPayload, { action: { type: Type }}>['markCompleted']>\n\t>(step: Pick<Extract<StepNeededActionEventPayload, { type: Type }>, 'action' | 'type'>): Promise<Ret> {\n\t\tlet didComplete = false;\n\n\t\tfunction assertDidNotComplete() {\n\t\t\tif (didComplete) {\n\t\t\t\tthrow(new Error(`Step was already marked as completed or failed`));\n\t\t\t}\n\n\t\t\tdidComplete = true;\n\t\t}\n\n\t\tlet resolveFn: undefined | StepNeededActionEventPayload['markCompleted'];\n\t\tlet rejectFn: undefined | StepNeededActionEventPayload['markFailed'];\n\n\t\tconst promise = new Promise<Ret>(function(resolve, reject) {\n\t\t\tresolveFn = (...args: Ret) => {\n\t\t\t\tassertDidNotComplete();\n\t\t\t\tresolve(args);\n\t\t\t};\n\n\t\t\trejectFn = (error) => {\n\t\t\t\tassertDidNotComplete();\n\n\t\t\t\tlet usingErr = error;\n\t\t\t\tif (!usingErr) {\n\t\t\t\t\tusingErr = new Error(`Step marked as failed without error`);\n\t\t\t\t}\n\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n\t\t\t\treject(usingErr);\n\t\t\t}\n\t\t});\n\n\t\tif (!resolveFn || !rejectFn) {\n\t\t\tthrow(new Error(`Failed to create step completion promise`));\n\t\t}\n\n\t\t// Typescript Cannot infer the correct payload type for the stepNeedsAction event, so we have to assert it here. We ensure type safety by constraining the step parameter to the correct action type, which guarantees that the payload will match the expected structure for that action type.\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\tconst { sendCount } = this.#emit('stepNeedsAction', {\n\t\t\t...step,\n\t\t\tmarkCompleted: resolveFn,\n\t\t\tmarkFailed: rejectFn\n\t\t} as Extract<StepNeededActionEventPayload, { action: { type: Type }}>);\n\n\t\tif (sendCount === 0) {\n\t\t\tthrow(new Error(`No listeners for stepNeedsAction event, but a step (actionType=${step.type}) is awaiting completion`));\n\t\t}\n\n\t\treturn(await promise);\n\t}\n\n\tasync #authorizedSend(options: Pick<AnchorChainingPathExecuteOptions, 'requireSendAuth'> | undefined, sendToAddress: string | GenericAccount, value: bigint, token: TokenAddress | string, external?: string): Promise<string | undefined> {\n\t\tif (options?.requireSendAuth) {\n\t\t\tawait this.#awaitStepCompletion({\n\t\t\t\ttype: 'keetaSendAuthRequired',\n\t\t\t\taction: {\n\t\t\t\t\tsendToAddress: KeetaNet.lib.Account.toAccount(sendToAddress),\n\t\t\t\t\tvalue,\n\t\t\t\t\ttoken: KeetaNet.lib.Account.toAccount(token).assertKeyType(KeetaNet.lib.Account.AccountKeyAlgorithm.TOKEN),\n\t\t\t\t\t...(external !== undefined ? { external } : {})\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tconst { account } = await this.getAccountsForAction({ type: 'assetMovement', providerMethod: 'initiateTransfer' }, this.#options?.overrides);\n\t\tconst published = await this.parent['client'].send(sendToAddress, value, token, external, { account });\n\t\tlet publishedBlocks;\n\t\tif ('blocks' in published) {\n\t\t\tpublishedBlocks = published.blocks;\n\t\t} else {\n\t\t\tpublishedBlocks = published.voteStaple.blocks;\n\t\t}\n\n\t\tconst sendBlock = publishedBlocks[0];\n\t\tif (sendBlock === undefined) {\n\t\t\treturn(undefined);\n\t\t}\n\n\t\treturn(sendBlock.hash.toString());\n\t}\n\n\t/**\n\t * Construct the unsigned external envelope for a user-funded KEETA_SEND.\n\t */\n\tstatic async #buildKeetaSendExternal(provider: AssetMovementProvider, transactionID: string, inputs: readonly AnchorExternalInput[]): Promise<string | undefined> {\n\t\tconst anchorKey = provider.serviceInfo.account;\n\t\tif (anchorKey === undefined) {\n\t\t\treturn(undefined);\n\t\t}\n\n\t\tconst anchor = KeetaNet.lib.Account.fromPublicKeyString(anchorKey);\n\t\tconst builder = new AnchorExternalBuilder().setAnchor(anchor, { transactionId: transactionID });\n\n\t\tfor (const input of inputs) {\n\t\t\tbuilder.addInput(input.blockHash, input.operationIndex);\n\t\t}\n\n\t\tconst external = await builder.build();\n\t\treturn(external);\n\t}\n\n\t/**\n\t * Retry policy for a single status poll.\n\t */\n\t#pollRetryOptions(\n\t\tscope: string,\n\t\tdeadline: number,\n\t\toptions?: { abortSignal?: AbortSignal; poll?: PublicRetryOptions; }\n\t): RetryOptions {\n\t\tconst remainingMs = Math.max(0, deadline - Date.now());\n\n\t\treturn({\n\t\t\t...options?.poll,\n\t\t\tmaxTotalMs: Math.min(options?.poll?.maxTotalMs ?? remainingMs, remainingMs),\n\t\t\tloggerContext: scope,\n\t\t\t...(options?.abortSignal ? { abortSignal: options.abortSignal } : {}),\n\t\t\t...(this.logger ? { logger: this.logger } : {})\n\t\t});\n\t}\n\n\tasync #pollTransferStatus(\n\t\ttransfer: AssetMovementTransfer,\n\t\tcontext: { stepIndex: number; planStep: ChainStepResolution },\n\t\toptions?: { intervalMs?: number; timeoutMs?: number; abortSignal?: AbortSignal; poll?: PublicRetryOptions; }\n\t): Promise<Awaited<ReturnType<AssetMovementTransfer['getTransferStatus']>>> {\n\t\tconst intervalMs = options?.intervalMs ?? 2000;\n\t\tconst timeoutMs = options?.timeoutMs ?? 300_000;\n\t\tconst deadline = Date.now() + timeoutMs;\n\n\t\twhile (true) {\n\t\t\tif (options?.abortSignal?.aborted) {\n\t\t\t\tthrow(new Error(`Aborted while waiting for transfer ${transfer.transferID} to complete`));\n\t\t\t}\n\n\t\t\tconst status = await withRetry(async function() {\n\t\t\t\treturn(await transfer.getTransferStatus());\n\t\t\t}, this.#pollRetryOptions('AnchorChainingPlan::pollTransferStatus', deadline, options));\n\n\t\t\tthis.#emit('transactionObserved', {\n\t\t\t\tstepIndex: context.stepIndex,\n\t\t\t\tplanStep: context.planStep,\n\t\t\t\ttransaction: status.transaction,\n\t\t\t\tsource: 'getTransferStatus'\n\t\t\t});\n\n\t\t\tif (status.transaction.status === 'COMPLETE') {\n\t\t\t\treturn(status);\n\t\t\t}\n\t\t\tif (Date.now() >= deadline) {\n\t\t\t\tthrow(new Error(`Timed out waiting for transfer ${transfer.transferID} to complete`));\n\t\t\t}\n\t\t\tawait KeetaNet.lib.Utils.Helper.asleep(intervalMs);\n\t\t}\n\t}\n\n\t/**\n\t * Wait for the forwarded transfer the bridge creates after observing the\n\t * prior step's withdraw deposit in the persistent-forwarding address.\n\t */\n\tasync #pollForwardedTransaction(\n\t\tstep: ChainStepResolutionForwarded,\n\t\tsourceTransaction: { location: AssetLocationLike; transaction: { id: string }},\n\t\tcontext: { stepIndex: number; planStep: ChainStepResolution },\n\t\toptions?: { intervalMs?: number; timeoutMs?: number; abortSignal?: AbortSignal; }\n\t): Promise<KeetaAssetMovementTransaction> {\n\t\tconst intervalMs = options?.intervalMs ?? 2000;\n\t\tconst timeoutMs = options?.timeoutMs ?? 300_000;\n\t\tconst deadline = Date.now() + timeoutMs;\n\n\t\tconst { provider, persistentAddress } = step;\n\t\tconst pfiAddress = persistentAddress.address;\n\t\tif (typeof pfiAddress !== 'string') {\n\t\t\tthrow(new Error(`Persistent forwarding address must be a resolved string`));\n\t\t}\n\n\t\tconst { account } = await this.getAccountsForAction({\n\t\t\ttype: 'assetMovement',\n\t\t\tproviderMethod: 'initiateTransfer',\n\t\t\tprovider\n\t\t}, this.#options?.overrides);\n\n\t\twhile (true) {\n\t\t\tif (options?.abortSignal?.aborted) {\n\t\t\t\tthrow(new Error(`Aborted while waiting for forwarded transaction at ${pfiAddress} correlated to source tx ${sourceTransaction.transaction.id}`));\n\t\t\t}\n\n\t\t\tlet transactions: KeetaAssetMovementTransaction[] = [];\n\t\t\ttry {\n\t\t\t\tconst response = await provider.listTransactions({\n\t\t\t\t\taccount,\n\t\t\t\t\tpersistentAddresses: [{\n\t\t\t\t\t\tlocation: step.step.from.location,\n\t\t\t\t\t\tpersistentAddress: pfiAddress\n\t\t\t\t\t}],\n\t\t\t\t\ttransactions: [ sourceTransaction ]\n\t\t\t\t});\n\n\t\t\t\ttransactions = response.transactions;\n\t\t\t} catch (error) {\n\t\t\t\tthis.logger?.debug('AnchorChainingPlan::pollForwardedTransaction', `listTransactions failed for PersistentForwardingRelay address ${pfiAddress}`, error);\n\t\t\t}\n\n\t\t\tfor (const transaction of transactions) {\n\t\t\t\tthis.#emit('transactionObserved', {\n\t\t\t\t\tstepIndex: context.stepIndex,\n\t\t\t\t\tplanStep: context.planStep,\n\t\t\t\t\ttransaction,\n\t\t\t\t\tsource: 'listTransactions'\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst candidate = transactions.find(tx => tx.status === 'COMPLETE');\n\t\t\tif (candidate) {\n\t\t\t\treturn(candidate);\n\t\t\t}\n\n\t\t\tif (Date.now() >= deadline) {\n\t\t\t\tthrow(new Error(`Timed out waiting for persistent-forwarding transaction at ${pfiAddress} correlated to source tx ${sourceTransaction.transaction.id}`));\n\t\t\t}\n\n\t\t\tawait KeetaNet.lib.Utils.Helper.asleep(intervalMs);\n\t\t}\n\t}\n\n\tasync #pollExchangeStatus(\n\t\texchange: FXExchange,\n\t\toptions?: { intervalMs?: number; timeoutMs?: number; abortSignal?: AbortSignal; poll?: PublicRetryOptions; }\n\t): Promise<Extract<Awaited<ReturnType<FXExchange['getExchangeStatus']>>, { status: 'completed' }>> {\n\t\tconst intervalMs = options?.intervalMs ?? 2000;\n\t\tconst timeoutMs = options?.timeoutMs ?? 300_000;\n\t\tconst deadline = Date.now() + timeoutMs;\n\n\t\twhile (true) {\n\t\t\tif (options?.abortSignal?.aborted) {\n\t\t\t\tthrow(new Error(`Aborted while waiting for FX exchange ${exchange.exchange.exchangeID} to complete`));\n\t\t\t}\n\n\t\t\tconst status = await withRetry(async function() {\n\t\t\t\treturn(await exchange.getExchangeStatus());\n\t\t\t}, this.#pollRetryOptions('AnchorChainingPlan::pollExchangeStatus', deadline, options));\n\n\t\t\tif (status.status === 'completed') {\n\t\t\t\treturn(status);\n\t\t\t}\n\t\t\tif (status.status === 'failed') {\n\t\t\t\tthrow(new Error(`FX exchange ${exchange.exchange.exchangeID} failed`));\n\t\t\t}\n\t\t\tif (Date.now() >= deadline) {\n\t\t\t\tthrow(new Error(`Timed out waiting for FX exchange ${exchange.exchange.exchangeID} to complete`));\n\t\t\t}\n\n\t\t\tawait KeetaNet.lib.Utils.Helper.asleep(intervalMs);\n\t\t}\n\t}\n\n\tasync execute(options?: AnchorChainingPathExecuteOptions): Promise<AnchorChainingPathExecuteResult> {\n\t\tif (this.#options?.forwardingOnly) {\n\t\t\tthrow(new Error('Forwarding-only plans cannot be executed. Use getPlans({ forwardingOnly: true }), which returns AnchorChainingForwardingOnlyPlan, and fund the deposit address externally.'));\n\t\t}\n\n\t\tif (this.#state.status !== 'idle') {\n\t\t\tthrow(new Error(`Cannot execute: path is already in state \"${this.#state.status}\"`));\n\t\t}\n\n\t\tconst executedSteps: ExecutedStep[] = [];\n\t\tthis.#setState({ status: 'executing', completedSteps: [], currentStepIndex: 0 });\n\n\t\t/*\n\t\t * Actual output value from each completed step, used for equality checking.\n\t\t */\n\t\tlet prevActualValueOut: bigint | null = null;\n\n\t\t/**\n\t\t * Source-tx anchor for the next forwarded step's poll. Populated only\n\t\t * when the prior step is an asset-movement transfer that produced a\n\t\t * withdraw transaction on its destination chain; reset for any step\n\t\t * type that cannot deposit into a persistent-forwarding address.\n\t\t */\n\t\tlet prevWithdrawTx: { location: AssetLocationLike; transaction: { id: string }} | null = null;\n\n\t\t/*\n\t\t * On-chain operations this execution has published so far. Deferred\n\t\t * initiations forward these as the external envelope's inputs so the\n\t\t * anchor's signed envelope references the prior steps' operations.\n\t\t */\n\t\tconst publishedInputs: AnchorExternalInput[] = [];\n\t\tlet index = 0;\n\t\ttry {\n\t\t\tfor (index = 0; index < this.plan.steps.length; index++) {\n\t\t\t\tif (options?.abortSignal?.aborted) {\n\t\t\t\t\tthrow(new Error(`Execution aborted`));\n\t\t\t\t}\n\n\t\t\t\tconst onStepCompleted = (step: ExecutedStep) => {\n\t\t\t\t\texecutedSteps.push(step);\n\t\t\t\t\tthis.#emit('stepExecuted', step, index);\n\t\t\t\t}\n\n\t\t\t\tthis.#setState({ status: 'executing', completedSteps: [...executedSteps], currentStepIndex: index });\n\n\t\t\t\tconst step = this.plan.steps[index];\n\n\t\t\t\tif (!step) {\n\t\t\t\t\tthrow(new Error(`Step ${index} is not defined`));\n\t\t\t\t}\n\n\t\t\t\tconst pollContext = { stepIndex: index, planStep: step };\n\n\t\t\t\t// Verify the actual output from the previous step matches the expected\n\t\t\t\t// input for this step. A mismatch indicates a provider delivered a\n\t\t\t\t// different amount than was negotiated in computeSteps.\n\t\t\t\tif (index > 0 && prevActualValueOut !== null) {\n\t\t\t\t\tif (prevActualValueOut !== step.valueIn) {\n\t\t\t\t\t\tif (prevActualValueOut < step.valueIn) {\n\t\t\t\t\t\t\tthrow(new Error(`Execution failed at step ${index} due to value mismatch: expected at least ${step.valueIn} but previous step produced ${prevActualValueOut}`));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.logger?.debug(`AnchorChainingPlan::execute`, `Value mismatch at step ${index} is non-critical since previous step produced more (${prevActualValueOut}) than expected (${step.valueIn}), proceeding with execution`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (step.type === 'fx') {\n\t\t\t\t\tconst exchange = await step.result.createExchange(undefined, { inputs: [...publishedInputs] });\n\t\t\t\t\tconst exchangeStatus = await this.#pollExchangeStatus(exchange, options);\n\n\t\t\t\t\tpublishedInputs.push({ blockHash: exchangeStatus.blockhash });\n\n\t\t\t\t\tprevActualValueOut = step.valueOut;\n\t\t\t\t\tprevWithdrawTx = null;\n\t\t\t\t\tonStepCompleted({ type: 'fx', plan: step, exchange });\n\t\t\t\t} else if (step.type === 'forwarded') {\n\t\t\t\t\tif (!prevWithdrawTx) {\n\t\t\t\t\t\tthrow(new Error(`Forwarded step at index ${index} requires the prior step to produce a withdraw transaction on its destination chain`));\n\t\t\t\t\t}\n\n\t\t\t\t\tconst observed = await this.#pollForwardedTransaction(step, prevWithdrawTx, pollContext, options);\n\t\t\t\t\tprevActualValueOut = BigInt(observed.to.value);\n\t\t\t\t\tprevWithdrawTx = null;\n\t\t\t\t\tonStepCompleted({ type: 'forwarded', plan: step, observedTransaction: observed });\n\t\t\t\t} else if (step.type === 'assetMovement' || step.type === 'keetaSend') {\n\t\t\t\t\tif (step.usingInstruction.type === 'KEETA_SEND') {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * Prefer the anchor-provided external. When absent,\n\t\t\t\t\t\t * construct the unsigned correlation envelope locally,\n\t\t\t\t\t\t * referencing the prior steps' on-chain operations.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tlet external = step.usingInstruction.external;\n\t\t\t\t\t\tif (external === undefined && step.type === 'assetMovement') {\n\t\t\t\t\t\t\texternal = await AnchorChainingPlan.#buildKeetaSendExternal(step.provider, step.transfer.transferID, publishedInputs);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst sentBlockHash = await this.#authorizedSend(\n\t\t\t\t\t\t\toptions,\n\t\t\t\t\t\t\tstep.usingInstruction.sendToAddress,\n\t\t\t\t\t\t\tBigInt(step.usingInstruction.value),\n\t\t\t\t\t\t\tKeetaNet.lib.Account.fromPublicKeyString(step.usingInstruction.tokenAddress).assertKeyType(KeetaNet.lib.Account.AccountKeyAlgorithm.TOKEN),\n\t\t\t\t\t\t\texternal\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (sentBlockHash !== undefined) {\n\t\t\t\t\t\t\tpublishedInputs.push({ blockHash: sentBlockHash, operationIndex: 0 });\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (index === 0) {\n\t\t\t\t\t\tif (step.type !== 'assetMovement') {\n\t\t\t\t\t\t\tthrow(new Error(`Unexpected asset movement step at index ${index} for user-initiated transfer`));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tawait this.#awaitStepCompletion({\n\t\t\t\t\t\t\ttype: 'assetMovementUserExecutionRequired',\n\t\t\t\t\t\t\taction: {\n\t\t\t\t\t\t\t\tassetMovementTransfer: step.transfer\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t} else if (step.usingInstruction.type === 'EVM_SEND') {\n\t\t\t\t\t\t/* For EVM Sends for now we assume the last step sent to this address */\n\t\t\t\t\t\tthis.logger?.debug(`AnchorChainingPlan::execute`, `Executing EVM_SEND instruction for step ${index} by sending to address ${step.usingInstruction.sendToAddress} with value ${step.usingInstruction.value} and token ${step.usingInstruction.tokenAddress}`);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow(new Error(`Unsupported instruction type ${step.usingInstruction.type} for user-initiated transfer at step ${index}`));\n\t\t\t\t\t}\n\n\t\t\t\t\tif (step.type === 'assetMovement') {\n\t\t\t\t\t\tconst status = await this.#pollTransferStatus(step.transfer, pollContext, options);\n\t\t\t\t\t\tprevActualValueOut = BigInt(status.transaction.to.value);\n\t\t\t\t\t\tconst withdraw = status.transaction.to.transactions.withdraw;\n\t\t\t\t\t\tif (withdraw) {\n\t\t\t\t\t\t\tprevWithdrawTx = {\n\t\t\t\t\t\t\t\tlocation: step.step.to.location,\n\t\t\t\t\t\t\t\ttransaction: { id: withdraw.id }\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tprevWithdrawTx = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonStepCompleted({ type: 'assetMovement', plan: step });\n\t\t\t\t\t} else if (step.type === 'keetaSend') {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * Direct Keeta send: optimistically treat as completed since\n\t\t\t\t\t\t * there is no provider transfer to poll. Cannot feed a forwarded\n\t\t\t\t\t\t * step because it does not produce a bridge withdraw.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprevActualValueOut = step.valueIn;\n\t\t\t\t\t\tprevWithdrawTx = null;\n\t\t\t\t\t\tonStepCompleted({ type: 'keetaSend', plan: step });\n\t\t\t\t\t} else {\n\t\t\t\t\t\tassertNever(step);\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\t\t\t\t\tassertNever(step);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Direct same-location/same-asset send: the loop ran zero iterations,\n\t\t\t// so just publish the on-chain transfer directly.\n\t\t\tif (this.path.length === 0) {\n\t\t\t\tconst sendValue = this.request.source.value ?? this.request.destination.value;\n\t\t\t\tif (!sendValue) {\n\t\t\t\t\tthrow(new Error(`Direct send requires a value for source or destination`));\n\t\t\t\t}\n\n\t\t\t\tif (!KeetaNet.lib.Account.isInstance(this.request.source.asset)) {\n\t\t\t\t\tthrow(new Error(`Direct send requires a Keeta token address as the source asset`));\n\t\t\t\t}\n\t\t\t\tconst recipient = this.request.destination.recipient;\n\t\t\t\tif (typeof recipient !== 'string') {\n\t\t\t\t\tthrow(new Error(`Direct Keeta send requires a crypto address as the recipient`));\n\t\t\t\t}\n\t\t\t\tawait this.#authorizedSend(options, recipient, sendValue, this.request.source.asset);\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tconst error = err instanceof Error ? err : new Error(String(err));\n\t\t\tthis.#setState({ status: 'failed', error, completedSteps: [...executedSteps], failedAtStepIndex: index });\n\t\t\tthis.#emit('failed', error, [...executedSteps], index);\n\t\t\tthrow(error);\n\t\t}\n\n\t\tconst result: AnchorChainingPathExecuteResult = { steps: executedSteps };\n\t\tthis.#setState({ status: 'completed', result });\n\t\tthis.#emit('completed', result);\n\t\treturn(result);\n\t}\n}\n\n/**\n * Forwarding-only chaining plan for persistent-forwarding routes. Resolves deposit\n * addresses and fee estimates but cannot be executed: the user funds the\n * external deposit address directly.\n */\nexport class AnchorChainingForwardingOnlyPlan extends AnchorChainingPath {\n\treadonly #plan: AnchorChainingPathComputedPlan;\n\n\tprivate constructor(path: AnchorChainingPath, plan: AnchorChainingPathComputedPlan) {\n\t\tsuper({ request: path.request, path: path.path, parent: path.parent });\n\t\tthis.#plan = plan;\n\t}\n\n\tget plan(): AnchorChainingPathComputedPlan {\n\t\treturn(this.#plan);\n\t}\n\n\tgetDepositAddress(): string | null {\n\t\treturn(getForwardingDepositAddress(this));\n\t}\n\n\tlistFees(): AnchorChainingPlanFeeBreakdown {\n\t\treturn(listChainingPlanFees(this));\n\t}\n\n\t/**\n\t * Always validated as forwarding-only, since that is the only mode this\n\t * class is ever computed under.\n\t */\n\toverride validate(options?: AnchorChainingPathValidateOptions): AnchorChainingPathValidationResult {\n\t\treturn(super.validate({ ...options, forwardingOnly: true }));\n\t}\n\n\tstatic async create(path: AnchorChainingPath, options?: ComputePlanOptions): Promise<AnchorChainingForwardingOnlyPlan> {\n\t\tconst computed = await AnchorChainingPlan.create(path, { ...options, forwardingOnly: true });\n\t\tif (!isForwardingPlan(computed)) {\n\t\t\tthrow(new Error('Computed plan does not qualify as a forwarding-only route'));\n\t\t}\n\n\t\treturn(new AnchorChainingForwardingOnlyPlan(path, computed.plan));\n\t}\n}\n\ntype AnchorPlanPathError = { success: false; error: unknown; failedAt: { providerID: string | null; }};\ntype AnchorChainingFullPlanResult = (({ success: true; plan: AnchorChainingPlan; } | AnchorPlanPathError) & { path: AnchorChainingPath; });\ntype AnchorChainingFullForwardingOnlyPlanResult = (({ success: true; plan: AnchorChainingForwardingOnlyPlan; } | AnchorPlanPathError) & { path: AnchorChainingPath; });\n\nexport class AnchorChaining {\n\tprivate client: KeetaNet.UserClient;\n\tprivate resolver: Resolver;\n\treadonly graph: AnchorGraph;\n\tprivate logger?: Logger;\n\n\tconstructor(config: AnchorChainingConfig) {\n\t\tthis.client = config.client;\n\t\tif (config.resolver) {\n\t\t\tthis.resolver = config.resolver;\n\t\t} else {\n\t\t\tthis.resolver = getDefaultResolver(config.client);\n\t\t}\n\t\tthis.graph = new AnchorGraph({ resolver: this.resolver, client: this.client, logger: config.logger });\n\t\tif (config.logger !== undefined) {\n\t\t\tthis.logger = config.logger;\n\t\t}\n\t}\n\n\tasync getPaths(input: AnchorChainingPathInput, options?: AnchorChainingFindPathsOptions): Promise<AnchorChainingPath[] | null> {\n\t\tconst forwardingOpts = normalizeForwardingOnlyOptions(options?.forwardingOnly);\n\t\tif (forwardingOpts && (forwardingOpts.maxLegs ?? DEFAULT_FORWARDING_MAX_LEGS) < 1) {\n\t\t\treturn(null);\n\t\t}\n\n\t\t// Direct send: same Keeta location, same asset, same rail no providers needed.\n\t\tconst sourceLocation = toAssetLocation(input.source.location);\n\t\tconst destinationLocation = toAssetLocation(input.destination.location);\n\n\t\tlet foundPaths: AnchorChainingStepLike[][] | null = null;\n\n\t\tif (\n\t\t\tinput.source.rail === 'KEETA_SEND' &&\n\t\t\tinput.destination.rail === 'KEETA_SEND' &&\n\t\t\tconvertAssetLocationToString(sourceLocation) === convertAssetLocationToString(destinationLocation) &&\n\t\t\tisChainLocation(sourceLocation, 'keeta') &&\n\t\t\tisChainLocation(destinationLocation, 'keeta') &&\n\t\t\tisAnchorChainingAssetEqual(input.source.asset, input.destination.asset)\n\t\t) {\n\t\t\t// Direct Keeta sends are never forwarding routes.\n\t\t\tif (forwardingOpts) {\n\t\t\t\treturn(null);\n\t\t\t}\n\n\t\t\tconst fromTo = {\n\t\t\t\tasset: input.source.asset,\n\t\t\t\tlocation: sourceLocation,\n\t\t\t\trail: 'KEETA_SEND'\n\t\t\t} as const;\n\n\t\t\tfoundPaths = [\n\t\t\t\t[{ type: 'keetaSend', from: fromTo, to: fromTo }]\n\t\t\t];\n\t\t} else {\n\t\t\tfoundPaths = await this.graph.findPaths(input, options);\n\t\t}\n\n\t\t// Filter out paths with non-chain steps in intermediate positions\n\t\tfoundPaths = foundPaths?.filter(path => {\n\t\t\tfor (let i = 0; i < path.length - 1; i++) {\n\t\t\t\tconst item = path[i];\n\t\t\t\tif (!item) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst toLocation = toAssetLocation(item.to.location);\n\t\t\t\tif (toLocation.type !== 'chain' && i < path.length - 1) {\n\t\t\t\t\treturn(false);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn(true);\n\t\t});\n\n\t\tif (foundPaths.length === 0) {\n\t\t\treturn(null);\n\t\t}\n\n\t\tconst retval: AnchorChainingPath[] = [];\n\n\t\tfor (const path of foundPaths) {\n\t\t\tretval.push(new AnchorChainingPath({ request: input, path, parent: this }));\n\t\t}\n\n\t\tif (forwardingOpts) {\n\t\t\tconst forwardingPaths = retval.filter((path) => isForwardingPath(path, forwardingOpts));\n\t\t\treturn(forwardingPaths.length === 0 ? null : forwardingPaths);\n\t\t}\n\n\t\treturn(retval);\n\t}\n\n\tasync getPlans(input: AnchorChainingPathInput, options: GetPlansOptions & { includeAllOutput: true; forwardingOnly: true | ForwardingOnlyOptions }): Promise<AnchorChainingFullForwardingOnlyPlanResult[] | null>;\n\tasync getPlans(input: AnchorChainingPathInput, options: GetPlansOptions & { includeAllOutput: true; forwardingOnly?: false; }): Promise<AnchorChainingFullPlanResult[] | null>;\n\tasync getPlans(input: AnchorChainingPathInput, options: GetPlansOptions & { includeAllOutput?: false; forwardingOnly: true | ForwardingOnlyOptions }): Promise<AnchorChainingForwardingOnlyPlan[] | null>;\n\tasync getPlans(input: AnchorChainingPathInput, options?: GetPlansOptions): Promise<AnchorChainingPlan[] | null>;\n\tasync getPlans(input: AnchorChainingPathInput, options?: GetPlansOptions): Promise<(AnchorChainingPlan | AnchorChainingForwardingOnlyPlan | AnchorChainingFullPlanResult | AnchorChainingFullForwardingOnlyPlanResult)[] | null> {\n\t\tconst forwardingOpts = normalizeForwardingOnlyOptions(options?.forwardingOnly);\n\t\tconst paths = await this.getPaths(input, {\n\t\t\t...(options?.forwardingOnly ? { forwardingOnly: options.forwardingOnly } : {}),\n\t\t\t...(options?.maxPathLength !== undefined ? { maxPathLength: options.maxPathLength } : {})\n\t\t});\n\n\t\tif (!paths) {\n\t\t\treturn(null);\n\t\t}\n\n\t\tconst limit = options?.limit ?? 3;\n\n\t\tconst sortedPaths = paths.sort((a, b) => a.path.length - b.path.length);\n\n\t\tlet successCount = 0;\n\t\tlet lowestStepsSuccessCount = Infinity;\n\t\tlet lastAttemptedPathIdx = -1;\n\n\t\tconst maxAttemptLoops = 3;\n\t\tlet currentAttemptLoop = 0;\n\n\t\tconst allOutput: PromiseSettledResult<AnchorChainingPlan | AnchorChainingForwardingOnlyPlan>[] = [];\n\n\t\twhile (successCount < limit && lastAttemptedPathIdx < sortedPaths.length - 1 && currentAttemptLoop < maxAttemptLoops) {\n\t\t\tcurrentAttemptLoop++;\n\n\t\t\tconst pathsToTry = sortedPaths.slice(lastAttemptedPathIdx + 1, lastAttemptedPathIdx + 1 + (limit - successCount));\n\n\t\t\tif (pathsToTry.length === 0 || !pathsToTry[0]) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (pathsToTry[0].path.length > lowestStepsSuccessCount) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst currentTry = await Promise.allSettled(pathsToTry.map(async function(path) {\n\t\t\t\tconst computeOptions = toComputePlanOptions(options, forwardingOpts);\n\t\t\t\tif (forwardingOpts) {\n\t\t\t\t\treturn(await AnchorChainingForwardingOnlyPlan.create(path, computeOptions));\n\t\t\t\t}\n\n\t\t\t\treturn(await AnchorChainingPlan.create(path, computeOptions));\n\t\t\t}));\n\n\t\t\tallOutput.push(...currentTry);\n\n\t\t\tfor (let i = 0; i < currentTry.length; i++) {\n\t\t\t\tconst result = currentTry[i];\n\t\t\t\tconst path = pathsToTry[i];\n\n\t\t\t\tif (!result || !path) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (result.status === 'fulfilled') {\n\t\t\t\t\tconst qualifies = !forwardingOpts || isForwardingPlan(result.value);\n\t\t\t\t\tif (qualifies) {\n\t\t\t\t\t\tsuccessCount++;\n\t\t\t\t\t\tif (path && path.path.length < lowestStepsSuccessCount) {\n\t\t\t\t\t\t\tlowestStepsSuccessCount = path.path.length;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlastAttemptedPathIdx += pathsToTry.length;\n\t\t}\n\n\t\tconst ret: (AnchorChainingPlan | AnchorChainingForwardingOnlyPlan | AnchorChainingFullPlanResult | AnchorChainingFullForwardingOnlyPlanResult)[] = [];\n\n\t\tfor (let i = 0; i < allOutput.length; i++) {\n\t\t\tconst path = sortedPaths[i];\n\t\t\tconst plan = allOutput[i];\n\n\t\t\tif (!path || !plan) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (options?.includeAllOutput) {\n\t\t\t\tif (plan.status === 'rejected') {\n\t\t\t\t\tret.push({\n\t\t\t\t\t\t...(AnchorChainingPlanCreateError.resolveErrorResponse(plan.reason)),\n\t\t\t\t\t\tpath\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tconst isForwardingPlanResult = isForwardingPlan(plan.value);\n\t\t\t\t\tif (forwardingOpts && !isForwardingPlanResult.isForwardingOnly) {\n\t\t\t\t\t\tret.push({ success: false, error: new Error('Plan does not qualify as a forwarding-only route'), path, failedAt: { providerID: isForwardingPlanResult.providerID }});\n\t\t\t\t\t} else if (plan.value instanceof AnchorChainingForwardingOnlyPlan) {\n\t\t\t\t\t\tret.push({ success: true, plan: plan.value, path });\n\t\t\t\t\t} else if (plan.value instanceof AnchorChainingPlan) {\n\t\t\t\t\t\tret.push({ success: true, plan: plan.value, path });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (plan.status === 'rejected') {\n\t\t\t\t\tthis.logger?.debug(`AnchorChaining::getPlans`, `Error computing plan for a path:`, plan.reason);\n\t\t\t\t} else if (forwardingOpts && !isForwardingPlan(plan.value).isForwardingOnly) {\n\t\t\t\t\tthis.logger?.debug(`AnchorChaining::getPlans`, `Skipping plan that does not qualify as forwarding-only`);\n\t\t\t\t} else {\n\t\t\t\t\tret.push(plan.value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (forwardingOpts && !options?.includeAllOutput && ret.length === 0) {\n\t\t\treturn(null);\n\t\t}\n\n\t\treturn(ret);\n\t}\n}\n"]}
1
+ {"version":3,"file":"chaining.js","sourceRoot":"","sources":["../../src/lib/chaining.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,+BAA+B,CAAC;AAE1D,OAAO,EAAE,4BAA4B,EAAE,kCAAkC,EAAE,oBAAoB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAEhL,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAE3F,OAAO,EAAE,UAAU,EAAE,6BAA6B,EAAE,MAAM,EAAE,MAAM,gDAAgD,CAAC;AACnH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,SAAS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IAAI,EAAE,CAAC,CAAC;oBACrD,CAAC;gBACF,CAAC;YACF,CAAC;iBAAM,CAAC;gBACP,IAAI,IAAI,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;oBAChC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,0BAA0B,EAAE,kCAAkC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;gBACjG,CAAC;qBAAM,IAAI,cAAc,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,gBAAgB,EAAE,CAAC;oBAC7E,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,0BAA0B,EAAE,wDAAwD,CAAC,CAAC;gBAC1G,CAAC;qBAAM,CAAC;oBACP,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACtB,CAAC;YACF,CAAC;QACF,CAAC;QAED,IAAI,cAAc,IAAI,CAAC,OAAO,EAAE,gBAAgB,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtE,OAAM,CAAC,IAAI,CAAC,CAAC;QACd,CAAC;QAED,OAAM,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;CACD","sourcesContent":["import type { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';\nimport * as KeetaNet from \"@keetanetwork/keetanet-client\";\nimport type { AnchorTokenLocationMetadata, AssetLocationLike, AssetFeeBreakdown, AssetFeeLineItemType, AssetTransferInstructions, AssetWithRails, FiatPushRails, KeetaAssetMovementTransaction, KeetaPersistentForwardingAddressDetails, MovableAssetSearchCanonical, PersistentAddressAssetFeeBreakdown, PickChainLocation, Rail, RailOrRailWithExtendedDetails, RecipientResolved, ResolvedFeeLineItem, SimulatedAssetTransferInstructions, UnresolvedFeeLineItem, AssetOrAssetWithLocation } from \"../services/asset-movement/common.js\";\nimport { convertAssetLocationToString, convertAssetSearchInputToCanonical, doesAssetOrPairMatch, isChainLocation, toAssetLocation } from \"../services/asset-movement/common.js\";\nimport type { Resolver } from \"./index.js\";\nimport { getDefaultResolver } from '../config.js';\nimport type { ISOCurrencyCode } from '@keetanetwork/currency-info';\nimport { Currency } from '@keetanetwork/currency-info';\nimport type { Account, GenericAccount, TokenAddress } from '@keetanetwork/keetanet-client/lib/account.js';\nimport { isAssetLocationLike } from '../services/asset-movement/lib/location.generated.js';\nimport type { ToValuizable } from './resolver.js';\nimport { isFiatRail, isMovableAssetSearchCanonical, isRail } from '../services/asset-movement/common.generated.js';\nimport { assertNever } from './utils/never.js';\nimport { withRetry } from './utils/retry.js';\nimport type { PublicRetryOptions, RetryOptions } from './utils/retry.js';\nimport KeetaFXAnchorClient from '../services/fx/client.js';\nimport KeetaAssetMovementAnchorClient from '../services/asset-movement/client.js';\nimport type { ExternalChainAsset, EVMChecksumCache } from './asset.js';\nimport { isExternalChainAsset, isMovableAssetEqual } from './asset.js';\nimport type { Logger } from './log/index.js';\nimport type { BlockHash } from '@keetanetwork/keetanet-client/lib/block/index.js';\nimport type { AnchorExternalInput } from './anchor-external.js';\nimport type { AnchorMetadataLegalField } from './metadata.types.js';\nimport type { ClientRenderableContent } from './metadata.types.js';\nimport { AnchorExternalBuilder } from './anchor-external.js';\nimport { KeetaAnchorError } from './error.js';\n\ntype FXQuoteOrEstimate = NonNullable<Awaited<ReturnType<KeetaFXAnchorClient['getQuotesOrEstimates']>>>[number];\ntype AssetMovementProvider = NonNullable<Awaited<ReturnType<KeetaAssetMovementAnchorClient['getProvidersForTransfer']>>>[number];\ntype AssetMovementTransfer = Awaited<ReturnType<AssetMovementProvider['initiateTransfer']>>;\ntype FXExchange = Awaited<ReturnType<FXQuoteOrEstimate['createExchange']>>;\n\ninterface ChainStepResolutionBase<Type extends 'fx' | 'assetMovement' | 'keetaSend' | 'forwarded'> {\n\ttype: Type;\n\tvalueIn: bigint;\n\tvalueOut: bigint;\n\tstep: Type extends 'keetaSend' ? null : (\n\t\tType extends 'forwarded' ? AssetMovementGraphNode : Extract<GraphNodeLike, { type: Type }>\n\t);\n}\n\ninterface ChainStepResolutionFX extends ChainStepResolutionBase<'fx'> {\n\ttype: 'fx';\n\tresult: FXQuoteOrEstimate;\n};\n\ntype SendingToType = 'SELF' | 'NEXT_STEP' | 'FINAL_DESTINATION';\n\ninterface ChainStepResolutionAssetMovement extends ChainStepResolutionBase<'assetMovement'> {\n\tusingInstruction: AssetTransferInstructions;\n\tsendingTo: SendingToType;\n\ttransfer: AssetMovementTransfer;\n\tprovider: AssetMovementProvider;\n};\n\ninterface ChainStepResolutionKeetaSend extends ChainStepResolutionBase<'keetaSend'> {\n\tusingInstruction: Extract<AssetTransferInstructions, { type: 'KEETA_SEND' }>;\n};\n\ninterface ChainStepResolutionForwarded extends ChainStepResolutionBase<'forwarded'> {\n\tpersistentAddress: KeetaPersistentForwardingAddressDetails;\n\tprovider: AssetMovementProvider;\n\t/** Present when simulateTransfer succeeded during plan computation (non-forwardingOnly). */\n\tsimulatedTransfer?: Awaited<ReturnType<AssetMovementProvider['simulateTransfer']>>;\n};\n\nexport type Disclaimer = Exclude<AnchorMetadataLegalField['disclaimers'], undefined>[number];\ntype ProviderDisclaimers = {\n\tproviderID: string;\n\tdisclaimers: Disclaimer[];\n}\ntype PlanDisclaimers = ProviderDisclaimers[];\n\nexport type ChainStepResolution = ChainStepResolutionFX | ChainStepResolutionAssetMovement | ChainStepResolutionKeetaSend | ChainStepResolutionForwarded;\n\ntype AnchorChainingPathComputedPlan = {\n\tsteps: ChainStepResolution[];\n\ttotalValueIn: bigint;\n\ttotalValueOut: bigint;\n};\n\ntype ExecutedStepFX = {\n\ttype: 'fx';\n\tplan: ChainStepResolutionFX;\n\texchange: FXExchange;\n};\n\ntype ExecutedStepAssetMovement = {\n\ttype: 'assetMovement';\n\tplan: ChainStepResolutionAssetMovement;\n};\n\ntype ExecutedStepKeetaSend = {\n\ttype: 'keetaSend';\n\tplan: ChainStepResolutionKeetaSend;\n};\n\ntype ExecutedStepForwarded = {\n\ttype: 'forwarded';\n\tplan: ChainStepResolutionForwarded;\n\tobservedTransaction: KeetaAssetMovementTransaction;\n};\n\n\nexport type ExecutedStep = ExecutedStepFX | ExecutedStepAssetMovement | ExecutedStepKeetaSend | ExecutedStepForwarded;\n\nexport type AnchorChainingPathExecuteResult = {\n\tsteps: ExecutedStep[];\n};\n\nexport type AnchorChainingPathExecuteOptions = {\n\trequireSendAuth?: boolean;\n\tabortSignal?: AbortSignal;\n\tpoll?: PublicRetryOptions;\n};\n\nexport type AnchorChainingPathState =\n\t| { status: 'idle' }\n\t| { status: 'executing'; completedSteps: ExecutedStep[]; currentStepIndex: number }\n\t| { status: 'completed'; result: AnchorChainingPathExecuteResult }\n\t| { status: 'failed'; error: Error; completedSteps: ExecutedStep[]; failedAtStepIndex: number };\n\ninterface StepNeededActionEventPayloadBase<ActionType, ActionPayload, CompletedPayload extends readonly unknown[] = []> {\n\ttype: ActionType;\n\n\tmarkCompleted: (...args: CompletedPayload) => void;\n\tmarkFailed: (error?: unknown) => void;\n\n\taction: ActionPayload;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\ninterface StepNeededActionEventAssetMovement extends StepNeededActionEventPayloadBase<'assetMovementUserExecutionRequired', { assetMovementTransfer: AssetMovementTransfer; }, []> {}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\ninterface StepNeededActionEventKeetaSend extends StepNeededActionEventPayloadBase<'keetaSendAuthRequired', {\n\tsendToAddress: GenericAccount;\n\tvalue: bigint;\n\ttoken: TokenAddress;\n\texternal?: string;\n}, [ { sent: boolean | BlockHash; }]> {}\n\ntype StepNeededActionEventPayload = StepNeededActionEventKeetaSend | StepNeededActionEventAssetMovement;\n\ntype AnchorChainingPathEventMap = {\n\tstateChange: [state: AnchorChainingPathState];\n\tstepExecuted: [step: ExecutedStep, index: number];\n\tcompleted: [result: AnchorChainingPathExecuteResult];\n\tfailed: [error: Error, completedSteps: ExecutedStep[], failedAtStepIndex: number];\n\tstepNeedsAction: [StepNeededActionEventPayload];\n\ttransactionObserved: [payload: AnchorChainingTransactionObservedEvent];\n}\n\nexport type AnchorChainingTransactionObservedSource = 'getTransferStatus' | 'listTransactions';\n\nexport type AnchorChainingTransactionObservedEvent = {\n\tstepIndex: number;\n\tplanStep: ChainStepResolution;\n\ttransaction: KeetaAssetMovementTransaction;\n\tsource: AnchorChainingTransactionObservedSource;\n};\n\ninterface RailSupportedOperations {\n\tcreatePersistentForwarding?: boolean;\n\tinitiateTransfer?: boolean;\n\tsimulateTransfer?: boolean;\n}\n\ninterface RailWithSupportedOperations {\n\trail: Rail;\n\tsupportedOperations?: RailSupportedOperations;\n}\n\ninterface AnchorChainingAssetAndLocation<AssetType extends AnchorChainingAsset = AnchorChainingAsset, Location extends AssetLocationLike = AssetLocationLike> {\n\tasset: AssetType;\n\tlocation: Location;\n\trail: Rail;\n\tsupportedOperations?: RailSupportedOperations;\n\tvalue?: bigint;\n\n}\n\ninterface AnchorChainingDestination extends AnchorChainingAssetAndLocation {\n\trecipient: RecipientResolved;\n}\n\nexport interface AnchorChainingPathInput {\n\tsource: AnchorChainingAssetAndLocation;\n\tdestination: AnchorChainingDestination;\n}\n\nexport interface AnchorChainingConfig {\n\tclient: KeetaNet.UserClient;\n\tresolver?: Resolver;\n\tsigner?: InstanceType<typeof KeetaNetLib.Account>;\n\taccount?: InstanceType<typeof KeetaNetLib.Account>;\n\tlogger?: Logger;\n}\n\ninterface BaseGraphNodeLike<Type extends 'fx' | 'assetMovement', AssetType extends AnchorChainingAsset> {\n\ttype: Type;\n\tproviderID: string;\n\n\tfrom: AnchorChainingAssetAndLocation<AssetType>;\n\tto: AnchorChainingAssetAndLocation<AssetType>;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\ninterface FXGraphNode extends BaseGraphNodeLike<'fx', Exclude<AnchorChainingAsset, ExternalChainAsset>> {}\ninterface AssetMovementGraphNode extends BaseGraphNodeLike<'assetMovement', AnchorChainingAsset> {\n\t/**\n\t * Operations the provider itself publishes, independent of any rail-specific\n\t * declaration. Mirrors what `provider.isOperationSupported()` answers at plan\n\t * time, so a pure validation can reach the same verdict as computing a plan.\n\t *\n\t * Distinct from the per-side `supportedOperations`, which describes one rail\n\t * and is absent for providers that publish no rail-level detail.\n\t */\n\tproviderOperations?: RailSupportedOperations;\n}\nexport type GraphNodeLike = FXGraphNode | AssetMovementGraphNode;\n\ntype KeetaLocationLike = Extract<AssetLocationLike, `chain:keeta:${bigint}`> | PickChainLocation<'keeta'>;\ninterface KeetaSendStepLike {\n\ttype: 'keetaSend';\n\n\tproviderID?: null;\n\n\tfrom: AnchorChainingAssetAndLocation<AnchorChainingAsset, KeetaLocationLike>;\n\tto: AnchorChainingAssetAndLocation<AnchorChainingAsset, KeetaLocationLike>;\n}\n\nexport type AnchorChainingStepLike = GraphNodeLike | KeetaSendStepLike;\n\nexport type AnchorChainingAsset = TokenAddress | ISOCurrencyCode | ExternalChainAsset;\n\nfunction isAnchorChainingAssetEqual(a: AnchorChainingAsset, b: AnchorChainingAsset): boolean {\n\treturn(isMovableAssetEqual(a, b));\n}\n\n/**\n * Returns true for nodes that keep assets on Keeta: FX nodes, plus\n * asset-movement nodes whose from and to share the same Keeta chain location\n * (custodial FX anchors that don't actually move funds off-chain).\n */\nfunction isFXLikeNode(node: GraphNodeLike): boolean {\n\tif (node.type === 'fx') {\n\t\treturn(true);\n\t}\n\tconst fromStr = convertAssetLocationToString(node.from.location);\n\tconst toStr = convertAssetLocationToString(node.to.location);\n\treturn(fromStr === toStr && fromStr.startsWith('chain:keeta:'));\n}\n\n\ninterface AssetMovementResolvedRails {\n\tcommon: RailWithSupportedOperations[];\n\tinbound: RailWithSupportedOperations[];\n\toutbound: RailWithSupportedOperations[];\n}\n\nexport type AnchorChainingListAssetsSideFilter = {\n\tlocation?: AssetLocationLike | undefined;\n\tasset?: AnchorChainingAsset | undefined;\n\trail?: Rail | undefined;\n};\n\ntype AnchorChainingListAssetsShared = {\n\tmaxStepCount?: number;\n\tonlyAllowFXLike?: boolean;\n};\n\nexport type AnchorChainingListAssetsFilter =\n\t| ({ from: AnchorChainingListAssetsSideFilter; to?: never } & AnchorChainingListAssetsShared)\n\t| ({ to: AnchorChainingListAssetsSideFilter; from?: never } & AnchorChainingListAssetsShared)\n\t| ({ from?: never; to?: never } & AnchorChainingListAssetsShared);\n\nexport type ForwardingOnlyMethod = 'explicit' | 'implied';\n\nexport type ForwardingOnlyOptions = {\n\tmethod: ForwardingOnlyMethod;\n\t/** Max asset-movement legs (default 2, matching deposit UX). */\n\tmaxLegs?: number;\n};\n\nconst DEFAULT_FORWARDING_MAX_LEGS = 2;\n\nfunction normalizeForwardingOnlyOptions(forwardingOnly: boolean | ForwardingOnlyOptions | undefined): ForwardingOnlyOptions | undefined {\n\tif (!forwardingOnly) {\n\t\treturn(undefined);\n\t}\n\n\tif (forwardingOnly === true) {\n\t\treturn({ method: 'explicit', maxLegs: DEFAULT_FORWARDING_MAX_LEGS });\n\t}\n\n\treturn({\n\t\tmaxLegs: DEFAULT_FORWARDING_MAX_LEGS,\n\t\t...forwardingOnly\n\t});\n}\n\nexport type AnchorChainingResolveAssetsFilter = {\n\tfrom?: AnchorChainingListAssetsSideFilter;\n\tto?: AnchorChainingListAssetsSideFilter;\n\tmaxStepCount?: number;\n\tonlyAllowFXLike?: boolean;\n\t/**\n\t * When set, only consider persistent-forwarding-eligible crypto hops\n\t * (asset-movement, non-Keeta origin). `true` means `{ method: 'explicit' }`.\n\t * Depth is controlled by `maxStepCount` when provided; otherwise defaults to\n\t * {@link DEFAULT_FORWARDING_MAX_LEGS} (same as getPlans' maxLegs default).\n\t */\n\tforwardingOnly?: boolean | Pick<ForwardingOnlyOptions, 'method'>;\n};\n\nexport const DEFAULT_MAX_PATH_LENGTH = 5;\nexport const DEFAULT_MAX_PATHS = 50;\n\nexport type AnchorChainingFindPathsOptions = {\n\t/**\n\t * Maximum number of legs a path may contain. Defaults to DEFAULT_MAX_PATH_LENGTH,\n\t * or to forwarding `maxLegs` when `forwardingOnly` is set.\n\t */\n\tmaxPathLength?: number;\n\t/**\n\t * Maximum number of paths to collect before halting the search. Defaults to DEFAULT_MAX_PATHS.\n\t */\n\tmaxPaths?: number;\n\t/**\n\t * When set, only traverse persistent-forwarding-eligible crypto hops.\n\t * `true` means `{ method: 'explicit' }` with default maxLegs.\n\t */\n\tforwardingOnly?: boolean | ForwardingOnlyOptions;\n};\n\nexport interface AnchorChainingResolveAssetsResult {\n\tfrom: AnchorChainingAssetInfo[];\n\tto: AnchorChainingAssetInfo[];\n}\n\nexport interface AnchorChainingAssetInfo {\n\tasset: AnchorChainingAsset;\n\tlocation: AssetLocationLike;\n\trails: {\n\t\tinbound: Rail[];\n\t\toutbound: Rail[];\n\t};\n\n\tdistance: {\n\t\tpathLength: number;\n\t} | null;\n}\n\ntype AnchorChainingAssetInfoWithMetadata = AnchorChainingAssetInfo & {\n\tmetadata?: AnchorTokenLocationMetadata;\n}\n\ninterface AnchorChainingResolveAssetsWithMetadataResult {\n\tfrom: AnchorChainingAssetInfoWithMetadata[];\n\tto: AnchorChainingAssetInfoWithMetadata[];\n}\n\ntype AnchorChainingWithMetadataOptions = {\n\tproviderID?: string;\n};\n\ntype GetAccountForActionPayload = {\n\ttype: 'assetMovement';\n\tproviderMethod: 'initiateTransfer';\n\tprovider?: AssetMovementProvider;\n} | {\n\ttype: 'fx';\n\tproviderMethod: 'getAccountForAction';\n}\n\ntype AccountLike = InstanceType<typeof KeetaNetLib.Account> | undefined | ((providerMethodPayload: GetAccountForActionPayload) => Promise<Account> | Account);\ninterface AnchorChainingAccountOverrides {\n\taccount?: AccountLike;\n\tsigner?: AccountLike;\n}\n\n/**\n * Graph-invariant index for resolveAssets, computed once per graph and reused\n * across every resolveAssets / listAssets call. Rebuilding these per call (they\n * depend only on the graph, not the filter) is what makes fan-out patterns --\n * e.g. one listAssets per source asset -- O(callers * nodes) and blow up on a\n * large graph.\n */\ninterface ResolveIndex {\n\tnodes: GraphNodeLike[];\n\t/** Rail-free (asset, location) key per node side, for marking and results. */\n\tfromAssetKeys: string[];\n\ttoAssetKeys: string[];\n\t/** Rail-inclusive join keys: edge i -> j exists iff toKeys[i] === fromKeys[j]. */\n\tfromKeys: string[];\n\ttoKeys: string[];\n\tnodesByFromKey: Map<string, number[]>;\n\tnodesByToKey: Map<string, number[]>;\n\t/** Rail-free (asset, location) buckets, for finding filter start nodes by key. */\n\tnodesByFromAssetKey: Map<string, number[]>;\n\tnodesByToAssetKey: Map<string, number[]>;\n\trailInfo: Map<string, { asset: AnchorChainingAsset; location: AssetLocationLike; inbound: Set<Rail>; outbound: Set<Rail> }>;\n}\n\nexport type ForwardingAssetRef = {\n\tasset: AnchorChainingAsset;\n\tlocation: AssetLocationLike;\n};\n\nconst forwardingAssetKeyCache: EVMChecksumCache = new Map();\n\nfunction forwardingAssetKey(asset: AnchorChainingAsset, location: AssetLocationLike): string {\n\treturn(`${convertAssetSearchInputToCanonical(asset, forwardingAssetKeyCache)}@${convertAssetLocationToString(location)}`);\n}\n\nfunction isCryptoChainLocation(location: AssetLocationLike): boolean {\n\treturn(toAssetLocation(location).type === 'chain');\n}\n\n/**\n * Whether a rail's supportedOperations qualify for forwarding-only filtering.\n * - explicit: createPersistentForwarding must be true\n * - implied: supportedOperations omitted, or createPersistentForwarding is true\n * (a partial object like `{ initiateTransfer: true }` does not qualify)\n */\nexport function supportsPersistentForwarding(\n\tsupportedOperations: RailSupportedOperations | undefined,\n\tmethod: ForwardingOnlyMethod\n): boolean {\n\tif (method === 'explicit') {\n\t\treturn(supportedOperations?.createPersistentForwarding === true);\n\t}\n\n\tif (supportedOperations === undefined) {\n\t\treturn(true);\n\t}\n\n\treturn(supportedOperations.createPersistentForwarding === true);\n}\n\n/**\n * Validate request-level invariants (value affinity) before any network call.\n * Pure: derives the amount/affinity and throws the same messages the inline\n * affinity block in #computePlan used to throw, so observable behavior is\n * unchanged.\n */\nfunction validateRequest(request: AnchorChainingPathInput): { affinity: 'to' | 'from'; amount: bigint } {\n\tif (request.source.value !== undefined && request.destination.value !== undefined) {\n\t\tthrow(new Error('Must have source.value or destination.value but not both'));\n\t} else if (request.source.value !== undefined) {\n\t\treturn({ affinity: 'from', amount: request.source.value });\n\t} else if (request.destination.value !== undefined) {\n\t\treturn({ affinity: 'to', amount: request.destination.value });\n\t} else {\n\t\tthrow(new Error('Must have source.value or destination.value'));\n\t}\n}\n\n/**\n * Whether #computePlan's default-mode scan would select persistent forwarding\n * for this step. Mirrors that selection exactly, including the non-Keeta\n * restriction: a Keeta-source leg is always a user-initiated send, never PFR,\n * even when the provider advertises createPersistentForwarding.\n *\n * Only meaningful outside forwarding-only mode, where every leg is forwarded.\n */\nfunction stepUsesPFR(path: AnchorChainingStepLike[], index: number): boolean {\n\tconst step = path[index];\n\tif (!step || step.type !== 'assetMovement') {\n\t\treturn(false);\n\t}\n\n\tconst priorStep = index > 0 ? path[index - 1] : null;\n\tconst isAmpToAmpTransition = priorStep?.type === 'assetMovement';\n\tconst pfrSupported = step.from.supportedOperations?.createPersistentForwarding === true;\n\tconst initiateForbidden = step.from.supportedOperations?.initiateTransfer === false;\n\tconst sourceIsKeeta = isChainLocation(toAssetLocation(step.from.location), 'keeta');\n\n\treturn(!sourceIsKeeta && (initiateForbidden || (isAmpToAmpTransition && pfrSupported)));\n}\n\n/**\n * Validate structural invariants of a resolved path before any network call,\n * so a structurally-invalid plan fails fast instead of after wasted provider\n * round-trips. Pure: hoists the structural throws that live inline in\n * #computePlan's forwarding-only scan, PFR scan and resolveStep branches,\n * preserving each message verbatim.\n *\n * The three scans run in the same order as #computePlan (forwarding-only, then\n * PFR, then per-step), and each mirrors its selection logic exactly, so the\n * first error thrown here is the same one #computePlan would have thrown.\n *\n * Persistent-forwarding selection depends on the plan options, so callers that\n * intend to compute a forwarding-only plan must pass forwardingOnly:true to get\n * the matching rules. The two modes are mutually exclusive in #computePlan:\n * forwarding-only applies PFR to every leg (chaining each into the next leg's\n * persistent address), while the default mode allows PFR only as the final step.\n */\nfunction validatePathStructure(path: AnchorChainingStepLike[], request: AnchorChainingPathInput, affinity: 'to' | 'from', forwardingOnly: boolean, keetaLocation: string): void {\n\t/*\n\t * Forwarding-only requires every asset-movement leg to qualify for\n\t * persistent forwarding. #computePlan walks backwards here because each leg\n\t * forwards into the next leg's address; the checks below are the\n\t * order-independent subset, so a forward walk would report the same first\n\t * failure for a single-issue path. The backwards walk is kept to match.\n\t */\n\tif (forwardingOnly) {\n\t\tfor (let index = path.length - 1; index >= 0; index--) {\n\t\t\tconst step = path[index];\n\t\t\tif (!step || step.type !== 'assetMovement') {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst pfrEligible = supportsPersistentForwarding(step.from.supportedOperations, 'implied');\n\t\t\tconst sourceIsKeeta = isChainLocation(toAssetLocation(step.from.location), 'keeta');\n\n\t\t\tif (sourceIsKeeta || !pfrEligible) {\n\t\t\t\tthrow(new Error(`Forwarding-only plan requires persistent forwarding support on every leg, but step ${index} at ${convertAssetLocationToString(step.from.location)} does not qualify`));\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * Only the final leg forwards to the request recipient; earlier legs\n\t\t\t * forward to the next leg's persistent address, which is not known\n\t\t\t * until the plan is computed.\n\t\t\t */\n\t\t\tif (index === path.length - 1 && typeof request.destination.recipient !== 'string') {\n\t\t\t\tthrow(new Error(`Forwarding-only plan requires the destination recipient to be a resolved address string`));\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!forwardingOnly) {\n\t\tfor (let index = 0; index < path.length; index++) {\n\t\t\tconst step = path[index];\n\t\t\tif (!step || step.type !== 'assetMovement') {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst pfrSupported = step.from.supportedOperations?.createPersistentForwarding === true;\n\n\t\t\tif (!stepUsesPFR(path, index)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (!pfrSupported) {\n\t\t\t\tthrow(new Error(`Asset movement provider ${step.providerID} source rail ${step.from.rail} at ${convertAssetLocationToString(step.from.location)} declares initiateTransfer:false but does not support createPersistentForwarding`));\n\t\t\t}\n\n\t\t\tif (index !== path.length - 1) {\n\t\t\t\tthrow(new Error(`Persistent-forwarding (PersistentForwardingRelay-only) asset movement steps are currently only supported as the last step in a chain (step ${index} of ${path.length})`));\n\t\t\t}\n\n\t\t\tif (typeof request.destination.recipient !== 'string') {\n\t\t\t\tthrow(new Error(`Persistent-forwarding step at index ${index} requires the chain's destination recipient to be a resolved address string`));\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (let index = 0; index < path.length; index++) {\n\t\tconst step = path[index];\n\t\tif (!step) {\n\t\t\tthrow(new Error(`Step ${index} is not defined`));\n\t\t}\n\n\t\tif (step.type === 'assetMovement') {\n\t\t\tif (affinity === 'to') {\n\t\t\t\tthrow(new Error(`Chaining with affinity 'to' is not currently supported for asset movement steps, as it requires looking up transfer quotes/estimates which is not currently implemented`));\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * Chaining out of an asset-movement step to a non-Keeta intermediate\n\t\t\t * location requires simulateTransfer to compute the deposit amount.\n\t\t\t * #computePlan only reaches that branch when the step is not last, the\n\t\t\t * next step is not persistent-forwarded (which supplies its own address\n\t\t\t * instead), and the next location is not this network's Keeta chain\n\t\t\t * (where funds are parked in the user's account instead).\n\t\t\t *\n\t\t\t * Only reported when the metadata positively says the operation is\n\t\t\t * absent, and guessing when it is unknown would reject paths that\n\t\t\t * compute fine. Most providers publish no rail-level detail at all, so\n\t\t\t * the provider-level operations are what usually settles it; they are\n\t\t\t * the same source `isOperationSupported` consults when planning.\n\t\t\t */\n\t\t\tconst nextPathStep = index !== path.length - 1 ? path[index + 1] : undefined;\n\t\t\tconst cannotSimulateTransfer = step.providerOperations?.simulateTransfer === false ||\n\t\t\t\tstep.from.supportedOperations?.simulateTransfer === false;\n\t\t\tif (\n\t\t\t\t!forwardingOnly &&\n\t\t\t\tnextPathStep !== undefined &&\n\t\t\t\t!stepUsesPFR(path, index + 1) &&\n\t\t\t\tnextPathStep.from.location !== keetaLocation &&\n\t\t\t\tcannotSimulateTransfer\n\t\t\t) {\n\t\t\t\tthrow(new Error(`Asset movement provider ${step.providerID} does not support simulateTransfer, which is required for chaining at non-keeta intermediate location ${convertAssetLocationToString(nextPathStep.from.location)}`));\n\t\t\t}\n\t\t} else if (step.type === 'keetaSend') {\n\t\t\tif (path.length !== 1) {\n\t\t\t\tthrow(new Error(`Direct same-location/same-asset send steps must be the only step in the path`));\n\t\t\t}\n\t\t\tif (!KeetaNet.lib.Account.isInstance(step.from.asset) || !KeetaNet.lib.Account.isInstance(step.to.asset)) {\n\t\t\t\tthrow(new Error(`Expected assets to be token accounts for KEETA_SEND rail`));\n\t\t\t}\n\t\t\tif (!step.from.asset.comparePublicKey(step.to.asset)) {\n\t\t\t\tthrow(new Error(`For KEETA_SEND step, from and to asset must be the same account`));\n\t\t\t}\n\n\t\t\tlet keetaRecipientDestination = null;\n\t\t\tif (KeetaNet.lib.Account.isInstance(request.destination.recipient)) {\n\t\t\t\tkeetaRecipientDestination = request.destination.recipient;\n\t\t\t} else if (typeof request.destination.recipient === 'string') {\n\t\t\t\ttry {\n\t\t\t\t\tkeetaRecipientDestination = KeetaNet.lib.Account.fromPublicKeyString(request.destination.recipient);\n\t\t\t\t} catch {\n\t\t\t\t\t/* ignore errors */\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!keetaRecipientDestination) {\n\t\t\t\tthrow(new Error(`Expected destination recipient to be a public key string for KEETA_SEND step`));\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Whether a graph node is a forwarding-eligible crypto hop (asset-movement,\n * crypto locations, non-Keeta origin, and createPersistentForwarding per method).\n */\nfunction isForwardingEligibleNode(node: GraphNodeLike, method: ForwardingOnlyMethod): boolean {\n\tif (node.type !== 'assetMovement') {\n\t\treturn(false);\n\t}\n\n\tif (!isCryptoChainLocation(node.from.location) || !isCryptoChainLocation(node.to.location)) {\n\t\treturn(false);\n\t}\n\n\tif (isChainLocation(toAssetLocation(node.from.location), 'keeta')) {\n\t\treturn(false);\n\t}\n\n\treturn(supportsPersistentForwarding(node.from.supportedOperations, method));\n}\n\n/**\n * Adjacency over crypto persistent-forwarding edges only - excludes FX edges and\n * any hop that starts on Keeta.\n */\nexport function buildForwardingAdjacency(nodes: GraphNodeLike[]): Map<string, ForwardingAssetRef[]> {\n\tconst adjacency = new Map<string, ForwardingAssetRef[]>();\n\n\tfor (const node of nodes) {\n\t\tif (!isForwardingEligibleNode(node, 'explicit')) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst key = forwardingAssetKey(node.from.asset, node.from.location);\n\t\tconst list = adjacency.get(key) ?? [];\n\t\tlist.push({ asset: node.to.asset, location: node.to.location });\n\t\tadjacency.set(key, list);\n\t}\n\n\treturn(adjacency);\n}\n\n/** Whether `dest` is reachable from `source` over <=`maxLegs` forwarding edges. */\nexport function hasForwardingRoute(\n\tadjacency: Map<string, ForwardingAssetRef[]>,\n\tsource: ForwardingAssetRef,\n\tdest: ForwardingAssetRef,\n\tmaxLegs: number = DEFAULT_FORWARDING_MAX_LEGS\n): boolean {\n\tconst destKey = forwardingAssetKey(dest.asset, dest.location);\n\tlet frontier = [ forwardingAssetKey(source.asset, source.location) ];\n\n\tfor (let depth = 0; depth < maxLegs; depth++) {\n\t\tconst next: string[] = [];\n\n\t\tfor (const key of frontier) {\n\t\t\tfor (const edge of adjacency.get(key) ?? []) {\n\t\t\t\tconst edgeKey = forwardingAssetKey(edge.asset, edge.location);\n\t\t\t\tif (edgeKey === destKey) {\n\t\t\t\t\treturn(true);\n\t\t\t\t}\n\n\t\t\t\tnext.push(edgeKey);\n\t\t\t}\n\t\t}\n\n\t\tfrontier = next;\n\t}\n\n\treturn(false);\n}\n\nclass AnchorGraph {\n\tclient: KeetaNet.UserClient;\n\tresolver: Resolver;\n\tlogger?: Logger | undefined;\n\n\treadonly assetMovementClient: KeetaAssetMovementAnchorClient;\n\treadonly fxClient: KeetaFXAnchorClient;\n\treadonly #assetMovementProviderCache = new Map<string, Promise<AssetMovementProvider | null>>();\n\treadonly #assetNameCache = new Map<MovableAssetSearchCanonical, ISOCurrencyCode | TokenAddress | ExternalChainAsset>();\n\treadonly #evmChecksumCache: EVMChecksumCache = new Map();\n\t#graphNodePromise: Promise<GraphNodeLike[]> | null = null;\n\t#assetMovementProviderIdsByAssetLocation: Promise<Map<string, Set<string>>> | null = null;\n\t#resolveIndexPromise: Promise<ResolveIndex> | null = null;\n\n\tconstructor(args: { client: KeetaNet.UserClient; resolver: Resolver; logger?: Logger | undefined; }) {\n\t\tthis.resolver = args.resolver;\n\t\tthis.client = args.client;\n\t\tthis.logger = args.logger;\n\t\tthis.assetMovementClient = new KeetaAssetMovementAnchorClient(this.client, {\n\t\t\tresolver: this.resolver,\n\t\t\t...(this.logger ? { logger: this.logger } : {})\n\t\t});\n\t\tthis.fxClient = new KeetaFXAnchorClient(this.client, {\n\t\t\tresolver: this.resolver,\n\t\t\t...(this.logger ? { logger: this.logger } : {})\n\t\t});\n\t}\n\n\treadonly #assetLocationKeyCache = new WeakMap<object, string>();\n\t#assetLocationKey = (side: { asset: AnchorChainingAsset; location: AssetLocationLike }) => {\n\t\tconst cached = this.#assetLocationKeyCache.get(side);\n\t\tif (cached !== undefined) {\n\t\t\treturn(cached);\n\t\t}\n\t\tconst key = `${convertAssetSearchInputToCanonical(side.asset, this.#evmChecksumCache)}@${convertAssetLocationToString(side.location)}`;\n\t\tthis.#assetLocationKeyCache.set(side, key);\n\t\treturn(key);\n\t};\n\n\tgetAssetMovementProviderById(providerID: string): Promise<AssetMovementProvider | null> {\n\t\tlet providerPromise = this.#assetMovementProviderCache.get(providerID);\n\t\tif (providerPromise === undefined) {\n\t\t\tproviderPromise = this.assetMovementClient.getProviderByID(providerID).catch((error: unknown) => {\n\t\t\t\t// Don't cache failures -- evict so a later call can retry.\n\t\t\t\tthis.#assetMovementProviderCache.delete(providerID);\n\t\t\t\tthrow(error);\n\t\t\t});\n\t\t\tthis.#assetMovementProviderCache.set(providerID, providerPromise);\n\t\t}\n\n\t\treturn(providerPromise);\n\t}\n\n\tasync #getAssetMovementProviderIdsByAssetLocation(): Promise<Map<string, Set<string>>> {\n\t\tif (this.#assetMovementProviderIdsByAssetLocation === null) {\n\t\t\tthis.#assetMovementProviderIdsByAssetLocation = (async () => {\n\t\t\t\tconst map = new Map<string, Set<string>>();\n\t\t\t\tfor (const node of await this.computeGraphNodes()) {\n\t\t\t\t\tif (node.type !== 'assetMovement') {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tfor (const side of [ node.from, node.to ] as const) {\n\t\t\t\t\t\tconst key = this.#assetLocationKey(side);\n\t\t\t\t\t\tlet providerIDs = map.get(key);\n\t\t\t\t\t\tif (!providerIDs) {\n\t\t\t\t\t\t\tproviderIDs = new Set<string>();\n\t\t\t\t\t\t\tmap.set(key, providerIDs);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tproviderIDs.add(node.providerID);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn(map);\n\t\t\t})();\n\t\t}\n\n\t\treturn(await this.#assetMovementProviderIdsByAssetLocation);\n\t}\n\n\tasync getAssetMovementProvidersForAsset(asset: AnchorChainingAsset, location: AssetLocationLike): Promise<null | { [providerID: string]: { provider: AssetMovementProvider; }}> {\n\t\tconst providerIDs = (await this.#getAssetMovementProviderIdsByAssetLocation()).get(this.#assetLocationKey({ asset, location }));\n\t\tif (!providerIDs || providerIDs.size === 0) {\n\t\t\treturn(null);\n\t\t}\n\n\t\tlet retval: null | { [providerID: string]: { provider: AssetMovementProvider; }} = null;\n\n\t\tconst resolved = await Promise.all([ ...providerIDs ].map(async (providerID) => {\n\t\t\tconst provider = await this.getAssetMovementProviderById(providerID);\n\t\t\treturn({ providerID, provider });\n\t\t}));\n\n\t\tfor (const { providerID, provider } of resolved) {\n\t\t\tif (!provider) {\n\t\t\t\tthis.logger?.debug('AnchorGraph::getAssetMovementProvidersForAsset', `No provider found for providerID ${providerID}, although provider was previously known to exist in the graph nodes`);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (!retval) {\n\t\t\t\tretval = {};\n\t\t\t}\n\t\t\tretval[providerID] = { provider };\n\t\t}\n\n\t\treturn(retval);\n\t}\n\n\tasync #computeFXNodes() {\n\t\tconst fxServices = await this.resolver.lookup('fx', {});\n\n\t\tif (!fxServices) {\n\t\t\treturn([]);\n\t\t}\n\n\t\tconst networkLocation = `chain:keeta:${this.client.network}` satisfies AssetLocationLike;\n\n\t\tconst providerLookupResult = await Promise.all(Object.entries(fxServices).map(async ([ providerID, service ]) => {\n\t\t\ttry {\n\t\t\t\tconst fromEntries = await service.from('array');\n\n\t\t\t\tif (!fromEntries) {\n\t\t\t\t\treturn(null);\n\t\t\t\t}\n\n\t\t\t\tconst operations = await service.operations('object');\n\t\t\t\tif (!operations.createExchange) {\n\t\t\t\t\tthis.logger?.debug('AnchorGraph::computeFXNodes', `FX service ${providerID} does not support createExchange operation, skipping`);\n\t\t\t\t\treturn(null);\n\t\t\t\t}\n\n\t\t\t\tconst pathNodes = await Promise.all(fromEntries.map(async function(fromEntry) {\n\t\t\t\t\tconst pathNodesResult: GraphNodeLike[] = [];\n\n\t\t\t\t\tconst parsedEntry = await fromEntry('object');\n\n\t\t\t\t\tconst [ fromCodes, toCodes ] = await Promise.all([\n\t\t\t\t\t\tparsedEntry.currencyCodes('array'),\n\t\t\t\t\t\tparsedEntry.to('array')\n\t\t\t\t\t]);\n\n\t\t\t\t\tfor (const from of fromCodes) {\n\t\t\t\t\t\tconst fromResolved = await from('string');\n\t\t\t\t\t\tif (!fromResolved) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst fromAccount = KeetaNet.lib.Account.fromPublicKeyString(fromResolved).assertKeyType(KeetaNet.lib.Account.AccountKeyAlgorithm.TOKEN);\n\n\t\t\t\t\t\tfor (const to of toCodes) {\n\t\t\t\t\t\t\tconst toResolved = await to('string');\n\t\t\t\t\t\t\tif (!toResolved) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst toAccount = KeetaNet.lib.Account.fromPublicKeyString(toResolved).assertKeyType(KeetaNet.lib.Account.AccountKeyAlgorithm.TOKEN);\n\n\t\t\t\t\t\t\tif (fromAccount.comparePublicKey(toAccount)) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tpathNodesResult.push({\n\t\t\t\t\t\t\t\ttype: 'fx',\n\t\t\t\t\t\t\t\tproviderID: providerID,\n\t\t\t\t\t\t\t\tfrom: { asset: fromAccount, location: networkLocation, rail: 'KEETA_SEND' },\n\t\t\t\t\t\t\t\tto: { asset: toAccount, location: networkLocation, rail: 'KEETA_SEND' }\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn(pathNodesResult);\n\t\t\t\t}));\n\n\t\t\t\treturn(pathNodes.flat());\n\t\t\t} catch (error) {\n\t\t\t\tthis.logger?.warn('AnchorGraph::computeFXNodes', `Failed to parse FX service metadata for provider ${providerID} -- ignoring:`, error);\n\t\t\t\treturn(null);\n\t\t\t}\n\t\t}));\n\n\t\treturn(providerLookupResult.flat().filter((node): node is GraphNodeLike => !!node));\n\t}\n\n\tasync #resolveAssetName(name: MovableAssetSearchCanonical): Promise<ISOCurrencyCode | TokenAddress | ExternalChainAsset> {\n\t\tif (KeetaNet.lib.Account.isInstance(name) && name.isToken()) {\n\t\t\treturn(name);\n\t\t}\n\n\t\tif (typeof name === 'string') {\n\t\t\ttry {\n\t\t\t\treturn(KeetaNet.lib.Account.fromPublicKeyString(name).assertKeyType(KeetaNet.lib.Account.AccountKeyAlgorithm.TOKEN));\n\t\t\t} catch {\n\t\t\t\t/* ignore error and continue with other resolution methods */\n\t\t\t}\n\t\t}\n\n\t\tlet found = this.#assetNameCache.get(name);\n\t\tif (found) {\n\t\t\treturn(found);\n\t\t}\n\n\t\tif (isExternalChainAsset(name)) {\n\t\t\tfound = name;\n\t\t} else if (Currency.isCurrencyCode(name)) {\n\t\t\tfound = name;\n\t\t} else if (Currency.isISOCurrencyNumber(name)) {\n\t\t\tfound = new Currency(name).code;\n\t\t} else {\n\t\t\tconst lookupRet = await this.resolver.lookupToken(name);\n\t\t\tif (lookupRet) {\n\t\t\t\tfound = KeetaNet.lib.Account.toAccount(lookupRet.token);\n\t\t\t}\n\t\t}\n\n\t\tif (!found) {\n\t\t\tthrow(new Error(`Unable to resolve asset name: ${name}`));\n\t\t}\n\n\t\tthis.#assetNameCache.set(name, found);\n\n\t\treturn(found);\n\t}\n\n\tasync #computeAssetRails(assetInput: ToValuizable<RailOrRailWithExtendedDetails>): Promise<RailWithSupportedOperations> {\n\t\ttry {\n\t\t\tconst railResolved = await assetInput('string');\n\n\t\t\tif (!isRail(railResolved)) {\n\t\t\t\tthrow(new Error(`Invalid rail format: ${railResolved}`));\n\t\t\t}\n\n\t\t\treturn({ rail: railResolved });\n\t\t} catch {\n\t\t\t/* ignore error */\n\t\t}\n\n\t\tconst extendedDetailsResolved = await assetInput('object');\n\n\t\tif (!extendedDetailsResolved || typeof extendedDetailsResolved !== 'object' || Array.isArray(extendedDetailsResolved)) {\n\t\t\tthrow(new Error(`Invalid asset format, expected string or object with extended details`));\n\t\t}\n\n\t\tif (!('rail' in extendedDetailsResolved)) {\n\t\t\tthrow(new Error(`Invalid asset format, missing 'rail' field in extended details`));\n\t\t}\n\n\t\tconst railResolved = await extendedDetailsResolved.rail?.('string');\n\n\t\tif (!isRail(railResolved)) {\n\t\t\tthrow(new Error(`Invalid rail format in extended details: ${railResolved}`));\n\t\t}\n\n\t\tlet supportedOperations: RailSupportedOperations | undefined;\n\t\tif ('supportedOperations' in extendedDetailsResolved && extendedDetailsResolved.supportedOperations) {\n\t\t\tconst opsResolved = await extendedDetailsResolved.supportedOperations('object');\n\t\t\tif (opsResolved && typeof opsResolved === 'object' && !Array.isArray(opsResolved)) {\n\t\t\t\tconst parsed: RailSupportedOperations = {};\n\t\t\t\tif ('createPersistentForwarding' in opsResolved && opsResolved.createPersistentForwarding) {\n\t\t\t\t\tconst val = await opsResolved.createPersistentForwarding('boolean');\n\t\t\t\t\tif (typeof val === 'boolean') {\n\t\t\t\t\t\tparsed.createPersistentForwarding = val;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ('initiateTransfer' in opsResolved && opsResolved.initiateTransfer) {\n\t\t\t\t\tconst val = await opsResolved.initiateTransfer('boolean');\n\t\t\t\t\tif (typeof val === 'boolean') {\n\t\t\t\t\t\tparsed.initiateTransfer = val;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (Object.keys(parsed).length > 0) {\n\t\t\t\t\tsupportedOperations = parsed;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst result: RailWithSupportedOperations = { rail: railResolved };\n\t\tif (supportedOperations) {\n\t\t\tresult.supportedOperations = supportedOperations;\n\t\t}\n\n\t\treturn(result);\n\t}\n\n\tasync #computeAssetMovementPairSide(pairSideInput: ToValuizable<AssetWithRails>): Promise<{ rails: AssetMovementResolvedRails; location: AssetLocationLike; id: AnchorChainingAsset; }> {\n\t\tconst pairSideResolved = await pairSideInput('object');\n\n\t\tlet location: AssetLocationLike;\n\t\tif (pairSideResolved.location) {\n\t\t\tconst locationRaw = await pairSideResolved.location('string');\n\t\t\tif (!isAssetLocationLike(locationRaw)) {\n\t\t\t\tthrow(new Error(`Invalid location format: ${locationRaw}`));\n\t\t\t}\n\n\t\t\tlocation = locationRaw;\n\t\t} else {\n\t\t\tlocation = `chain:keeta:${this.client.network}`;\n\t\t}\n\n\t\tconst railsResolved = await pairSideResolved.rails('object');\n\n\t\tconst rails: AssetMovementResolvedRails = {\n\t\t\tcommon: await Promise.all((await railsResolved.common?.('array'))?.map(async (commonInput) => {\n\t\t\t\treturn(await this.#computeAssetRails(commonInput));\n\t\t\t}) ?? []),\n\t\t\tinbound: await Promise.all((await railsResolved.inbound?.('array'))?.map(async (commonInput) => {\n\t\t\t\treturn(await this.#computeAssetRails(commonInput));\n\t\t\t}) ?? []),\n\t\t\toutbound: await Promise.all((await railsResolved.outbound?.('array'))?.map(async (commonInput) => {\n\t\t\t\treturn(await this.#computeAssetRails(commonInput));\n\t\t\t}) ?? [])\n\t\t};\n\n\t\tconst id = await pairSideResolved.id('string');\n\t\tif (!isMovableAssetSearchCanonical(id)) {\n\t\t\tthrow(new Error(`Invalid asset id format: ${id}`));\n\t\t}\n\n\t\treturn({\n\t\t\trails: rails,\n\t\t\tlocation: location,\n\t\t\tid: await this.#resolveAssetName(id)\n\t\t});\n\t}\n\n\tasync #computeAssetMovementNodes() {\n\t\tconst assetMovementServices = await this.resolver.lookup('assetMovement', {});\n\n\t\tif (!assetMovementServices) {\n\t\t\treturn([]);\n\t\t}\n\n\t\tconst providerResults = await Promise.all(Object.entries(assetMovementServices).map(async ([ providerID, service ]) => {\n\t\t\ttry {\n\t\t\t\tconst supportedOperationsMetadata = await service.operations('object');\n\n\t\t\t\tconst supportedAssetsEntries = await service.supportedAssets('array');\n\n\t\t\t\tif (!supportedAssetsEntries) {\n\t\t\t\t\tthis.logger?.debug('AnchorGraph::computeAssetMovementNodes', `No supported assets found for provider ${providerID}`);\n\t\t\t\t\treturn(null);\n\t\t\t\t}\n\n\t\t\t\tconst pathNodesResult = await Promise.all(supportedAssetsEntries.map(async (assetEntry): Promise<GraphNodeLike[]> => {\n\t\t\t\t\tconst parsedEntry = await assetEntry('object');\n\n\t\t\t\t\tconst pathsResolved = await parsedEntry.paths('array');\n\t\t\t\t\tconst pathPromises = await Promise.allSettled(pathsResolved.map(async (pathResolvedInput): Promise<GraphNodeLike[]> => {\n\t\t\t\t\t\tconst pathResolved = await pathResolvedInput('object');\n\n\t\t\t\t\t\tconst pairResolved = await pathResolved.pair('array');\n\n\t\t\t\t\t\tconst [ fromResolved, toResolved ] = await Promise.all([\n\t\t\t\t\t\t\tthis.#computeAssetMovementPairSide(pairResolved[0]),\n\t\t\t\t\t\t\tthis.#computeAssetMovementPairSide(pairResolved[1])\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * What the provider publishes for itself. An operation the\n\t\t\t\t\t\t * service does not expose cannot be called on any of its rails,\n\t\t\t\t\t\t * which is the same thing `isOperationSupported` reports when a\n\t\t\t\t\t\t * plan is computed.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tconst providerOperations: RailSupportedOperations = {\n\t\t\t\t\t\t\tcreatePersistentForwarding: supportedOperationsMetadata.createPersistentForwarding !== undefined,\n\t\t\t\t\t\t\tinitiateTransfer: supportedOperationsMetadata.initiateTransfer !== undefined,\n\t\t\t\t\t\t\tsimulateTransfer: supportedOperationsMetadata.simulateTransfer !== undefined\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tfunction getProviderSupportedOperationsForRail(railSpecific?: RailSupportedOperations): RailSupportedOperations {\n\t\t\t\t\t\t\tconst retval: RailSupportedOperations = { ...providerOperations };\n\n\t\t\t\t\t\t\tif (railSpecific) {\n\t\t\t\t\t\t\t\tretval.createPersistentForwarding = railSpecific.createPersistentForwarding ?? false;\n\t\t\t\t\t\t\t\tretval.initiateTransfer = railSpecific.initiateTransfer ?? false;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn(retval);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst makeFromTo = (input: {\n\t\t\t\t\t\t\tasset: { id: AnchorChainingAsset; location: AssetLocationLike; };\n\t\t\t\t\t\t\trail: { rail: Rail; supportedOperations?: RailSupportedOperations | undefined; }\n\t\t\t\t\t\t}) => {\n\t\t\t\t\t\t\tconst retval: Extract<GraphNodeLike, { type: 'assetMovement' }>['from' | 'to'] = {\n\t\t\t\t\t\t\t\tasset: input.asset.id,\n\t\t\t\t\t\t\t\tlocation: input.asset.location,\n\t\t\t\t\t\t\t\trail: input.rail.rail\n\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\tif (input.rail.supportedOperations !== undefined) {\n\t\t\t\t\t\t\t\tretval.supportedOperations = getProviderSupportedOperationsForRail(input.rail.supportedOperations);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn(retval);\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tconst pathNodes: GraphNodeLike[] = [];\n\t\t\t\t\t\tfor (const [ src, dest ] of [\n\t\t\t\t\t\t\t[ fromResolved, toResolved ],\n\t\t\t\t\t\t\t[ toResolved, fromResolved ]\n\t\t\t\t\t\t] as const) {\n\t\t\t\t\t\t\tfor (const inboundRail of [ ...(src.rails.common ?? []), ...(src.rails.inbound ?? []) ]) {\n\t\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\t * Drop edges whose source rail explicitly cannot\n\t\t\t\t\t\t\t\t * initiate a transfer and also cannot create a\n\t\t\t\t\t\t\t\t * persistent forwarding address.\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\tconst inboundSupportedOperations = getProviderSupportedOperationsForRail(inboundRail.supportedOperations);\n\t\t\t\t\t\t\t\tif (inboundSupportedOperations.initiateTransfer === false && inboundSupportedOperations.createPersistentForwarding === false) {\n\t\t\t\t\t\t\t\t\tthis.logger?.debug('AnchorGraph::computeAssetMovementNodes', `Skipping ${providerID} edge from ${convertAssetLocationToString(src.location)} via rail ${inboundRail.rail}: neither initiateTransfer nor createPersistentForwarding supported`);\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tfor (const outboundRail of [ ...(dest.rails.common ?? []), ...(dest.rails.outbound ?? []) ]) {\n\t\t\t\t\t\t\t\t\tpathNodes.push({\n\t\t\t\t\t\t\t\t\t\ttype: 'assetMovement',\n\t\t\t\t\t\t\t\t\t\tproviderID: providerID,\n\t\t\t\t\t\t\t\t\t\tproviderOperations: providerOperations,\n\t\t\t\t\t\t\t\t\t\tfrom: makeFromTo({ asset: src, rail: inboundRail }),\n\t\t\t\t\t\t\t\t\t\tto: makeFromTo({ asset: dest, rail: outboundRail })\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn(pathNodes);\n\t\t\t\t\t}));\n\n\t\t\t\t\tconst allPaths = [];\n\n\t\t\t\t\tfor (const resolved of pathPromises) {\n\t\t\t\t\t\tif (resolved.status === 'rejected') {\n\t\t\t\t\t\t\tthis.logger?.debug('AnchorGraph::computeAssetMovementNodes', `error fetching nodes for provider ${providerID}:`, resolved.reason);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tallPaths.push(...resolved.value);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn(allPaths);\n\t\t\t\t}));\n\n\t\t\t\treturn(pathNodesResult.flat());\n\t\t\t} catch (error) {\n\t\t\t\tthis.logger?.warn('AnchorGraph::computeAssetMovementNodes', `Failed to parse asset movement service metadata for provider ${providerID} -- ignoring:`, error);\n\t\t\t\treturn(null);\n\t\t\t}\n\t\t}));\n\n\t\treturn(providerResults.flat().filter((node): node is GraphNodeLike => !!node));\n\t}\n\n\tasync computeGraphNodes(): Promise<GraphNodeLike[]> {\n\t\tif (this.#graphNodePromise === null) {\n\t\t\tthis.#graphNodePromise = (async () => {\n\t\t\t\tconst receivedNodes = await Promise.all([\n\t\t\t\t\tthis.#computeFXNodes(),\n\t\t\t\t\tthis.#computeAssetMovementNodes()\n\t\t\t\t]);\n\n\t\t\t\treturn(receivedNodes.flat());\n\t\t\t})();\n\t\t}\n\n\t\treturn(await this.#graphNodePromise);\n\t}\n\n\tasync findPaths(input: AnchorChainingPathInput, options?: AnchorChainingFindPathsOptions): Promise<GraphNodeLike[][]> {\n\t\tconst forwardingOpts = normalizeForwardingOnlyOptions(options?.forwardingOnly);\n\t\tconst maxPathLength = forwardingOpts\n\t\t\t? Math.min(\n\t\t\t\toptions?.maxPathLength ?? Infinity,\n\t\t\t\tforwardingOpts.maxLegs ?? DEFAULT_FORWARDING_MAX_LEGS\n\t\t\t)\n\t\t\t: (options?.maxPathLength ?? DEFAULT_MAX_PATH_LENGTH);\n\t\tif (maxPathLength < 1) {\n\t\t\tthrow(new Error(`maxPathLength must be at least 1, got ${maxPathLength}`));\n\t\t}\n\t\tconst maxPaths = options?.maxPaths ?? DEFAULT_MAX_PATHS;\n\t\tif (maxPaths < 1) {\n\t\t\tthrow(new Error(`maxPaths must be at least 1, got ${maxPaths}`));\n\t\t}\n\n\t\tconst allNodes = await this.computeGraphNodes();\n\t\tconst graph = forwardingOpts\n\t\t\t? allNodes.filter((node) => isForwardingEligibleNode(node, forwardingOpts.method))\n\t\t\t: allNodes;\n\n\t\tconst nodesWithNext: { node: GraphNodeLike, next: number[] }[] = graph.map(function(node) {\n\t\t\treturn({ node, next: [] });\n\t\t});\n\n\t\tconst sideKey = (side: GraphNodeLike['from' | 'to']): string =>\n\t\t\t`${side.rail}:${this.#assetLocationKey(side)}`;\n\n\t\tconst fromKeys = graph.map(node => sideKey(node.from));\n\t\tconst toKeys = graph.map(node => sideKey(node.to));\n\n\t\tconst nodesByFromKey = new Map<string, number[]>();\n\t\tfor (let j = 0; j < fromKeys.length; j++) {\n\t\t\tconst key = fromKeys[j];\n\t\t\tif (key === undefined) {\n\t\t\t\tthrow(new Error(`Invalid node index during adjacency construction: ${j}`));\n\t\t\t}\n\t\t\tlet bucket = nodesByFromKey.get(key);\n\t\t\tif (!bucket) {\n\t\t\t\tbucket = [];\n\t\t\t\tnodesByFromKey.set(key, bucket);\n\t\t\t}\n\t\t\tbucket.push(j);\n\t\t}\n\n\t\tfor (let i = 0; i < nodesWithNext.length; i++) {\n\t\t\tconst ni = nodesWithNext[i];\n\t\t\tconst toKey = toKeys[i];\n\t\t\tif (!ni || toKey === undefined) {\n\t\t\t\tthrow(new Error(`Invalid node index during adjacency construction: ${i}`));\n\t\t\t}\n\t\t\tconst successors = nodesByFromKey.get(toKey);\n\t\t\tif (!successors) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor (const j of successors) {\n\t\t\t\tconst nj = nodesWithNext[j];\n\t\t\t\tif (!nj) {\n\t\t\t\t\tthrow(new Error(`Invalid node index during adjacency construction: ${j}`));\n\t\t\t\t}\n\t\t\t\t// We can ignore chaining one fx anchor to itself\n\t\t\t\tif (ni.node.type === 'fx' && nj.node.type === 'fx' && ni.node.providerID === nj.node.providerID) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tni.next.push(j);\n\t\t\t}\n\t\t}\n\n\t\tconst paths: GraphNodeLike[][] = [];\n\n\t\tconst sourceKey = `${input.source.rail}:${this.#assetLocationKey(input.source)}`;\n\t\tconst destinationKey = `${input.destination.rail}:${this.#assetLocationKey(input.destination)}`;\n\n\t\t// Node indices whose `from` side matches the requested source -- the\n\t\t// possible starting legs.\n\t\tconst sourceIndices: number[] = [];\n\t\tfor (let index = 0; index < fromKeys.length; index++) {\n\t\t\tif (fromKeys[index] === sourceKey) {\n\t\t\t\tsourceIndices.push(index);\n\t\t\t}\n\t\t}\n\n\t\tlet truncated = false;\n\n\t\t// Depth-limited DFS that records a path only when its length equals the\n\t\t// current depthLimit, so each distinct path is collected exactly once as\n\t\t// we deepen.\n\t\tconst dfs = (\n\t\t\tcurrentIndex: number,\n\t\t\tdepthLimit: number,\n\t\t\tvisitedAssets: Set<string>,\n\t\t\tpath: GraphNodeLike[]\n\t\t): void => {\n\t\t\tif (paths.length >= maxPaths) {\n\t\t\t\ttruncated = true;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst cur = nodesWithNext[currentIndex];\n\t\t\tconst assetLocationStr = fromKeys[currentIndex];\n\n\t\t\tif (!cur || assetLocationStr === undefined) {\n\t\t\t\tthrow(new Error(`Invalid node index: ${currentIndex}`));\n\t\t\t}\n\n\t\t\tif (visitedAssets.has(assetLocationStr)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvisitedAssets.add(assetLocationStr);\n\n\t\t\tconst newPath = [ ...path, cur.node ];\n\n\t\t\tif (newPath.length === depthLimit && toKeys[currentIndex] === destinationKey) {\n\t\t\t\tpaths.push(newPath);\n\t\t\t}\n\n\t\t\tif (newPath.length < depthLimit) {\n\t\t\t\tfor (const nextIndex of cur.next) {\n\t\t\t\t\tdfs(nextIndex, depthLimit, visitedAssets, newPath);\n\t\t\t\t\tif (paths.length >= maxPaths) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvisitedAssets.delete(assetLocationStr);\n\t\t};\n\n\t\tfor (let depthLimit = 1; depthLimit <= maxPathLength && paths.length < maxPaths; depthLimit++) {\n\t\t\tfor (const index of sourceIndices) {\n\t\t\t\tdfs(index, depthLimit, new Set<string>(), []);\n\t\t\t\tif (paths.length >= maxPaths) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (truncated) {\n\t\t\tthis.logger?.debug('AnchorGraph::findPaths', `Path search hit the maxPaths cap of ${maxPaths}; returning the ${maxPaths} shortest paths (up to maxPathLength ${maxPathLength}).`);\n\t\t}\n\n\t\treturn(paths);\n\t}\n\n\tasync #getResolveIndex(): Promise<ResolveIndex> {\n\t\tif (this.#resolveIndexPromise === null) {\n\t\t\tthis.#resolveIndexPromise = (async () => {\n\t\t\t\tconst nodes = await this.computeGraphNodes();\n\n\t\t\t\tconst fromAssetKeys = nodes.map(node => this.#assetLocationKey(node.from));\n\t\t\t\tconst toAssetKeys = nodes.map(node => this.#assetLocationKey(node.to));\n\t\t\t\tconst fromKeys = nodes.map((node, i) => `${node.from.rail}:${fromAssetKeys[i]}`);\n\t\t\t\tconst toKeys = nodes.map((node, i) => `${node.to.rail}:${toAssetKeys[i]}`);\n\n\t\t\t\tconst nodesByFromKey = new Map<string, number[]>();\n\t\t\t\tconst nodesByToKey = new Map<string, number[]>();\n\t\t\t\tconst nodesByFromAssetKey = new Map<string, number[]>();\n\t\t\t\tconst nodesByToAssetKey = new Map<string, number[]>();\n\t\t\t\tconst railInfo: ResolveIndex['railInfo'] = new Map();\n\n\t\t\t\tconst addToBucket = (map: Map<string, number[]>, key: string | undefined, index: number) => {\n\t\t\t\t\tif (key === undefined) {\n\t\t\t\t\t\tthrow(new Error(`Invalid node index during resolve-index construction: ${index}`));\n\t\t\t\t\t}\n\t\t\t\t\tlet bucket = map.get(key);\n\t\t\t\t\tif (!bucket) {\n\t\t\t\t\t\tbucket = [];\n\t\t\t\t\t\tmap.set(key, bucket);\n\t\t\t\t\t}\n\t\t\t\t\tbucket.push(index);\n\t\t\t\t};\n\n\t\t\t\tconst addRail = (assetKey: string | undefined, side: GraphNodeLike['from' | 'to'], railSide: 'inbound' | 'outbound', index: number) => {\n\t\t\t\t\tif (assetKey === undefined) {\n\t\t\t\t\t\tthrow(new Error(`Invalid node index during resolve-index construction: ${index}`));\n\t\t\t\t\t}\n\t\t\t\t\tlet info = railInfo.get(assetKey);\n\t\t\t\t\tif (!info) {\n\t\t\t\t\t\tinfo = { asset: side.asset, location: side.location, inbound: new Set(), outbound: new Set() };\n\t\t\t\t\t\trailInfo.set(assetKey, info);\n\t\t\t\t\t}\n\t\t\t\t\tinfo[railSide].add(side.rail);\n\t\t\t\t};\n\n\t\t\t\tfor (let i = 0; i < nodes.length; i++) {\n\t\t\t\t\tconst node = nodes[i];\n\t\t\t\t\tif (!node) {\n\t\t\t\t\t\tthrow(new Error(`Invalid node index during resolve-index construction: ${i}`));\n\t\t\t\t\t}\n\t\t\t\t\taddToBucket(nodesByFromKey, fromKeys[i], i);\n\t\t\t\t\taddToBucket(nodesByToKey, toKeys[i], i);\n\t\t\t\t\taddToBucket(nodesByFromAssetKey, fromAssetKeys[i], i);\n\t\t\t\t\taddToBucket(nodesByToAssetKey, toAssetKeys[i], i);\n\t\t\t\t\t// Match buildResultMap's node/side ordering (to side before from\n\t\t\t\t\t// side) so the representative asset/location for a key is stable.\n\t\t\t\t\taddRail(toAssetKeys[i], node.to, 'inbound', i);\n\t\t\t\t\taddRail(fromAssetKeys[i], node.from, 'outbound', i);\n\t\t\t\t}\n\n\t\t\t\treturn({ nodes, fromAssetKeys, toAssetKeys, fromKeys, toKeys, nodesByFromKey, nodesByToKey, nodesByFromAssetKey, nodesByToAssetKey, railInfo });\n\t\t\t})();\n\t\t}\n\n\t\treturn(await this.#resolveIndexPromise);\n\t}\n\n\tasync resolveAssets(filter: AnchorChainingResolveAssetsFilter = {}): Promise<AnchorChainingResolveAssetsResult> {\n\t\tconst { from: fromFilterInput, to: toFilterInput, maxStepCount, onlyAllowFXLike } = filter;\n\t\tconst forwardingOpts = normalizeForwardingOnlyOptions(filter.forwardingOnly);\n\t\tconst forwardingMethod = forwardingOpts?.method;\n\t\tconst traversalStepLimit = forwardingOpts\n\t\t\t? (maxStepCount ?? forwardingOpts.maxLegs ?? DEFAULT_FORWARDING_MAX_LEGS)\n\t\t\t: maxStepCount;\n\n\t\tconst keetaNetworkLocation = `chain:keeta:${this.client.network}` satisfies AssetLocationLike;\n\n\t\t// When onlyAllowFXLike, default omitted locations to the Keeta network location\n\t\tconst fromFilter = (onlyAllowFXLike && fromFilterInput !== undefined && fromFilterInput.location === undefined)\n\t\t\t? { ...fromFilterInput, location: keetaNetworkLocation }\n\t\t\t: fromFilterInput;\n\t\tconst toFilter = (onlyAllowFXLike && toFilterInput !== undefined && toFilterInput.location === undefined)\n\t\t\t? { ...toFilterInput, location: keetaNetworkLocation }\n\t\t\t: toFilterInput;\n\n\t\t// Graph-invariant structures (keys, adjacency buckets, per-asset rail\n\t\t// aggregation) are built once and reused across every call, so a fan-out\n\t\t// of many filtered resolveAssets/listAssets calls doesn't rebuild them n\n\t\t// times.\n\t\tconst { nodes, fromAssetKeys, toAssetKeys, fromKeys, toKeys, nodesByFromKey, nodesByToKey, nodesByFromAssetKey, nodesByToAssetKey, railInfo } = await this.#getResolveIndex();\n\n\t\tconst nodeAllowed = (node: GraphNodeLike): boolean => {\n\t\t\tif (onlyAllowFXLike && !isFXLikeNode(node)) {\n\t\t\t\treturn(false);\n\t\t\t}\n\t\t\tif (forwardingMethod !== undefined && !isForwardingEligibleNode(node, forwardingMethod)) {\n\t\t\t\treturn(false);\n\t\t\t}\n\t\t\treturn(true);\n\t\t};\n\n\t\tconst sideMatchesFilter = (\n\t\t\tside: GraphNodeLike['from' | 'to'],\n\t\t\tf: AnchorChainingListAssetsSideFilter\n\t\t): boolean => {\n\t\t\tif (f.location !== undefined && convertAssetLocationToString(side.location) !== convertAssetLocationToString(f.location)) {\n\t\t\t\treturn(false);\n\t\t\t}\n\t\t\tif (f.asset !== undefined && !isAnchorChainingAssetEqual(side.asset, f.asset)) {\n\t\t\t\treturn(false);\n\t\t\t}\n\t\t\tif (f.rail !== undefined && side.rail !== f.rail) {\n\t\t\t\treturn(false);\n\t\t\t}\n\t\t\treturn(true);\n\t\t};\n\n\t\t// The start nodes for a traversal are those whose relevant side matches the\n\t\t// filter. When the filter pins both asset and location (the common case) we\n\t\t// look them up by key in O(matches); otherwise we fall back to scanning all\n\t\t// nodes. The key path avoids running isAnchorChainingAssetEqual -- and thus\n\t\t// keccak -- per node, which on a large graph dominates fan-out patterns.\n\t\tconst assetBucketsForSide = { from: nodesByFromAssetKey, to: nodesByToAssetKey } as const;\n\t\tconst computeStartIndices = (f: AnchorChainingListAssetsSideFilter, side: 'from' | 'to'): number[] => {\n\t\t\tif (f.asset !== undefined && f.location !== undefined) {\n\t\t\t\tconst key = this.#assetLocationKey({ asset: f.asset, location: f.location });\n\t\t\t\tconst candidates = assetBucketsForSide[side].get(key) ?? [];\n\t\t\t\tif (f.rail === undefined) {\n\t\t\t\t\treturn(candidates);\n\t\t\t\t}\n\t\t\t\treturn(candidates.filter(i => nodes[i]?.[side].rail === f.rail));\n\t\t\t}\n\n\t\t\tconst out: number[] = [];\n\t\t\tfor (let i = 0; i < nodes.length; i++) {\n\t\t\t\tconst node = nodes[i];\n\t\t\t\tif (node && sideMatchesFilter(node[side], f)) {\n\t\t\t\t\tout.push(i);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn(out);\n\t\t};\n\n\t\t// Separate reachable sets and distance maps for backward (from) and forward (to) traversals.\n\t\tconst fromReachable = new Set<string>();\n\t\tconst fromDistances = new Map<string, number>();\n\t\tconst toReachable = new Set<string>();\n\t\tconst toDistances = new Map<string, number>();\n\n\t\tconst makeMarkFn = (reachable: Set<string>, distances: Map<string, number>) =>\n\t\t\t(key: string, depth?: number) => {\n\t\t\t\treachable.add(key);\n\t\t\t\tif (depth !== undefined) {\n\t\t\t\t\tconst existing = distances.get(key);\n\t\t\t\t\tif (existing === undefined || depth < existing) {\n\t\t\t\t\t\tdistances.set(key, depth);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\tconst markFromReachable = makeMarkFn(fromReachable, fromDistances);\n\t\tconst markToReachable = makeMarkFn(toReachable, toDistances);\n\n\t\tconst bfs = (\n\t\t\tstartIndices: number[],\n\t\t\tdirection: 'forward' | 'backward',\n\t\t\tmarkFn: (key: string, depth: number) => void\n\t\t) => {\n\t\t\tconst markKeys = direction === 'forward' ? toAssetKeys : fromAssetKeys;\n\t\t\tconst stepKeys = direction === 'forward' ? toKeys : fromKeys;\n\t\t\tconst neighborBuckets = direction === 'forward' ? nodesByFromKey : nodesByToKey;\n\n\t\t\tconst nodeVisited = new Set<number>();\n\t\t\tconst queue: { nodeIdx: number; depth: number }[] = [];\n\t\t\tfor (const i of startIndices) {\n\t\t\t\tif (!nodeVisited.has(i)) {\n\t\t\t\t\tnodeVisited.add(i);\n\t\t\t\t\tqueue.push({ nodeIdx: i, depth: 1 });\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet head = 0;\n\t\t\twhile (head < queue.length) {\n\t\t\t\tconst queueItem = queue[head];\n\t\t\t\thead++;\n\t\t\t\tif (!queueItem) {\n\t\t\t\t\tthrow(new Error(`Unexpected empty queue during BFS processing`));\n\t\t\t\t}\n\t\t\t\tconst { nodeIdx, depth } = queueItem;\n\t\t\t\tconst node = nodes[nodeIdx];\n\t\t\t\tconst markKey = markKeys[nodeIdx];\n\t\t\t\tconst stepKey = stepKeys[nodeIdx];\n\t\t\t\tif (!node || markKey === undefined || stepKey === undefined) {\n\t\t\t\t\tthrow(new Error(`Invalid node index during BFS processing: ${nodeIdx}`));\n\t\t\t\t}\n\t\t\t\tif (!nodeAllowed(node)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tmarkFn(markKey, depth);\n\t\t\t\tif (traversalStepLimit !== undefined && depth >= traversalStepLimit) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst neighbors = neighborBuckets.get(stepKey);\n\t\t\t\tif (!neighbors) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tfor (const neighborIdx of neighbors) {\n\t\t\t\t\tif (nodeVisited.has(neighborIdx)) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst neighbor = nodes[neighborIdx];\n\t\t\t\t\tif (!neighbor) {\n\t\t\t\t\t\tthrow(new Error(`Invalid node index during BFS processing: ${neighborIdx}`));\n\t\t\t\t\t}\n\t\t\t\t\tif (node.type === 'fx' && neighbor.type === 'fx' && node.providerID === neighbor.providerID) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tnodeVisited.add(neighborIdx);\n\t\t\t\t\tqueue.push({ nodeIdx: neighborIdx, depth: depth + 1 });\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tif (fromFilter) {\n\t\t\tbfs(computeStartIndices(fromFilter, 'from'), 'forward', markToReachable);\n\t\t}\n\t\tif (toFilter) {\n\t\t\tbfs(computeStartIndices(toFilter, 'to'), 'backward', markFromReachable);\n\t\t}\n\t\tif (!fromFilter && !toFilter) {\n\t\t\tfor (let i = 0; i < nodes.length; i++) {\n\t\t\t\tconst node = nodes[i];\n\t\t\t\tconst fromKey = fromAssetKeys[i];\n\t\t\t\tconst toKey = toAssetKeys[i];\n\t\t\t\tif (!node || fromKey === undefined || toKey === undefined) {\n\t\t\t\t\tthrow(new Error(`Invalid node index during reachability marking: ${i}`));\n\t\t\t\t}\n\t\t\t\tif (nodeAllowed(node)) {\n\t\t\t\t\tmarkFromReachable(fromKey);\n\t\t\t\t\tmarkFromReachable(toKey);\n\t\t\t\t\tmarkToReachable(fromKey);\n\t\t\t\t\tmarkToReachable(toKey);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Build result maps by collecting inbound/outbound rails for every reachable\n\t\t// (asset, location) pair. The common path reads the precomputed per-asset\n\t\t// rail aggregation (railInfo) and so is O(reachable). onlyAllowFXLike and\n\t\t// forwardingOnly need to exclude disallowed nodes' rails -- which railInfo\n\t\t// doesn't distinguish -- so they fall back to the O(nodes) scan.\n\t\tconst buildResultMapFast = (\n\t\t\treachable: Set<string>,\n\t\t\tdistances: Map<string, number>\n\t\t): Map<string, AnchorChainingAssetInfo> => {\n\t\t\tconst resultMap = new Map<string, AnchorChainingAssetInfo>();\n\t\t\tfor (const key of reachable) {\n\t\t\t\tconst info = railInfo.get(key);\n\t\t\t\tif (!info) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst distanceValue = distances.get(key);\n\t\t\t\tresultMap.set(key, {\n\t\t\t\t\tasset: info.asset,\n\t\t\t\t\tlocation: info.location,\n\t\t\t\t\trails: { inbound: [ ...info.inbound ], outbound: [ ...info.outbound ] },\n\t\t\t\t\tdistance: distanceValue !== undefined ? { pathLength: distanceValue } : null\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn(resultMap);\n\t\t};\n\n\t\tconst buildResultMapFiltered = (\n\t\t\treachable: Set<string>,\n\t\t\tdistances: Map<string, number>\n\t\t): Map<string, AnchorChainingAssetInfo> => {\n\t\t\tconst resultMap = new Map<string, AnchorChainingAssetInfo>();\n\t\t\tconst getOrCreate = (key: string, side: { asset: AnchorChainingAsset; location: AssetLocationLike }): AnchorChainingAssetInfo => {\n\t\t\t\tlet resultObj = resultMap.get(key);\n\t\t\t\tif (!resultObj) {\n\t\t\t\t\tconst distanceValue = distances.get(key);\n\n\t\t\t\t\tresultObj = {\n\t\t\t\t\t\tasset: side.asset,\n\t\t\t\t\t\tlocation: side.location,\n\t\t\t\t\t\trails: { inbound: [], outbound: [] },\n\t\t\t\t\t\tdistance: distanceValue !== undefined ? { pathLength: distanceValue } : null\n\t\t\t\t\t};\n\n\t\t\t\t\tresultMap.set(key, resultObj);\n\t\t\t\t}\n\t\t\t\treturn(resultObj);\n\t\t\t};\n\t\t\tfor (let i = 0; i < nodes.length; i++) {\n\t\t\t\tconst node = nodes[i];\n\t\t\t\tconst toKey = toAssetKeys[i];\n\t\t\t\tconst fromKey = fromAssetKeys[i];\n\t\t\t\tif (!node || toKey === undefined || fromKey === undefined) {\n\t\t\t\t\tthrow(new Error(`Invalid node index during result-map construction: ${i}`));\n\t\t\t\t}\n\t\t\t\tif (!nodeAllowed(node)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (reachable.has(toKey)) {\n\t\t\t\t\tconst entry = getOrCreate(toKey, node.to);\n\t\t\t\t\tif (!entry.rails.inbound.includes(node.to.rail)) {\n\t\t\t\t\t\tentry.rails.inbound.push(node.to.rail);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (reachable.has(fromKey)) {\n\t\t\t\t\tconst entry = getOrCreate(fromKey, node.from);\n\t\t\t\t\tif (!entry.rails.outbound.includes(node.from.rail)) {\n\t\t\t\t\t\tentry.rails.outbound.push(node.from.rail);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn(resultMap);\n\t\t};\n\n\t\tconst buildResultMap = (onlyAllowFXLike || forwardingMethod !== undefined) ? buildResultMapFiltered : buildResultMapFast;\n\n\t\tconst fromResultMap = buildResultMap(fromReachable, fromDistances);\n\t\tconst toResultMap = buildResultMap(toReachable, toDistances);\n\n\t\t// When onlyAllowFXLike, exclude the filter asset from the result set so that\n\t\t// \"what can USDC be swapped to?\" doesn't include USDC itself via a round-trip.\n\t\tif (onlyAllowFXLike) {\n\t\t\tif (fromFilter?.asset !== undefined) {\n\t\t\t\ttoResultMap.delete(this.#assetLocationKey({ asset: fromFilter.asset, location: fromFilter.location ?? keetaNetworkLocation }));\n\t\t\t}\n\t\t\tif (toFilter?.asset !== undefined) {\n\t\t\t\tfromResultMap.delete(this.#assetLocationKey({ asset: toFilter.asset, location: toFilter.location ?? keetaNetworkLocation }));\n\t\t\t}\n\t\t}\n\n\t\tconst filterMap = (\n\t\t\tmap: Map<string, AnchorChainingAssetInfo>,\n\t\t\tf: AnchorChainingListAssetsSideFilter,\n\t\t\trailSide: 'inbound' | 'outbound'\n\t\t): AnchorChainingAssetInfo[] =>\n\t\t\tArray.from(map.values()).filter(info => {\n\t\t\t\tif (f.location !== undefined && convertAssetLocationToString(info.location) !== convertAssetLocationToString(f.location)) {\n\t\t\t\t\treturn(false);\n\t\t\t\t}\n\t\t\t\tif (f.asset !== undefined && !isAnchorChainingAssetEqual(info.asset, f.asset)) {\n\t\t\t\t\treturn(false);\n\t\t\t\t}\n\t\t\t\tif (f.rail !== undefined && !info.rails[railSide].includes(f.rail)) {\n\t\t\t\t\treturn(false);\n\t\t\t\t}\n\t\t\t\treturn(true);\n\t\t\t});\n\n\t\tconst fromAssets = (fromFilter !== undefined && toFilter !== undefined)\n\t\t\t? filterMap(fromResultMap, fromFilter, 'outbound')\n\t\t\t: Array.from(fromResultMap.values());\n\t\tconst toAssets = (fromFilter !== undefined && toFilter !== undefined)\n\t\t\t? filterMap(toResultMap, toFilter, 'inbound')\n\t\t\t: Array.from(toResultMap.values());\n\n\t\treturn({ from: fromAssets, to: toAssets });\n\t}\n\n\tasync listAssets(filter: AnchorChainingListAssetsFilter = {}): Promise<AnchorChainingAssetInfo[]> {\n\t\tconst result = await this.resolveAssets(filter);\n\n\t\tif (filter.from) {\n\t\t\treturn(result.to);\n\t\t} else if (filter.to) {\n\t\t\treturn(result.from);\n\t\t} else {\n\t\t\treturn(result.to);\n\t\t}\n\t}\n\n\tasync getExternalAssetMetadata(\n\t\tasset: AnchorChainingAssetInfo['asset'],\n\t\tlocation: AnchorChainingAssetInfo['location'],\n\t\tproviderID?: string\n\t): Promise<AnchorTokenLocationMetadata | undefined> {\n\t\tif (!isExternalChainAsset(asset)) {\n\t\t\treturn(undefined);\n\t\t}\n\n\t\tconst providers = await this.getAssetMovementProvidersForAsset(asset, location);\n\t\tif (!providers) {\n\t\t\treturn(undefined);\n\t\t}\n\n\t\tif (providerID) {\n\t\t\tconst found = providers[providerID];\n\t\t\tif (!found) {\n\t\t\t\treturn(undefined);\n\t\t\t}\n\t\t\treturn(found.provider.getAssetMetadataForLocation(location, asset) ?? undefined);\n\t\t}\n\n\t\tfor (const { provider } of Object.values(providers)) {\n\t\t\tconst metadata = provider.getAssetMetadataForLocation(location, asset);\n\t\t\tif (metadata) {\n\t\t\t\treturn(metadata);\n\t\t\t}\n\t\t}\n\n\t\treturn(undefined);\n\t}\n\n\tasync #attachMetadata(\n\t\tassetInfo: AnchorChainingAssetInfo,\n\t\toptions?: AnchorChainingWithMetadataOptions\n\t): Promise<AnchorChainingAssetInfoWithMetadata> {\n\t\tconst metadata = await this.getExternalAssetMetadata(assetInfo.asset, assetInfo.location, options?.providerID);\n\t\tif (!metadata) {\n\t\t\treturn(assetInfo);\n\t\t}\n\t\treturn({ ...assetInfo, metadata });\n\t}\n\n\tasync resolveAssetsWithMetadata(\n\t\tfilter: AnchorChainingResolveAssetsFilter = {},\n\t\toptions?: AnchorChainingWithMetadataOptions\n\t): Promise<AnchorChainingResolveAssetsWithMetadataResult> {\n\t\tconst result = await this.resolveAssets(filter);\n\n\t\tconst [from, to] = await Promise.all([\n\t\t\tPromise.all(result.from.map((info) => this.#attachMetadata(info, options))),\n\t\t\tPromise.all(result.to.map((info) => this.#attachMetadata(info, options)))\n\t\t]);\n\n\t\treturn({ from, to });\n\t}\n\n\tasync listAssetsWithMetadata(\n\t\tfilter: AnchorChainingListAssetsFilter = {},\n\t\toptions?: AnchorChainingWithMetadataOptions\n\t): Promise<AnchorChainingAssetInfoWithMetadata[]> {\n\t\tconst result = await this.resolveAssetsWithMetadata(filter, options);\n\n\t\tif (filter.from) {\n\t\t\treturn(result.to);\n\t\t} else if (filter.to) {\n\t\t\treturn(result.from);\n\t\t} else {\n\t\t\treturn(result.to);\n\t\t}\n\t}\n\n\tasync buildForwardingAdjacency(): Promise<Map<string, ForwardingAssetRef[]>> {\n\t\treturn(buildForwardingAdjacency(await this.computeGraphNodes()));\n\t}\n}\n\nexport interface ComputePlanOptions {\n\toverrides?: AnchorChainingAccountOverrides;\n\t/**\n\t * Limit the number of plans to calculate, defaults to 3\n\t */\n\tlimit?: number;\n\t/**\n\t * When true, plan computation uses persistent forwarding for the final leg\n\t * instead of initiateTransfer, even when the source rail supports both.\n\t */\n\tforwardingOnly?: boolean;\n}\n\nexport interface GetPlansOptions extends Omit<ComputePlanOptions, 'forwardingOnly'> {\n\tincludeAllOutput?: boolean;\n\tforwardingOnly?: boolean | ForwardingOnlyOptions;\n\tmaxPathLength?: number;\n}\n\nfunction toComputePlanOptions(options?: GetPlansOptions, forwardingOpts?: ForwardingOnlyOptions): ComputePlanOptions | undefined {\n\tconst overrides = options?.overrides;\n\tconst forwardingOnly = forwardingOpts !== undefined;\n\n\tif (overrides === undefined && !forwardingOnly) {\n\t\treturn(undefined);\n\t}\n\n\treturn({\n\t\t...(overrides !== undefined ? { overrides } : {}),\n\t\t...(forwardingOnly ? { forwardingOnly: true } : {})\n\t});\n}\n\n/**\n * Whether a discovered path is eligible for forwarding-only plan resolution:\n * crypto chain hops only, no Keeta-origin legs, no FX, within maxLegs.\n */\nexport function isForwardingPath(path: AnchorChainingPath, options?: ForwardingOnlyOptions): boolean {\n\tconst maxLegs = options?.maxLegs ?? DEFAULT_FORWARDING_MAX_LEGS;\n\tconst method = options?.method ?? 'explicit';\n\tconst legs = path.path;\n\n\tif (legs.length < 1 || legs.length > maxLegs) {\n\t\treturn(false);\n\t}\n\n\treturn(legs.every((step) => {\n\t\tif (step.type !== 'assetMovement') {\n\t\t\treturn(false);\n\t\t}\n\n\t\tif (!isCryptoChainLocation(step.from.location) || !isCryptoChainLocation(step.to.location)) {\n\t\t\treturn(false);\n\t\t}\n\n\t\tif (isChainLocation(toAssetLocation(step.from.location), 'keeta')) {\n\t\t\treturn(false);\n\t\t}\n\n\t\treturn(supportsPersistentForwarding(step.from.supportedOperations, method));\n\t}));\n}\n\nfunction computeFeeTotalFromBreakdown(valueIn: bigint, fees: AssetFeeBreakdown | PersistentAddressAssetFeeBreakdown): bigint {\n\tlet feeFromLineItems = 0n;\n\n\tfor (const lineItem of fees.lineItems) {\n\t\tif ('value' in lineItem && lineItem.value !== undefined && lineItem.value !== '') {\n\t\t\tfeeFromLineItems += BigInt(lineItem.value);\n\t\t} else if (lineItem.purpose === 'VALUE_VARIABLE' && lineItem.basisPoints !== undefined) {\n\t\t\tfeeFromLineItems += valueIn * BigInt(lineItem.basisPoints) / 10000n;\n\t\t}\n\t}\n\n\tlet feeTotal = feeFromLineItems;\n\tif ('total' in fees && fees.total !== undefined && fees.total !== '') {\n\t\tfeeTotal = BigInt(fees.total);\n\t}\n\n\treturn(feeTotal);\n}\n\nfunction estimateValueOutFromPersistentForwardingFees(valueIn: bigint, fees?: PersistentAddressAssetFeeBreakdown): bigint {\n\tif (!fees) {\n\t\treturn(valueIn);\n\t}\n\n\tconst valueOut = valueIn - computeFeeTotalFromBreakdown(valueIn, fees);\n\treturn(valueOut < 1n ? 1n : valueOut);\n}\n\n/** @internal Exported for unit tests. */\nexport function estimateForwardingValueOut(valueIn: bigint, fees?: PersistentAddressAssetFeeBreakdown): bigint {\n\treturn(estimateValueOutFromPersistentForwardingFees(valueIn, fees));\n}\n\nexport type AnchorChainingFeeLineItemSource =\n\t| 'persistentAddress'\n\t| 'simulatedTransfer'\n\t| 'transferInstruction'\n\t| 'fxQuote'\n\t| 'fxEstimate';\n\nexport type AnchorChainingFeeLineItemMetadata = {\n\tstepIndex: number;\n\tstep: Exclude<ChainStepResolution, { type: 'keetaSend' }>;\n\tsource: AnchorChainingFeeLineItemSource;\n};\n\nexport type AnchorChainingFeeLineItem = {\n\tpurpose: AssetFeeLineItemType;\n\tasset: AssetOrAssetWithLocation;\n\tvalue?: string;\n\tbasisPoints?: number;\n\tdetails?: ClientRenderableContent;\n\tmetadata: AnchorChainingFeeLineItemMetadata;\n};\n\n/** Combined fee breakdown for a computed chaining plan. Does not include a total. */\nexport type AnchorChainingPlanFeeBreakdown = {\n\tlineItems: AnchorChainingFeeLineItem[];\n};\n\n/** List combined fees for a computed chaining plan. Keeta-send steps are omitted (treated as zero). */\nexport function listChainingPlanFees(plan: { plan: AnchorChainingPathComputedPlan }): AnchorChainingPlanFeeBreakdown {\n\tconst lineItems: AnchorChainingFeeLineItem[] = [];\n\n\tconst defaultFeeAsset = (step: Exclude<ChainStepResolution, { type: 'keetaSend' }>): AssetOrAssetWithLocation => {\n\t\tconst location = convertAssetLocationToString(step.step.from.location);\n\n\t\tif (step.type === 'fx') {\n\t\t\tconst token = step.result.isQuote ? step.result.quote.cost.token : step.result.estimate.expectedCost.token;\n\t\t\treturn({ id: token.publicKeyString.get(), location });\n\t\t}\n\n\t\tconst id = KeetaNet.lib.Account.isInstance(step.step.from.asset)\n\t\t\t? step.step.from.asset.publicKeyString.get()\n\t\t\t: step.step.from.asset;\n\n\t\treturn({ id, location });\n\t};\n\n\tfor (let stepIndex = 0; stepIndex < plan.plan.steps.length; stepIndex++) {\n\t\tconst step = plan.plan.steps[stepIndex];\n\t\tif (!step || step.type === 'keetaSend') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst appendBreakdown = (\n\t\t\tbreakdown: { lineItems: readonly (ResolvedFeeLineItem | UnresolvedFeeLineItem)[] },\n\t\t\tsource: AnchorChainingFeeLineItemSource\n\t\t) => {\n\t\t\tconst stepDefaultAsset = defaultFeeAsset(step);\n\t\t\tconst metadata = { stepIndex, step, source };\n\n\t\t\tfor (const item of breakdown.lineItems) {\n\t\t\t\tconst base = {\n\t\t\t\t\tpurpose: item.purpose,\n\t\t\t\t\tasset: item.asset ?? stepDefaultAsset,\n\t\t\t\t\tmetadata,\n\t\t\t\t\t...(item.details !== undefined ? { details: item.details } : {})\n\t\t\t\t};\n\n\t\t\t\tif ('value' in item && item.value !== undefined && item.value !== '') {\n\t\t\t\t\tlineItems.push({\n\t\t\t\t\t\t...base,\n\t\t\t\t\t\tvalue: item.value,\n\t\t\t\t\t\t...(item.purpose === 'VALUE_VARIABLE' && 'basisPoints' in item && item.basisPoints !== undefined ? { basisPoints: item.basisPoints } : {})\n\t\t\t\t\t});\n\t\t\t\t} else if (item.purpose === 'VALUE_VARIABLE' && 'basisPoints' in item && item.basisPoints !== undefined) {\n\t\t\t\t\tlineItems.push({\n\t\t\t\t\t\t...base,\n\t\t\t\t\t\tbasisPoints: item.basisPoints,\n\t\t\t\t\t\tvalue: (step.valueIn * BigInt(item.basisPoints) / 10000n).toString()\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tconst appendAssetFee = (\n\t\t\tassetFee: string | AssetFeeBreakdown | PersistentAddressAssetFeeBreakdown,\n\t\t\tsource: AnchorChainingFeeLineItemSource\n\t\t) => {\n\t\t\tif (typeof assetFee === 'string') {\n\t\t\t\tlineItems.push({\n\t\t\t\t\tpurpose: 'OTHER',\n\t\t\t\t\tasset: defaultFeeAsset(step),\n\t\t\t\t\tvalue: assetFee,\n\t\t\t\t\tmetadata: { stepIndex, step, source }\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tappendBreakdown(assetFee, source);\n\t\t};\n\n\t\tif (step.type === 'fx') {\n\t\t\tconst location = convertAssetLocationToString(step.step.from.location);\n\t\t\tif (step.result.isQuote) {\n\t\t\t\tlineItems.push({\n\t\t\t\t\tpurpose: 'PROVIDER',\n\t\t\t\t\tasset: { id: step.result.quote.cost.token.publicKeyString.get(), location },\n\t\t\t\t\tvalue: step.result.quote.cost.amount.toString(),\n\t\t\t\t\tmetadata: { stepIndex, step, source: 'fxQuote' }\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tlineItems.push({\n\t\t\t\t\tpurpose: 'PROVIDER',\n\t\t\t\t\tasset: { id: step.result.estimate.expectedCost.token.publicKeyString.get(), location },\n\t\t\t\t\tvalue: step.result.estimate.expectedCost.max.toString(),\n\t\t\t\t\tmetadata: { stepIndex, step, source: 'fxEstimate' }\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (step.type === 'assetMovement') {\n\t\t\tappendAssetFee(step.usingInstruction.assetFee, 'transferInstruction');\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (step.simulatedTransfer) {\n\t\t\tconst simulatedInstruction = step.simulatedTransfer.instructions.find((instr) => instr.type === step.step.from.rail);\n\t\t\tif (simulatedInstruction && 'assetFee' in simulatedInstruction) {\n\t\t\t\tappendAssetFee(simulatedInstruction.assetFee, 'simulatedTransfer');\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif (step.persistentAddress.fees) {\n\t\t\tappendBreakdown(step.persistentAddress.fees, 'persistentAddress');\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (step.valueIn > step.valueOut) {\n\t\t\tlineItems.push({\n\t\t\t\tpurpose: 'OTHER',\n\t\t\t\tasset: defaultFeeAsset(step),\n\t\t\t\tvalue: (step.valueIn - step.valueOut).toString(),\n\t\t\t\tmetadata: { stepIndex, step, source: 'persistentAddress' }\n\t\t\t});\n\t\t}\n\t}\n\n\treturn({ lineItems });\n}\n\n/**\n * Whether a resolved plan is anchor-to-anchor with no user intermediary steps.\n * The user may still fund the initial deposit address once.\n */\nexport function isForwardingPlan(plan: { plan: AnchorChainingPathComputedPlan }): { isForwardingOnly: true; } | { isForwardingOnly: false; providerID: string | null; } {\n\tconst steps = plan.plan.steps;\n\n\tif (steps.length === 0) {\n\t\treturn({ isForwardingOnly: false, providerID: null });\n\t}\n\n\tfor (const step of steps) {\n\t\tif (step.type === 'forwarded') {\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn({ isForwardingOnly: false, providerID: step.step?.providerID ?? null })\n\t}\n\n\treturn({ isForwardingOnly: true });\n}\n\n/** Deposit address for the first forwarding leg of a forwarding-only plan. */\nexport function getForwardingDepositAddress(plan: { plan: AnchorChainingPathComputedPlan }): string | null {\n\tconst firstStep = plan.plan.steps[0];\n\n\tif (!firstStep || firstStep.type !== 'forwarded') {\n\t\treturn(null);\n\t}\n\n\tconst address = firstStep.persistentAddress.address;\n\treturn(typeof address === 'string' ? address : null);\n}\n\nexport type AnchorChainingPathValidationResult =\n\t| { valid: true }\n\t| { valid: false; reason: string };\n\nexport interface AnchorChainingPathValidateOptions {\n\t/**\n\t * Validate against forwarding-only plan rules (every asset-movement leg must\n\t * qualify for persistent forwarding), matching ComputePlanOptions.\n\t */\n\tforwardingOnly?: boolean;\n}\n\nexport class AnchorChainingPath {\n\treadonly request: AnchorChainingPathInput;\n\treadonly path: AnchorChainingStepLike[];\n\treadonly parent: AnchorChaining;\n\n\tconstructor(input: {\n\t\trequest: AnchorChainingPathInput;\n\t\tpath: AnchorChainingStepLike[];\n\t\tparent: AnchorChaining;\n\t}) {\n\t\tthis.request = input.request;\n\t\tthis.path = input.path;\n\t\tthis.parent = input.parent;\n\t}\n\n\t/**\n\t * Synchronously check whether this path is structurally and request valid,\n\t * with no network call. Returns { valid: true } when the request value and\n\t * affinity are well formed and the path step shape is allowed.\n\t *\n\t * Persistent-forwarding rules differ between a default plan and a\n\t * forwarding-only plan, so pass the same forwardingOnly value you intend to\n\t * pass to getPlans/AnchorChainingPlan.create. Validating with the wrong mode\n\t * reports the wrong rules.\n\t *\n\t * This does NOT confirm the path will succeed: real feasibility (provider\n\t * availability, quotes, fees, simulated amounts) is only known when the plan\n\t * is computed via getPlans. Use it as a cheap check in a UI.\n\t */\n\tvalidate(options?: AnchorChainingPathValidateOptions): AnchorChainingPathValidationResult {\n\t\ttry {\n\t\t\tconst { affinity } = validateRequest(this.request);\n\t\t\tvalidatePathStructure(this.path, this.request, affinity, options?.forwardingOnly === true, this.keetaLocation);\n\t\t\treturn({ valid: true });\n\t\t} catch (error) {\n\t\t\treturn({ valid: false, reason: error instanceof Error ? error.message : String(error) });\n\t\t}\n\t}\n\n\tget logger(): Logger | undefined {\n\t\treturn(this.parent['logger']);\n\t}\n\n\t/** This client's Keeta chain location, as compared against in #computePlan. */\n\tprotected get keetaLocation(): string {\n\t\treturn(`chain:keeta:${this.parent['client'].network}`);\n\t}\n\n\tprotected async getAccountLike(action: GetAccountForActionPayload, override?: AccountLike): Promise<InstanceType<typeof KeetaNetLib.Account>> {\n\t\tlet found: InstanceType<typeof KeetaNetLib.Account> | undefined = undefined;\n\n\t\tif (this.parent['client'].account.isAccount()) {\n\t\t\tfound = this.parent['client'].account;\n\t\t} else if (this.parent['client'].signer !== null) {\n\t\t\tfound = this.parent['client'].signer;\n\t\t}\n\n\t\tif (override) {\n\t\t\tif (typeof override === 'function') {\n\t\t\t\tfound = await override(action);\n\t\t\t} else {\n\t\t\t\tfound = override;\n\t\t\t}\n\t\t}\n\n\t\tif (!found) {\n\t\t\tthrow(new Error(`Could not get account for ${action.type} action ${action.providerMethod}`));\n\t\t}\n\n\t\treturn(found);\n\t}\n\n\tprotected async getAccountsForAction(action: GetAccountForActionPayload, overrides?: AnchorChainingAccountOverrides): Promise<{ account: InstanceType<typeof KeetaNetLib.Account>; signer: InstanceType<typeof KeetaNetLib.Account> }> {\n\t\tconst [signer, account] = await Promise.all([\n\t\t\tthis.getAccountLike(action, overrides?.signer),\n\t\t\tthis.getAccountLike(action, overrides?.account)\n\t\t]);\n\n\t\treturn({ signer, account });\n\t}\n\n\tasync getProviderLegalDisclaimers(): Promise<PlanDisclaimers | null> {\n\t\tconst legalDisclaimerPromises: { key: string; promise: () => Promise<ProviderDisclaimers | null> }[] = [];\n\n\t\tfor (const step of this.path) {\n\t\t\tif (step.type === 'keetaSend') {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst key = `${step.type}:${step.providerID}`;\n\t\t\tif (legalDisclaimerPromises.find(entry => entry.key === key)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst promise = async () => {\n\t\t\t\ttry {\n\t\t\t\t\tlet disclaimers: ProviderDisclaimers['disclaimers'] | null | undefined = null;\n\t\t\t\t\tif (step.type === 'assetMovement') {\n\t\t\t\t\t\tconst provider = await this.parent.graph.getAssetMovementProviderById(step.providerID);\n\t\t\t\t\t\tdisclaimers = provider?.getLegalDisclaimers();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdisclaimers = await this.parent.graph.fxClient.getLegalDisclaimersById(step.providerID);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!disclaimers) {\n\t\t\t\t\t\treturn(null);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn({ providerID: step.providerID, disclaimers });\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.logger?.debug(`AnchorChainingPath::getProviderLegalDisclaimers`, `Error getting provider disclaimers for providerId: ${step.providerID}`, error);\n\t\t\t\t\tthrow(error)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlegalDisclaimerPromises.push({ key, promise });\n\t\t}\n\n\t\ttry {\n\t\t\tconst disclaimersOrNull = await Promise.all(legalDisclaimerPromises.map((entry) => entry.promise()));\n\t\t\tconst disclaimers = disclaimersOrNull.filter((entry) => entry !== null);\n\t\t\treturn(disclaimers);\n\t\t} catch (error) {\n\t\t\tthis.logger?.debug(`AnchorChainingPath::getProviderLegalDisclaimers`, 'Error getting legal disclaimers for path', error);\n\t\t\treturn(null);\n\t\t}\n\t}\n}\n\nexport class AnchorChainingPlanCreateError extends KeetaAnchorError {\n\tstatic override readonly name: string = 'AnchorChainingPlanCreateError';\n\tprivate readonly AnchorChainingPlanCreateErrorObjectTypeID!: string;\n\tprivate static readonly AnchorChainingPlanCreateErrorObjectTypeID = '940e318b-a6d1-4f8e-be69-e6de9bc99948';\n\n\treadonly failedAtStep: AnchorChainingStepLike;\n\treadonly rootError: unknown;\n\n\tconstructor(input: {\n\t\trootError: unknown;\n\t\tfailedAtStep: AnchorChainingStepLike;\n\t}) {\n\t\tlet message = 'Computing Plan Failed';\n\t\tif (KeetaAnchorError.isInstance(input.rootError)) {\n\t\t\tmessage = input.rootError.message;\n\t\t}\n\t\tsuper(message);\n\n\t\tObject.defineProperty(this, 'AnchorChainingPlanCreateErrorObjectTypeID', {\n\t\t\tvalue: AnchorChainingPlanCreateError.AnchorChainingPlanCreateErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\n\t\tthis.rootError = input.rootError;\n\t\tthis.failedAtStep = input.failedAtStep;\n\t}\n\n\tstatic isInstance(input: unknown): input is AnchorChainingPlanCreateError {\n\t\tif (!this.hasPropWithValue(input, 'AnchorChainingPlanCreateErrorObjectTypeID', AnchorChainingPlanCreateError.AnchorChainingPlanCreateErrorObjectTypeID)) {\n\t\t\treturn(false);\n\t\t}\n\n\t\treturn(true);\n\t}\n\n\tstatic resolveErrorResponse(input: unknown): AnchorPlanPathError {\n\t\tlet rootError = input;\n\t\tlet providerID = null;\n\n\t\tif (input instanceof AnchorChainingPlanCreateError) {\n\t\t\trootError = input.rootError;\n\t\t\tif (input.failedAtStep?.providerID) {\n\t\t\t\tproviderID = input.failedAtStep.providerID;\n\t\t\t}\n\t\t}\n\n\t\treturn({ success: false, error: rootError, failedAt: { providerID }})\n\t}\n}\n\nexport class AnchorChainingPlan extends AnchorChainingPath {\n\t#_plan: AnchorChainingPathComputedPlan | null = null;\n\n\t#state: AnchorChainingPathState = { status: 'idle' };\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t#listeners = new Map<string, Set<((...args: any[]) => void)>>();\n\t#options: ComputePlanOptions | undefined = undefined;\n\n\tprivate constructor(path: AnchorChainingPath, options?: ComputePlanOptions) {\n\t\tsuper({ ...path });\n\t\tthis.#options = options;\n\t}\n\n\tget plan(): AnchorChainingPathComputedPlan {\n\t\tif (!this.#_plan) {\n\t\t\tthrow(new Error(`Steps have not been computed yet`));\n\t\t}\n\n\t\treturn(this.#_plan);\n\t}\n\n\tlistFees(): AnchorChainingPlanFeeBreakdown {\n\t\treturn(listChainingPlanFees(this));\n\t}\n\n\tasync #computePlan() {\n\t\tif (this.#_plan) {\n\t\t\tthrow(new Error(`Steps have already been computed`));\n\t\t}\n\n\t\tconst affinityAndAmount = validateRequest(this.request);\n\t\tconst { affinity } = affinityAndAmount;\n\t\tvalidatePathStructure(this.path, this.request, affinity, this.#options?.forwardingOnly === true, this.keetaLocation);\n\n\t\tconst sharedClientOptions = {\n\t\t\tresolver: this.parent['resolver'],\n\t\t\t...(this.parent['logger'] ? { logger: this.parent['logger'] } : {})\n\t\t} as const;\n\n\t\tconst fxClient = new KeetaFXAnchorClient(this.parent['client'], sharedClientOptions);\n\n\t\tconst assetMovementClient = new KeetaAssetMovementAnchorClient(this.parent['client'], sharedClientOptions);\n\n\t\tconst findInstruction = <R extends AssetTransferInstructions['type']>(allInstructions: AssetTransferInstructions[], type: R): Extract<AssetTransferInstructions, { type: R }> => {\n\t\t\tconst found = allInstructions.find((instr): instr is Extract<AssetTransferInstructions, { type: R }> => {\n\t\t\t\treturn(instr.type === type);\n\t\t\t});\n\n\t\t\tif (!found) {\n\t\t\t\tthrow(new Error(`Expected to find instruction of type ${type} in next step's instructions`));\n\t\t\t}\n\n\t\t\treturn(found);\n\t\t};\n\n\t\t/**\n\t\t * Resolve persistent forwarding addresses for path steps whose source rail\n\t\t * cannot accept an initiated transfer.\n\t\t */\n\t\ttype ForwardedStepInfo = { provider: AssetMovementProvider; persistentAddress: KeetaPersistentForwardingAddressDetails };\n\t\tconst forwardedSteps = new Map<number, ForwardedStepInfo>();\n\t\tconst forwardingOnly = this.#options?.forwardingOnly === true;\n\n\t\tconst resolvePersistentForwardingForStep = async (scanIndex: number, destinationAddress: string): Promise<void> => {\n\t\t\tconst scanStep = this.path[scanIndex];\n\t\t\tif (!scanStep || scanStep.type !== 'assetMovement') {\n\t\t\t\tthrow(new Error(`Expected asset movement step at index ${scanIndex} for persistent forwarding`));\n\t\t\t}\n\n\t\t\tconst forwardedAssetPair = { from: scanStep.from.asset, to: scanStep.to.asset };\n\t\t\tconst forwardedProviders = await assetMovementClient.getProvidersForTransfer(\n\t\t\t\t{ asset: forwardedAssetPair, from: scanStep.from.location, to: scanStep.to.location },\n\t\t\t\t{ providerIDs: [ scanStep.providerID ] }\n\t\t\t);\n\t\t\tif (!forwardedProviders?.[0] || forwardedProviders.length === 0) {\n\t\t\t\tthrow(new Error(`Could not get asset movement provider ${scanStep.providerID} for persistent-forwarding step at index ${scanIndex}`));\n\t\t\t}\n\n\t\t\tconst forwardedProvider = forwardedProviders[0];\n\t\t\tif (!await forwardedProvider.isOperationSupported('createPersistentForwarding')) {\n\t\t\t\tthrow(new Error(`Asset movement provider ${scanStep.providerID} does not support createPersistentForwarding, but the source rail ${scanStep.from.rail} at ${convertAssetLocationToString(scanStep.from.location)} requires it (initiateTransfer is unsupported)`));\n\t\t\t}\n\t\t\tif (!forwardingOnly && !await forwardedProvider.isOperationSupported('simulateTransfer')) {\n\t\t\t\tthrow(new Error(`Asset movement provider ${scanStep.providerID} does not support simulateTransfer, which is required to compute valueOut for a persistent-forwarding step at ${convertAssetLocationToString(scanStep.from.location)}`));\n\t\t\t}\n\n\t\t\tconst { signer: forwardedSigner } = await this.getAccountsForAction({\n\t\t\t\ttype: 'assetMovement',\n\t\t\t\tproviderMethod: 'initiateTransfer',\n\t\t\t\tprovider: forwardedProvider\n\t\t\t}, this.#options?.overrides);\n\n\t\t\tlet persistentAddress: KeetaPersistentForwardingAddressDetails | undefined;\n\t\t\tif (await forwardedProvider.isOperationSupported('listPersistentForwarding')) {\n\t\t\t\ttry {\n\t\t\t\t\tconst existing = await forwardedProvider.listForwardingAddresses({\n\t\t\t\t\t\taccount: forwardedSigner,\n\t\t\t\t\t\tsearch: [{\n\t\t\t\t\t\t\tsourceLocation: scanStep.from.location,\n\t\t\t\t\t\t\tdestinationLocation: scanStep.to.location,\n\t\t\t\t\t\t\tasset: forwardedAssetPair,\n\t\t\t\t\t\t\tdestinationAddress\n\t\t\t\t\t\t}]\n\t\t\t\t\t});\n\n\t\t\t\t\tconst sourceLocationString = convertAssetLocationToString(scanStep.from.location);\n\t\t\t\t\tconst destLocationString = convertAssetLocationToString(scanStep.to.location);\n\t\t\t\t\tconst match = existing.addresses.find(addr => {\n\t\t\t\t\t\tif (addr.destinationAddress !== destinationAddress) {\n\t\t\t\t\t\t\treturn(false);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!addr.sourceLocation || convertAssetLocationToString(addr.sourceLocation) !== sourceLocationString) {\n\t\t\t\t\t\t\treturn(false);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!addr.destinationLocation || convertAssetLocationToString(addr.destinationLocation) !== destLocationString) {\n\t\t\t\t\t\t\treturn(false);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (addr.asset && !doesAssetOrPairMatch(addr.asset, forwardedAssetPair)) {\n\t\t\t\t\t\t\treturn(false);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn(true);\n\t\t\t\t\t});\n\t\t\t\t\tif (match) {\n\t\t\t\t\t\tpersistentAddress = match;\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.logger?.debug('AnchorChainingPlan::computePlan', `listForwardingAddresses lookup failed for step ${scanIndex}, will create a new address`, error);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!persistentAddress) {\n\t\t\t\tpersistentAddress = await forwardedProvider.createPersistentForwardingAddress({\n\t\t\t\t\taccount: forwardedSigner,\n\t\t\t\t\tsourceLocation: scanStep.from.location,\n\t\t\t\t\tdestinationLocation: scanStep.to.location,\n\t\t\t\t\tdestinationAddress,\n\t\t\t\t\tasset: forwardedAssetPair\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (typeof persistentAddress.address !== 'string') {\n\t\t\t\tthrow(new Error(`Persistent forwarding address for step ${scanIndex} is not a resolved string (got ${typeof persistentAddress.address})`));\n\t\t\t}\n\n\t\t\tforwardedSteps.set(scanIndex, { provider: forwardedProvider, persistentAddress });\n\t\t};\n\n\t\tif (forwardingOnly) {\n\t\t\tfor (let scanIndex = this.path.length - 1; scanIndex >= 0; scanIndex--) {\n\t\t\t\tconst scanStep = this.path[scanIndex];\n\t\t\t\tif (!scanStep || scanStep.type !== 'assetMovement') {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Accept explicit createPersistentForwarding:true or omitted supportedOperations\n\t\t\t\t// (implied). Reject partial ops that omit the flag - those imply false.\n\t\t\t\tconst pfrEligible = supportsPersistentForwarding(scanStep.from.supportedOperations, 'implied');\n\t\t\t\tconst sourceIsKeeta = isChainLocation(toAssetLocation(scanStep.from.location), 'keeta');\n\n\t\t\t\t// Defense in depth: validatePathStructure enforces this before any network call.\n\t\t\t\tif (sourceIsKeeta || !pfrEligible) {\n\t\t\t\t\tthrow(new Error(`Forwarding-only plan requires persistent forwarding support on every leg, but step ${scanIndex} at ${convertAssetLocationToString(scanStep.from.location)} does not qualify`));\n\t\t\t\t}\n\n\t\t\t\tlet destinationAddress: string;\n\t\t\t\tif (scanIndex === this.path.length - 1) {\n\t\t\t\t\tconst finalRecipient = this.request.destination.recipient;\n\t\t\t\t\tif (typeof finalRecipient !== 'string') {\n\t\t\t\t\t\tthrow(new Error(`Forwarding-only plan requires the destination recipient to be a resolved address string`));\n\t\t\t\t\t}\n\t\t\t\t\tdestinationAddress = finalRecipient;\n\t\t\t\t} else {\n\t\t\t\t\tconst nextForwarded = forwardedSteps.get(scanIndex + 1);\n\t\t\t\t\tif (!nextForwarded) {\n\t\t\t\t\t\tthrow(new Error(`Forwarding-only plan expected persistent forwarding to be resolved for next step ${scanIndex + 1}`));\n\t\t\t\t\t}\n\t\t\t\t\tconst nextAddress = nextForwarded.persistentAddress.address;\n\t\t\t\t\tif (typeof nextAddress !== 'string') {\n\t\t\t\t\t\tthrow(new Error(`Forwarding-only plan requires the next step persistent forwarding address to be a resolved string at index ${scanIndex + 1}`));\n\t\t\t\t\t}\n\t\t\t\t\tdestinationAddress = nextAddress;\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tawait resolvePersistentForwardingForStep(scanIndex, destinationAddress);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow(new AnchorChainingPlanCreateError({ rootError: error, failedAtStep: scanStep }));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (let scanIndex = 0; scanIndex < this.path.length; scanIndex++) {\n\t\t\tif (forwardingOnly) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst scanStep = this.path[scanIndex];\n\t\t\tif (!scanStep || scanStep.type !== 'assetMovement') {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * PFR is selected in two cases:\n\t\t\t * (a) the source rail explicitly cannot accept a managed transfer.\n\t\t\t * (b) the prior step is also an asset-movement step (AMP -> AMP\n\t\t\t * transition) and the source rail supports PFR.\n\t\t\t *\n\t\t\t * Persistent forwarding only applies to non-Keeta (external chain)\n\t\t\t * source rails: the model is that the prior step deposits into a chain\n\t\t\t * address the bridge observes and auto-forwards. A Keeta-source leg\n\t\t\t * (KEETA_SEND) is always a user-initiated send -- the prior step routes\n\t\t\t * its output back to the user, who then sends again -- so it is never\n\t\t\t * PFR, even when the provider advertises createPersistentForwarding at\n\t\t\t * the provider level (which its bare KEETA_SEND rails would otherwise\n\t\t\t * inherit). Treating an on-Keeta swap as PFR skips the required second\n\t\t\t * send.\n\t\t\t */\n\t\t\tconst priorStep = scanIndex > 0 ? this.path[scanIndex - 1] : null;\n\t\t\tconst isAmpToAmpTransition = priorStep?.type === 'assetMovement';\n\t\t\tconst pfrSupported = scanStep.from.supportedOperations?.createPersistentForwarding === true;\n\t\t\tconst initiateForbidden = scanStep.from.supportedOperations?.initiateTransfer === false;\n\t\t\tconst sourceIsKeeta = isChainLocation(toAssetLocation(scanStep.from.location), 'keeta');\n\n\t\t\tconst shouldUsePFR = !sourceIsKeeta && (initiateForbidden || (isAmpToAmpTransition && pfrSupported));\n\t\t\tif (!shouldUsePFR) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t/*\n\t\t\t * Defense in depth: validatePathStructure enforces these PFR rules before\n\t\t\t * any network call. They are kept here next to the operation so the\n\t\t\t * guarantee holds even if the early pass is bypassed. The typeof check\n\t\t\t * also narrows destinationAddress to string for the call below.\n\t\t\t */\n\t\t\tif (!pfrSupported) {\n\t\t\t\tthrow(new Error(`Asset movement provider ${scanStep.providerID} source rail ${scanStep.from.rail} at ${convertAssetLocationToString(scanStep.from.location)} declares initiateTransfer:false but does not support createPersistentForwarding`));\n\t\t\t}\n\n\t\t\tif (scanIndex !== this.path.length - 1) {\n\t\t\t\tthrow(new Error(`Persistent-forwarding (PersistentForwardingRelay-only) asset movement steps are currently only supported as the last step in a chain (step ${scanIndex} of ${this.path.length})`));\n\t\t\t}\n\n\t\t\tconst destinationAddress = this.request.destination.recipient;\n\t\t\tif (typeof destinationAddress !== 'string') {\n\t\t\t\tthrow(new Error(`Persistent-forwarding step at index ${scanIndex} requires the chain's destination recipient to be a resolved address string`));\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tawait resolvePersistentForwardingForStep(scanIndex, destinationAddress);\n\t\t\t} catch (error) {\n\t\t\t\tthrow(new AnchorChainingPlanCreateError({ rootError: error, failedAtStep: scanStep }));\n\t\t\t}\n\t\t}\n\n\t\tconst stepPromises: Promise<ChainStepResolution>[] = [];\n\t\tconst resolvingSteps = new Set<number>();\n\t\tconst precomputedValueOuts = new Map<number, bigint>();\n\t\tconst resolveStep = async (index: number): Promise<ChainStepResolution> => {\n\t\t\tconst step = this.path[index];\n\n\t\t\tif (!step) {\n\t\t\t\tthrow(new Error(`Step ${index} is not defined`));\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * Detect cycles\n\t\t\t */\n\t\t\tif (resolvingSteps.has(index)) {\n\t\t\t\tthrow(new Error(`Cyclic dependency detected in resolveStep: step ${index} is already being resolved`));\n\t\t\t}\n\n\t\t\tlet promise: Promise<ChainStepResolution> | undefined = stepPromises[index];\n\n\t\t\tif (!promise) {\n\t\t\t\tresolvingSteps.add(index);\n\n\t\t\t\tpromise = (async (): Promise<ChainStepResolution> => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (step.type === 'fx') {\n\t\t\t\t\t\t\tlet amount;\n\n\t\t\t\t\t\t\tif (affinity === 'from') {\n\t\t\t\t\t\t\t\tif (index === 0) {\n\t\t\t\t\t\t\t\t\tamount = affinityAndAmount.amount;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tconst previous = await resolveStep(index - 1);\n\t\t\t\t\t\t\t\t\tamount = previous.valueOut;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (affinity === 'to') {\n\t\t\t\t\t\t\t\tif (index === (this.path.length - 1)) {\n\t\t\t\t\t\t\t\t\t// XXX:TODO Move this to destination\n\t\t\t\t\t\t\t\t\tamount = affinityAndAmount.amount;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tconst next = await resolveStep(index + 1);\n\t\t\t\t\t\t\t\t\tamount = next.valueIn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tassertNever(affinity);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst fxAccountOptions = await this.getAccountsForAction({\n\t\t\t\t\t\t\t\ttype: 'fx',\n\t\t\t\t\t\t\t\tproviderMethod: 'getAccountForAction'\n\t\t\t\t\t\t\t}, this.#options?.overrides);\n\n\t\t\t\t\t\t\tconst quotesOrEstimates = await fxClient.getQuotesOrEstimates(\n\t\t\t\t\t\t\t\t{ from: step.from.asset, to: step.to.asset, amount, affinity },\n\t\t\t\t\t\t\t\tfxAccountOptions,\n\t\t\t\t\t\t\t\t{ providerIDs: [ step.providerID ] }\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif (!quotesOrEstimates?.[0] || quotesOrEstimates.length === 0) {\n\t\t\t\t\t\t\t\tthrow(new Error(`Could not get FX quote/estimate for provider ${step.providerID}`));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst result = quotesOrEstimates[0];\n\n\t\t\t\t\t\t\tif (!result.isQuote && result.estimate.canPerformExchange === false) {\n\t\t\t\t\t\t\t\tthrow(new Error(`FX estimate from provider ${step.providerID} indicates exchange cannot be performed`));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst convertedAmount = result.isQuote ? result.quote.convertedAmount : result.estimate.convertedAmount;\n\n\t\t\t\t\t\t\tlet valueIn;\n\t\t\t\t\t\t\tlet valueOut;\n\n\t\t\t\t\t\t\tif (affinity === 'to') {\n\t\t\t\t\t\t\t\tvalueOut = amount;\n\t\t\t\t\t\t\t\tvalueIn = convertedAmount;\n\t\t\t\t\t\t\t} else if (affinity === 'from') {\n\t\t\t\t\t\t\t\tvalueOut = convertedAmount;\n\t\t\t\t\t\t\t\tvalueIn = amount;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tassertNever(affinity);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn({ type: 'fx', step, valueIn, valueOut, result });\n\t\t\t\t\t\t} else if (step.type === 'assetMovement') {\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t * Defense in depth: validatePathStructure rejects affinity 'to' on\n\t\t\t\t\t\t\t * asset-movement steps before any network call. This guard keeps the\n\t\t\t\t\t\t\t * check next to the operation in case the early pass is bypassed.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tif (affinity === 'to') {\n\t\t\t\t\t\t\t\tthrow(new Error(`Chaining with affinity 'to' is not currently supported for asset movement steps, as it requires looking up transfer quotes/estimates which is not currently implemented`));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tlet depositValue: bigint;\n\t\t\t\t\t\t\tif (index === 0) {\n\t\t\t\t\t\t\t\tdepositValue = affinityAndAmount.amount;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tconst precomputedPrev = precomputedValueOuts.get(index - 1);\n\t\t\t\t\t\t\t\tif (precomputedPrev !== undefined) {\n\t\t\t\t\t\t\t\t\tdepositValue = precomputedPrev;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tconst previous = await resolveStep(index - 1);\n\t\t\t\t\t\t\t\t\tdepositValue = previous.valueOut;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst assetPair = { from: step.from.asset, to: step.to.asset };\n\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t * Forwarded step: prior step deposits into a pre-resolved persistent address.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tconst forwardedInfo = forwardedSteps.get(index);\n\t\t\t\t\t\t\tif (forwardedInfo) {\n\t\t\t\t\t\t\t\tconst { provider: forwardedProvider, persistentAddress } = forwardedInfo;\n\n\t\t\t\t\t\t\t\tlet estimatedValueOut = depositValue;\n\t\t\t\t\t\t\t\tlet simulatedTransfer: Awaited<ReturnType<typeof forwardedProvider.simulateTransfer>> | undefined;\n\t\t\t\t\t\t\t\tif (forwardingOnly) {\n\t\t\t\t\t\t\t\t\testimatedValueOut = estimateValueOutFromPersistentForwardingFees(depositValue, persistentAddress.fees);\n\t\t\t\t\t\t\t\t} else if (await forwardedProvider.isOperationSupported('simulateTransfer')) {\n\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\tconst { signer: forwardedSigner } = await this.getAccountsForAction({\n\t\t\t\t\t\t\t\t\t\t\ttype: 'assetMovement',\n\t\t\t\t\t\t\t\t\t\t\tproviderMethod: 'initiateTransfer',\n\t\t\t\t\t\t\t\t\t\t\tprovider: forwardedProvider\n\t\t\t\t\t\t\t\t\t\t}, this.#options?.overrides);\n\t\t\t\t\t\t\t\t\t\tsimulatedTransfer = await forwardedProvider.simulateTransfer({\n\t\t\t\t\t\t\t\t\t\t\taccount: forwardedSigner,\n\t\t\t\t\t\t\t\t\t\t\tasset: assetPair,\n\t\t\t\t\t\t\t\t\t\t\tfrom: { location: step.from.location },\n\t\t\t\t\t\t\t\t\t\t\tto: { location: step.to.location },\n\t\t\t\t\t\t\t\t\t\t\tvalue: depositValue\n\t\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\t\tconst simulatedInstruction = simulatedTransfer.instructions.find((instr): instr is Extract<SimulatedAssetTransferInstructions, { type: typeof step.from.rail }> => instr.type === step.from.rail);\n\t\t\t\t\t\t\t\t\t\tlet simulatedTotalReceive: string | undefined;\n\t\t\t\t\t\t\t\t\t\tif (simulatedInstruction) {\n\t\t\t\t\t\t\t\t\t\t\tsimulatedTotalReceive = simulatedInstruction.totalReceiveAmount;\n\t\t\t\t\t\t\t\t\t\t\tif (simulatedTotalReceive === undefined && 'value' in simulatedInstruction) {\n\t\t\t\t\t\t\t\t\t\t\t\tsimulatedTotalReceive = simulatedInstruction.value;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif (simulatedTotalReceive !== undefined) {\n\t\t\t\t\t\t\t\t\t\t\testimatedValueOut = BigInt(simulatedTotalReceive);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\t\t\t\tthis.logger?.debug('AnchorChainingPlan::resolveStep', `simulateTransfer for forwarded step ${index} valueOut estimation failed; falling back to depositValue`, error);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn({\n\t\t\t\t\t\t\t\t\ttype: 'forwarded',\n\t\t\t\t\t\t\t\t\tstep,\n\t\t\t\t\t\t\t\t\tvalueIn: depositValue,\n\t\t\t\t\t\t\t\t\tvalueOut: estimatedValueOut,\n\t\t\t\t\t\t\t\t\tpersistentAddress,\n\t\t\t\t\t\t\t\t\tprovider: forwardedProvider,\n\t\t\t\t\t\t\t\t\t...(simulatedTransfer !== undefined ? { simulatedTransfer } : {})\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (this.#options?.forwardingOnly) {\n\t\t\t\t\t\t\t\tthrow(new Error(`Forwarding-only plan requires persistent forwarding for step at index ${index}, but none was resolved`));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst providers = await assetMovementClient.getProvidersForTransfer(\n\t\t\t\t\t\t\t\t{ asset: assetPair, from: step.from.location, to: step.to.location },\n\t\t\t\t\t\t\t\t{ providerIDs: [ step.providerID ] }\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif (!providers?.[0] || providers.length === 0) {\n\t\t\t\t\t\t\t\tthrow(new Error(`Could not get asset movement provider ${step.providerID}`));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst provider = providers[0];\n\n\t\t\t\t\t\t\tconst { signer } = await this.getAccountsForAction({\n\t\t\t\t\t\t\t\ttype: 'assetMovement',\n\t\t\t\t\t\t\t\tproviderMethod: 'initiateTransfer',\n\t\t\t\t\t\t\t\tprovider\n\t\t\t\t\t\t\t}, this.#options?.overrides);\n\n\t\t\t\t\t\t\tlet resolvedRecipient: RecipientResolved | GenericAccount;\n\t\t\t\t\t\t\tlet sendingToType: SendingToType;\n\n\t\t\t\t\t\t\tif (index === this.path.length - 1) {\n\t\t\t\t\t\t\t\tresolvedRecipient = this.request.destination.recipient;\n\t\t\t\t\t\t\t\tsendingToType = 'FINAL_DESTINATION';\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tsendingToType = 'NEXT_STEP';\n\n\t\t\t\t\t\t\t\tconst nextPathStep = this.path[index + 1];\n\n\t\t\t\t\t\t\t\tif (!nextPathStep) {\n\t\t\t\t\t\t\t\t\tthrow(new Error(`Expected next step at index ${index + 1} for asset movement step at index ${index}`));\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\t * Next step is forwarded: recipient is its persistent address,\n\t\t\t\t\t\t\t\t * no need to resolve the next step's instructions.\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\tconst nextForwardedInfo = forwardedSteps.get(index + 1);\n\t\t\t\t\t\t\t\tif (nextForwardedInfo) {\n\t\t\t\t\t\t\t\t\tconst pfiAddress = nextForwardedInfo.persistentAddress.address;\n\t\t\t\t\t\t\t\t\tif (typeof pfiAddress !== 'string') {\n\t\t\t\t\t\t\t\t\t\tthrow(new Error(`Persistent forwarding address for next step ${index + 1} is not a resolved string`));\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tresolvedRecipient = pfiAddress;\n\t\t\t\t\t\t\t\t} else if (nextPathStep.from.location === this.keetaLocation) {\n\t\t\t\t\t\t\t\t\tconst { account } = await this.getAccountsForAction({\n\t\t\t\t\t\t\t\t\t\ttype: 'assetMovement',\n\t\t\t\t\t\t\t\t\t\tproviderMethod: 'initiateTransfer'\n\t\t\t\t\t\t\t\t\t}, this.#options?.overrides);\n\n\t\t\t\t\t\t\t\t\t// Store funds in-transit in the account instead of forwarding directly to provider.\n\t\t\t\t\t\t\t\t\tresolvedRecipient = account;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t\t * If the provider does not support simulateTransfer,\n\t\t\t\t\t\t\t\t\t * we cannot chain to this step.\n\t\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\t\tif (!await provider.isOperationSupported('simulateTransfer')) {\n\t\t\t\t\t\t\t\t\t\tthrow(new Error(`Asset movement provider ${step.providerID} does not support simulateTransfer, which is required for chaining at non-keeta intermediate location ${convertAssetLocationToString(nextPathStep.from.location)}`));\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tconst simulated = await provider.simulateTransfer({\n\t\t\t\t\t\t\t\t\t\taccount: signer,\n\t\t\t\t\t\t\t\t\t\tasset: assetPair,\n\t\t\t\t\t\t\t\t\t\tfrom: { location: step.from.location },\n\t\t\t\t\t\t\t\t\t\tto: { location: step.to.location },\n\t\t\t\t\t\t\t\t\t\tvalue: depositValue\n\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\tconst simulatedInstruction = simulated.instructions.find((instr): instr is Extract<SimulatedAssetTransferInstructions, { type: typeof step.from.rail }> => instr.type === step.from.rail);\n\t\t\t\t\t\t\t\t\tif (!simulatedInstruction) {\n\t\t\t\t\t\t\t\t\t\tthrow(new Error(`Simulated transfer for step ${index} did not return an instruction matching rail ${step.from.rail}`));\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tlet simulatedTotalReceive: string | undefined = simulatedInstruction.totalReceiveAmount;\n\t\t\t\t\t\t\t\t\tif (simulatedTotalReceive === undefined && 'value' in simulatedInstruction) {\n\t\t\t\t\t\t\t\t\t\tsimulatedTotalReceive = simulatedInstruction.value;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (simulatedTotalReceive === undefined) {\n\t\t\t\t\t\t\t\t\t\tthrow(new Error(`totalReceiveAmount must be defined for simulated transfer when chaining`));\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tprecomputedValueOuts.set(index, BigInt(simulatedTotalReceive));\n\n\t\t\t\t\t\t\t\t\tconst nextStep = await resolveStep(index + 1);\n\n\t\t\t\t\t\t\t\t\tif (nextStep.type === 'assetMovement' || nextStep.type === 'keetaSend') {\n\t\t\t\t\t\t\t\t\t\tif (nextStep.usingInstruction.type !== step.to.rail) {\n\t\t\t\t\t\t\t\t\t\t\tthrow(new Error(`Next step's usingInstruction type ${nextStep.usingInstruction.type} does not match expected ${step.to.rail} for recipient resolution`));\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tconst foundInstruction = nextStep.usingInstruction;\n\n\t\t\t\t\t\t\t\t\t\tconst isFiatPushRailFoundInstruction = (input: AssetTransferInstructions | SimulatedAssetTransferInstructions): input is Extract<AssetTransferInstructions, { type: FiatPushRails; }> => {\n\t\t\t\t\t\t\t\t\t\t\treturn(isFiatRail(input.type));\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tif (foundInstruction.type === 'KEETA_SEND') {\n\t\t\t\t\t\t\t\t\t\t\t// Structurally unreachable now that validatePathStructure requires a keetaSend step to be the sole step; kept as a defensive invariant.\n\t\t\t\t\t\t\t\t\t\t\tthrow(new Error(`Cannot currently chain from asset movement to KEETA_SEND step, as this implies multiple keeta locations in the path which is not currently supported`));\n\t\t\t\t\t\t\t\t\t\t} else if (isFiatPushRailFoundInstruction(foundInstruction)) {\n\t\t\t\t\t\t\t\t\t\t\tif (foundInstruction.depositMessage) {\n\t\t\t\t\t\t\t\t\t\t\t\tthrow(new Error(`Deposit message outbound is not currently supported for chaining`));\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tresolvedRecipient = foundInstruction.account;\n\t\t\t\t\t\t\t\t\t\t} else if (foundInstruction.type === 'EVM_SEND' || foundInstruction.type === 'SOLANA_SEND') {\n\t\t\t\t\t\t\t\t\t\t\tresolvedRecipient = foundInstruction.sendToAddress;\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tthrow(new Error(`Unsupported rail for chaining: ${step.to.rail}`));\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else if (nextStep.type === 'fx') {\n\t\t\t\t\t\t\t\t\t\tthrow(new Error(`Cannot currently chain from asset movement to fx step, as fx step does not have recipient information`));\n\t\t\t\t\t\t\t\t\t} else if (nextStep.type === 'forwarded') {\n\t\t\t\t\t\t\t\t\t\tthrow(new Error(`Internal invariant violation: forwarded step at index ${index + 1} reached simulate-cycle-break path; expected nextForwardedInfo branch to have handled it`));\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tassertNever(nextStep);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst recipientString = KeetaNet.lib.Account.isInstance(resolvedRecipient)\n\t\t\t\t\t\t\t\t? resolvedRecipient.publicKeyString.get()\n\t\t\t\t\t\t\t\t: resolvedRecipient;\n\n\t\t\t\t\t\t\tconst transfer = await provider.initiateTransfer({\n\t\t\t\t\t\t\t\taccount: signer,\n\t\t\t\t\t\t\t\tasset: assetPair,\n\t\t\t\t\t\t\t\tfrom: { location: step.from.location },\n\t\t\t\t\t\t\t\tto: {\n\t\t\t\t\t\t\t\t\tlocation: step.to.location,\n\t\t\t\t\t\t\t\t\trecipient: recipientString\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tvalue: depositValue\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tconst usingInstruction = findInstruction(transfer.instructions, step.from.rail);\n\n\t\t\t\t\t\t\tlet totalReceiveAmount: string | undefined = usingInstruction.totalReceiveAmount;\n\t\t\t\t\t\t\tif (totalReceiveAmount === undefined && 'value' in usingInstruction) {\n\t\t\t\t\t\t\t\ttotalReceiveAmount = usingInstruction.value;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (totalReceiveAmount === undefined) {\n\t\t\t\t\t\t\t\tthrow(new Error(`totalReceiveAmount must be defined for chaining`));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst actualValueOut = BigInt(totalReceiveAmount);\n\n\t\t\t\t\t\t\t// If we simulated to break a cycle, the next step's initiateTransfer was\n\t\t\t\t\t\t\t// keyed off the simulated valueOut; a mismatch here means the next step\n\t\t\t\t\t\t\t// is now misaligned, so fail at plan-time instead of letting execute() catch it.\n\t\t\t\t\t\t\tconst simulatedValueOut = precomputedValueOuts.get(index);\n\t\t\t\t\t\t\tif (simulatedValueOut !== undefined && simulatedValueOut !== actualValueOut) {\n\t\t\t\t\t\t\t\tthrow(new Error(`Simulated valueOut ${simulatedValueOut} for step ${index} does not match actual ${actualValueOut} from initiateTransfer`));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn({\n\t\t\t\t\t\t\t\ttype: 'assetMovement',\n\t\t\t\t\t\t\t\tstep: step,\n\t\t\t\t\t\t\t\tvalueIn: depositValue,\n\t\t\t\t\t\t\t\tusingInstruction: usingInstruction,\n\t\t\t\t\t\t\t\ttransfer: transfer,\n\t\t\t\t\t\t\t\tsendingTo: sendingToType,\n\t\t\t\t\t\t\t\tvalueOut: actualValueOut,\n\t\t\t\t\t\t\t\tprovider: provider\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t} else if (step.type === 'keetaSend') {\n\t\t\t\t\t\t\t// Defense in depth: validatePathStructure also enforces this early.\n\t\t\t\t\t\t\tif (this.path.length !== 1) {\n\t\t\t\t\t\t\t\tthrow(new Error(`Direct same-location/same-asset send steps must be the only step in the path`));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (!KeetaNet.lib.Account.isInstance(step.from.asset) || !KeetaNet.lib.Account.isInstance(step.to.asset)) {\n\t\t\t\t\t\t\t\tthrow(new Error(`Expected assets to be token accounts for KEETA_SEND rail`));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (!step.from.asset.comparePublicKey(step.to.asset)) {\n\t\t\t\t\t\t\t\tthrow(new Error(`For KEETA_SEND step, from and to asset must be the same account`));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tlet keetaRecipientDestination = null;\n\t\t\t\t\t\t\tif (KeetaNet.lib.Account.isInstance(this.request.destination.recipient)) {\n\t\t\t\t\t\t\t\tkeetaRecipientDestination = this.request.destination.recipient;\n\t\t\t\t\t\t\t} else if (typeof this.request.destination.recipient === 'string') {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tkeetaRecipientDestination = KeetaNet.lib.Account.fromPublicKeyString(this.request.destination.recipient);\n\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\t/* ignore errors */\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!keetaRecipientDestination) {\n\t\t\t\t\t\t\t\tthrow(new Error(`Expected destination recipient to be a public key string for KEETA_SEND step`));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn({\n\t\t\t\t\t\t\t\ttype: 'keetaSend',\n\t\t\t\t\t\t\t\tstep: null,\n\t\t\t\t\t\t\t\tvalueIn: affinityAndAmount.amount,\n\t\t\t\t\t\t\t\tvalueOut: affinityAndAmount.amount,\n\t\t\t\t\t\t\t\tusingInstruction: {\n\t\t\t\t\t\t\t\t\ttype: 'KEETA_SEND',\n\t\t\t\t\t\t\t\t\ttokenAddress: step.to.asset.publicKeyString.get(),\n\t\t\t\t\t\t\t\t\tsendToAddress: keetaRecipientDestination.publicKeyString.get(),\n\t\t\t\t\t\t\t\t\ttotalReceiveAmount: affinityAndAmount.amount.toString(),\n\t\t\t\t\t\t\t\t\tlocation: `chain:keeta:${this.parent['client'].network}`,\n\t\t\t\t\t\t\t\t\tvalue: String(affinityAndAmount.amount),\n\t\t\t\t\t\t\t\t\tassetFee: '0'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tassertNever(step);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tif (error instanceof AnchorChainingPlanCreateError) {\n\t\t\t\t\t\t\tthrow(error);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tthrow(new AnchorChainingPlanCreateError({\n\t\t\t\t\t\t\trootError: error,\n\t\t\t\t\t\t\tfailedAtStep: step\n\t\t\t\t\t\t}))\n\t\t\t\t\t}\n\t\t\t\t})();\n\n\t\t\t\tpromise.then(() => resolvingSteps.delete(index), () => resolvingSteps.delete(index));\n\t\t\t\tstepPromises[index] = promise;\n\t\t\t}\n\n\t\t\treturn(await promise);\n\t\t}\n\n\t\tconst steps = [];\n\t\tfor (let index = 0; index < this.path.length; index++) {\n\t\t\tsteps.push(await resolveStep(index));\n\t\t}\n\n\t\t// Direct same-location/same-asset send: no provider steps needed.\n\t\tif (steps.length === 0) {\n\t\t\treturn({\n\t\t\t\tsteps: [],\n\t\t\t\ttotalValueIn: affinityAndAmount.amount,\n\t\t\t\ttotalValueOut: affinityAndAmount.amount\n\t\t\t});\n\t\t}\n\n\t\tconst firstStep = steps[0];\n\t\tconst lastStep = steps[steps.length - 1];\n\n\t\tif (!firstStep || !lastStep) {\n\t\t\tthrow(new Error(`Steps array is empty`));\n\t\t}\n\n\t\tif (affinity === 'from') {\n\t\t\tif (firstStep.valueIn !== this.request.source.value) {\n\t\t\t\tthrow(new Error(`Computed valueIn for first step ${firstStep.valueIn} does not match request source value ${this.request.source.value}`));\n\t\t\t}\n\t\t} else if (affinity === 'to') {\n\t\t\tif (lastStep.valueOut !== this.request.destination.value) {\n\t\t\t\tthrow(new Error(`Computed valueOut for last step ${lastStep.valueOut} does not match requested destination value ${this.request.destination.value}`));\n\t\t\t}\n\t\t}\n\n\t\tif (lastStep.valueOut <= 0n) {\n\t\t\tthrow(new Error(`Computed valueOut for last step must be greater than 0, got ${lastStep.valueOut}`));\n\t\t}\n\n\t\treturn({\n\t\t\tsteps,\n\t\t\ttotalValueIn: firstStep.valueIn,\n\t\t\ttotalValueOut: lastStep.valueOut\n\t\t});\n\t}\n\n\tstatic async create(path: AnchorChainingPath, options?: ComputePlanOptions): Promise<AnchorChainingPlan> {\n\t\tconst instance = new this(path, options);\n\t\tinstance.#_plan = await instance.#computePlan();\n\t\treturn(instance);\n\t}\n\n\tget state(): AnchorChainingPathState {\n\t\treturn(this.#state);\n\t}\n\n\ton<E extends keyof AnchorChainingPathEventMap>(event: E, listener: (...args: AnchorChainingPathEventMap[E]) => void): void {\n\t\tlet listenerSet = this.#listeners.get(event);\n\t\tif (!listenerSet) {\n\t\t\tlistenerSet = new Set();\n\t\t\tthis.#listeners.set(event, listenerSet);\n\t\t}\n\t\tlistenerSet.add(listener);\n\t}\n\n\toff<E extends keyof AnchorChainingPathEventMap>(event: E, listener: (...args: AnchorChainingPathEventMap[E]) => void): void {\n\t\tthis.#listeners.get(event)?.delete(listener);\n\t}\n\n\t#setState(state: AnchorChainingPathState): void {\n\t\tthis.#state = state;\n\t\tthis.#emit('stateChange', state);\n\t}\n\n\tget logger(): Logger | undefined {\n\t\treturn(this.parent['logger']);\n\t}\n\n\t#emit<E extends keyof AnchorChainingPathEventMap>(event: E, ...args: AnchorChainingPathEventMap[E]): { sendCount: number; } {\n\t\tlet sendCount = 0;\n\n\t\tfor (const listener of (this.#listeners.get(event) ?? [])) {\n\t\t\ttry {\n\t\t\t\tlistener(...args);\n\t\t\t\tsendCount++;\n\t\t\t} catch (err) {\n\t\t\t\tthis.logger?.debug(`AnchorChainingPath::emit`, `Error in listener for event '${event}'`, err);\n\t\t\t}\n\t\t}\n\n\t\treturn({ sendCount });\n\t}\n\n\tasync #awaitStepCompletion<\n\t\tType extends StepNeededActionEventPayload['type'],\n\t\tRet extends Parameters<Extract<StepNeededActionEventPayload, { action: { type: Type }}>['markCompleted']>\n\t>(step: Pick<Extract<StepNeededActionEventPayload, { type: Type }>, 'action' | 'type'>): Promise<Ret> {\n\t\tlet didComplete = false;\n\n\t\tfunction assertDidNotComplete() {\n\t\t\tif (didComplete) {\n\t\t\t\tthrow(new Error(`Step was already marked as completed or failed`));\n\t\t\t}\n\n\t\t\tdidComplete = true;\n\t\t}\n\n\t\tlet resolveFn: undefined | StepNeededActionEventPayload['markCompleted'];\n\t\tlet rejectFn: undefined | StepNeededActionEventPayload['markFailed'];\n\n\t\tconst promise = new Promise<Ret>(function(resolve, reject) {\n\t\t\tresolveFn = (...args: Ret) => {\n\t\t\t\tassertDidNotComplete();\n\t\t\t\tresolve(args);\n\t\t\t};\n\n\t\t\trejectFn = (error) => {\n\t\t\t\tassertDidNotComplete();\n\n\t\t\t\tlet usingErr = error;\n\t\t\t\tif (!usingErr) {\n\t\t\t\t\tusingErr = new Error(`Step marked as failed without error`);\n\t\t\t\t}\n\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n\t\t\t\treject(usingErr);\n\t\t\t}\n\t\t});\n\n\t\tif (!resolveFn || !rejectFn) {\n\t\t\tthrow(new Error(`Failed to create step completion promise`));\n\t\t}\n\n\t\t// Typescript Cannot infer the correct payload type for the stepNeedsAction event, so we have to assert it here. We ensure type safety by constraining the step parameter to the correct action type, which guarantees that the payload will match the expected structure for that action type.\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\tconst { sendCount } = this.#emit('stepNeedsAction', {\n\t\t\t...step,\n\t\t\tmarkCompleted: resolveFn,\n\t\t\tmarkFailed: rejectFn\n\t\t} as Extract<StepNeededActionEventPayload, { action: { type: Type }}>);\n\n\t\tif (sendCount === 0) {\n\t\t\tthrow(new Error(`No listeners for stepNeedsAction event, but a step (actionType=${step.type}) is awaiting completion`));\n\t\t}\n\n\t\treturn(await promise);\n\t}\n\n\tasync #authorizedSend(options: Pick<AnchorChainingPathExecuteOptions, 'requireSendAuth'> | undefined, sendToAddress: string | GenericAccount, value: bigint, token: TokenAddress | string, external?: string): Promise<string | undefined> {\n\t\tif (options?.requireSendAuth) {\n\t\t\tawait this.#awaitStepCompletion({\n\t\t\t\ttype: 'keetaSendAuthRequired',\n\t\t\t\taction: {\n\t\t\t\t\tsendToAddress: KeetaNet.lib.Account.toAccount(sendToAddress),\n\t\t\t\t\tvalue,\n\t\t\t\t\ttoken: KeetaNet.lib.Account.toAccount(token).assertKeyType(KeetaNet.lib.Account.AccountKeyAlgorithm.TOKEN),\n\t\t\t\t\t...(external !== undefined ? { external } : {})\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tconst { account } = await this.getAccountsForAction({ type: 'assetMovement', providerMethod: 'initiateTransfer' }, this.#options?.overrides);\n\t\tconst published = await this.parent['client'].send(sendToAddress, value, token, external, { account });\n\t\tlet publishedBlocks;\n\t\tif ('blocks' in published) {\n\t\t\tpublishedBlocks = published.blocks;\n\t\t} else {\n\t\t\tpublishedBlocks = published.voteStaple.blocks;\n\t\t}\n\n\t\tconst sendBlock = publishedBlocks[0];\n\t\tif (sendBlock === undefined) {\n\t\t\treturn(undefined);\n\t\t}\n\n\t\treturn(sendBlock.hash.toString());\n\t}\n\n\t/**\n\t * Construct the unsigned external envelope for a user-funded KEETA_SEND.\n\t */\n\tstatic async #buildKeetaSendExternal(provider: AssetMovementProvider, transactionID: string, inputs: readonly AnchorExternalInput[]): Promise<string | undefined> {\n\t\tconst anchorKey = provider.serviceInfo.account;\n\t\tif (anchorKey === undefined) {\n\t\t\treturn(undefined);\n\t\t}\n\n\t\tconst anchor = KeetaNet.lib.Account.fromPublicKeyString(anchorKey);\n\t\tconst builder = new AnchorExternalBuilder().setAnchor(anchor, { transactionId: transactionID });\n\n\t\tfor (const input of inputs) {\n\t\t\tbuilder.addInput(input.blockHash, input.operationIndex);\n\t\t}\n\n\t\tconst external = await builder.build();\n\t\treturn(external);\n\t}\n\n\t/**\n\t * Retry policy for a single status poll.\n\t */\n\t#pollRetryOptions(\n\t\tscope: string,\n\t\tdeadline: number,\n\t\toptions?: { abortSignal?: AbortSignal; poll?: PublicRetryOptions; }\n\t): RetryOptions {\n\t\tconst remainingMs = Math.max(0, deadline - Date.now());\n\n\t\treturn({\n\t\t\t...options?.poll,\n\t\t\tmaxTotalMs: Math.min(options?.poll?.maxTotalMs ?? remainingMs, remainingMs),\n\t\t\tloggerContext: scope,\n\t\t\t...(options?.abortSignal ? { abortSignal: options.abortSignal } : {}),\n\t\t\t...(this.logger ? { logger: this.logger } : {})\n\t\t});\n\t}\n\n\tasync #pollTransferStatus(\n\t\ttransfer: AssetMovementTransfer,\n\t\tcontext: { stepIndex: number; planStep: ChainStepResolution },\n\t\toptions?: { intervalMs?: number; timeoutMs?: number; abortSignal?: AbortSignal; poll?: PublicRetryOptions; }\n\t): Promise<Awaited<ReturnType<AssetMovementTransfer['getTransferStatus']>>> {\n\t\tconst intervalMs = options?.intervalMs ?? 2000;\n\t\tconst timeoutMs = options?.timeoutMs ?? 300_000;\n\t\tconst deadline = Date.now() + timeoutMs;\n\n\t\twhile (true) {\n\t\t\tif (options?.abortSignal?.aborted) {\n\t\t\t\tthrow(new Error(`Aborted while waiting for transfer ${transfer.transferID} to complete`));\n\t\t\t}\n\n\t\t\tconst status = await withRetry(async function() {\n\t\t\t\treturn(await transfer.getTransferStatus());\n\t\t\t}, this.#pollRetryOptions('AnchorChainingPlan::pollTransferStatus', deadline, options));\n\n\t\t\tthis.#emit('transactionObserved', {\n\t\t\t\tstepIndex: context.stepIndex,\n\t\t\t\tplanStep: context.planStep,\n\t\t\t\ttransaction: status.transaction,\n\t\t\t\tsource: 'getTransferStatus'\n\t\t\t});\n\n\t\t\tif (status.transaction.status === 'COMPLETE') {\n\t\t\t\treturn(status);\n\t\t\t}\n\t\t\tif (Date.now() >= deadline) {\n\t\t\t\tthrow(new Error(`Timed out waiting for transfer ${transfer.transferID} to complete`));\n\t\t\t}\n\t\t\tawait KeetaNet.lib.Utils.Helper.asleep(intervalMs);\n\t\t}\n\t}\n\n\t/**\n\t * Wait for the forwarded transfer the bridge creates after observing the\n\t * prior step's withdraw deposit in the persistent-forwarding address.\n\t */\n\tasync #pollForwardedTransaction(\n\t\tstep: ChainStepResolutionForwarded,\n\t\tsourceTransaction: { location: AssetLocationLike; transaction: { id: string }},\n\t\tcontext: { stepIndex: number; planStep: ChainStepResolution },\n\t\toptions?: { intervalMs?: number; timeoutMs?: number; abortSignal?: AbortSignal; }\n\t): Promise<KeetaAssetMovementTransaction> {\n\t\tconst intervalMs = options?.intervalMs ?? 2000;\n\t\tconst timeoutMs = options?.timeoutMs ?? 300_000;\n\t\tconst deadline = Date.now() + timeoutMs;\n\n\t\tconst { provider, persistentAddress } = step;\n\t\tconst pfiAddress = persistentAddress.address;\n\t\tif (typeof pfiAddress !== 'string') {\n\t\t\tthrow(new Error(`Persistent forwarding address must be a resolved string`));\n\t\t}\n\n\t\tconst { account } = await this.getAccountsForAction({\n\t\t\ttype: 'assetMovement',\n\t\t\tproviderMethod: 'initiateTransfer',\n\t\t\tprovider\n\t\t}, this.#options?.overrides);\n\n\t\twhile (true) {\n\t\t\tif (options?.abortSignal?.aborted) {\n\t\t\t\tthrow(new Error(`Aborted while waiting for forwarded transaction at ${pfiAddress} correlated to source tx ${sourceTransaction.transaction.id}`));\n\t\t\t}\n\n\t\t\tlet transactions: KeetaAssetMovementTransaction[] = [];\n\t\t\ttry {\n\t\t\t\tconst response = await provider.listTransactions({\n\t\t\t\t\taccount,\n\t\t\t\t\tpersistentAddresses: [{\n\t\t\t\t\t\tlocation: step.step.from.location,\n\t\t\t\t\t\tpersistentAddress: pfiAddress\n\t\t\t\t\t}],\n\t\t\t\t\ttransactions: [ sourceTransaction ]\n\t\t\t\t});\n\n\t\t\t\ttransactions = response.transactions;\n\t\t\t} catch (error) {\n\t\t\t\tthis.logger?.debug('AnchorChainingPlan::pollForwardedTransaction', `listTransactions failed for PersistentForwardingRelay address ${pfiAddress}`, error);\n\t\t\t}\n\n\t\t\tfor (const transaction of transactions) {\n\t\t\t\tthis.#emit('transactionObserved', {\n\t\t\t\t\tstepIndex: context.stepIndex,\n\t\t\t\t\tplanStep: context.planStep,\n\t\t\t\t\ttransaction,\n\t\t\t\t\tsource: 'listTransactions'\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst candidate = transactions.find(tx => tx.status === 'COMPLETE');\n\t\t\tif (candidate) {\n\t\t\t\treturn(candidate);\n\t\t\t}\n\n\t\t\tif (Date.now() >= deadline) {\n\t\t\t\tthrow(new Error(`Timed out waiting for persistent-forwarding transaction at ${pfiAddress} correlated to source tx ${sourceTransaction.transaction.id}`));\n\t\t\t}\n\n\t\t\tawait KeetaNet.lib.Utils.Helper.asleep(intervalMs);\n\t\t}\n\t}\n\n\tasync #pollExchangeStatus(\n\t\texchange: FXExchange,\n\t\toptions?: { intervalMs?: number; timeoutMs?: number; abortSignal?: AbortSignal; poll?: PublicRetryOptions; }\n\t): Promise<Extract<Awaited<ReturnType<FXExchange['getExchangeStatus']>>, { status: 'completed' }>> {\n\t\tconst intervalMs = options?.intervalMs ?? 2000;\n\t\tconst timeoutMs = options?.timeoutMs ?? 300_000;\n\t\tconst deadline = Date.now() + timeoutMs;\n\n\t\twhile (true) {\n\t\t\tif (options?.abortSignal?.aborted) {\n\t\t\t\tthrow(new Error(`Aborted while waiting for FX exchange ${exchange.exchange.exchangeID} to complete`));\n\t\t\t}\n\n\t\t\tconst status = await withRetry(async function() {\n\t\t\t\treturn(await exchange.getExchangeStatus());\n\t\t\t}, this.#pollRetryOptions('AnchorChainingPlan::pollExchangeStatus', deadline, options));\n\n\t\t\tif (status.status === 'completed') {\n\t\t\t\treturn(status);\n\t\t\t}\n\t\t\tif (status.status === 'failed') {\n\t\t\t\tthrow(new Error(`FX exchange ${exchange.exchange.exchangeID} failed`));\n\t\t\t}\n\t\t\tif (Date.now() >= deadline) {\n\t\t\t\tthrow(new Error(`Timed out waiting for FX exchange ${exchange.exchange.exchangeID} to complete`));\n\t\t\t}\n\n\t\t\tawait KeetaNet.lib.Utils.Helper.asleep(intervalMs);\n\t\t}\n\t}\n\n\tasync execute(options?: AnchorChainingPathExecuteOptions): Promise<AnchorChainingPathExecuteResult> {\n\t\tif (this.#options?.forwardingOnly) {\n\t\t\tthrow(new Error('Forwarding-only plans cannot be executed. Use getPlans({ forwardingOnly: true }), which returns AnchorChainingForwardingOnlyPlan, and fund the deposit address externally.'));\n\t\t}\n\n\t\tif (this.#state.status !== 'idle') {\n\t\t\tthrow(new Error(`Cannot execute: path is already in state \"${this.#state.status}\"`));\n\t\t}\n\n\t\tconst executedSteps: ExecutedStep[] = [];\n\t\tthis.#setState({ status: 'executing', completedSteps: [], currentStepIndex: 0 });\n\n\t\t/*\n\t\t * Actual output value from each completed step, used for equality checking.\n\t\t */\n\t\tlet prevActualValueOut: bigint | null = null;\n\n\t\t/**\n\t\t * Source-tx anchor for the next forwarded step's poll. Populated only\n\t\t * when the prior step is an asset-movement transfer that produced a\n\t\t * withdraw transaction on its destination chain; reset for any step\n\t\t * type that cannot deposit into a persistent-forwarding address.\n\t\t */\n\t\tlet prevWithdrawTx: { location: AssetLocationLike; transaction: { id: string }} | null = null;\n\n\t\t/*\n\t\t * On-chain operations this execution has published so far. Deferred\n\t\t * initiations forward these as the external envelope's inputs so the\n\t\t * anchor's signed envelope references the prior steps' operations.\n\t\t */\n\t\tconst publishedInputs: AnchorExternalInput[] = [];\n\t\tlet index = 0;\n\t\ttry {\n\t\t\tfor (index = 0; index < this.plan.steps.length; index++) {\n\t\t\t\tif (options?.abortSignal?.aborted) {\n\t\t\t\t\tthrow(new Error(`Execution aborted`));\n\t\t\t\t}\n\n\t\t\t\tconst onStepCompleted = (step: ExecutedStep) => {\n\t\t\t\t\texecutedSteps.push(step);\n\t\t\t\t\tthis.#emit('stepExecuted', step, index);\n\t\t\t\t}\n\n\t\t\t\tthis.#setState({ status: 'executing', completedSteps: [...executedSteps], currentStepIndex: index });\n\n\t\t\t\tconst step = this.plan.steps[index];\n\n\t\t\t\tif (!step) {\n\t\t\t\t\tthrow(new Error(`Step ${index} is not defined`));\n\t\t\t\t}\n\n\t\t\t\tconst pollContext = { stepIndex: index, planStep: step };\n\n\t\t\t\t// Verify the actual output from the previous step matches the expected\n\t\t\t\t// input for this step. A mismatch indicates a provider delivered a\n\t\t\t\t// different amount than was negotiated in computeSteps.\n\t\t\t\tif (index > 0 && prevActualValueOut !== null) {\n\t\t\t\t\tif (prevActualValueOut !== step.valueIn) {\n\t\t\t\t\t\tif (prevActualValueOut < step.valueIn) {\n\t\t\t\t\t\t\tthrow(new Error(`Execution failed at step ${index} due to value mismatch: expected at least ${step.valueIn} but previous step produced ${prevActualValueOut}`));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.logger?.debug(`AnchorChainingPlan::execute`, `Value mismatch at step ${index} is non-critical since previous step produced more (${prevActualValueOut}) than expected (${step.valueIn}), proceeding with execution`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (step.type === 'fx') {\n\t\t\t\t\tconst exchange = await step.result.createExchange(undefined, { inputs: [...publishedInputs] });\n\t\t\t\t\tconst exchangeStatus = await this.#pollExchangeStatus(exchange, options);\n\n\t\t\t\t\tpublishedInputs.push({ blockHash: exchangeStatus.blockhash });\n\n\t\t\t\t\tprevActualValueOut = step.valueOut;\n\t\t\t\t\tprevWithdrawTx = null;\n\t\t\t\t\tonStepCompleted({ type: 'fx', plan: step, exchange });\n\t\t\t\t} else if (step.type === 'forwarded') {\n\t\t\t\t\tif (!prevWithdrawTx) {\n\t\t\t\t\t\tthrow(new Error(`Forwarded step at index ${index} requires the prior step to produce a withdraw transaction on its destination chain`));\n\t\t\t\t\t}\n\n\t\t\t\t\tconst observed = await this.#pollForwardedTransaction(step, prevWithdrawTx, pollContext, options);\n\t\t\t\t\tprevActualValueOut = BigInt(observed.to.value);\n\t\t\t\t\tprevWithdrawTx = null;\n\t\t\t\t\tonStepCompleted({ type: 'forwarded', plan: step, observedTransaction: observed });\n\t\t\t\t} else if (step.type === 'assetMovement' || step.type === 'keetaSend') {\n\t\t\t\t\tif (step.usingInstruction.type === 'KEETA_SEND') {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * Prefer the anchor-provided external. When absent,\n\t\t\t\t\t\t * construct the unsigned correlation envelope locally,\n\t\t\t\t\t\t * referencing the prior steps' on-chain operations.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tlet external = step.usingInstruction.external;\n\t\t\t\t\t\tif (external === undefined && step.type === 'assetMovement') {\n\t\t\t\t\t\t\texternal = await AnchorChainingPlan.#buildKeetaSendExternal(step.provider, step.transfer.transferID, publishedInputs);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst sentBlockHash = await this.#authorizedSend(\n\t\t\t\t\t\t\toptions,\n\t\t\t\t\t\t\tstep.usingInstruction.sendToAddress,\n\t\t\t\t\t\t\tBigInt(step.usingInstruction.value),\n\t\t\t\t\t\t\tKeetaNet.lib.Account.fromPublicKeyString(step.usingInstruction.tokenAddress).assertKeyType(KeetaNet.lib.Account.AccountKeyAlgorithm.TOKEN),\n\t\t\t\t\t\t\texternal\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (sentBlockHash !== undefined) {\n\t\t\t\t\t\t\tpublishedInputs.push({ blockHash: sentBlockHash, operationIndex: 0 });\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (index === 0) {\n\t\t\t\t\t\tif (step.type !== 'assetMovement') {\n\t\t\t\t\t\t\tthrow(new Error(`Unexpected asset movement step at index ${index} for user-initiated transfer`));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tawait this.#awaitStepCompletion({\n\t\t\t\t\t\t\ttype: 'assetMovementUserExecutionRequired',\n\t\t\t\t\t\t\taction: {\n\t\t\t\t\t\t\t\tassetMovementTransfer: step.transfer\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t} else if (step.usingInstruction.type === 'EVM_SEND') {\n\t\t\t\t\t\t/* For EVM Sends for now we assume the last step sent to this address */\n\t\t\t\t\t\tthis.logger?.debug(`AnchorChainingPlan::execute`, `Executing EVM_SEND instruction for step ${index} by sending to address ${step.usingInstruction.sendToAddress} with value ${step.usingInstruction.value} and token ${step.usingInstruction.tokenAddress}`);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow(new Error(`Unsupported instruction type ${step.usingInstruction.type} for user-initiated transfer at step ${index}`));\n\t\t\t\t\t}\n\n\t\t\t\t\tif (step.type === 'assetMovement') {\n\t\t\t\t\t\tconst status = await this.#pollTransferStatus(step.transfer, pollContext, options);\n\t\t\t\t\t\tprevActualValueOut = BigInt(status.transaction.to.value);\n\t\t\t\t\t\tconst withdraw = status.transaction.to.transactions.withdraw;\n\t\t\t\t\t\tif (withdraw) {\n\t\t\t\t\t\t\tprevWithdrawTx = {\n\t\t\t\t\t\t\t\tlocation: step.step.to.location,\n\t\t\t\t\t\t\t\ttransaction: { id: withdraw.id }\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tprevWithdrawTx = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonStepCompleted({ type: 'assetMovement', plan: step });\n\t\t\t\t\t} else if (step.type === 'keetaSend') {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * Direct Keeta send: optimistically treat as completed since\n\t\t\t\t\t\t * there is no provider transfer to poll. Cannot feed a forwarded\n\t\t\t\t\t\t * step because it does not produce a bridge withdraw.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprevActualValueOut = step.valueIn;\n\t\t\t\t\t\tprevWithdrawTx = null;\n\t\t\t\t\t\tonStepCompleted({ type: 'keetaSend', plan: step });\n\t\t\t\t\t} else {\n\t\t\t\t\t\tassertNever(step);\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\t\t\t\t\tassertNever(step);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Direct same-location/same-asset send: the loop ran zero iterations,\n\t\t\t// so just publish the on-chain transfer directly.\n\t\t\tif (this.path.length === 0) {\n\t\t\t\tconst sendValue = this.request.source.value ?? this.request.destination.value;\n\t\t\t\tif (!sendValue) {\n\t\t\t\t\tthrow(new Error(`Direct send requires a value for source or destination`));\n\t\t\t\t}\n\n\t\t\t\tif (!KeetaNet.lib.Account.isInstance(this.request.source.asset)) {\n\t\t\t\t\tthrow(new Error(`Direct send requires a Keeta token address as the source asset`));\n\t\t\t\t}\n\t\t\t\tconst recipient = this.request.destination.recipient;\n\t\t\t\tif (typeof recipient !== 'string') {\n\t\t\t\t\tthrow(new Error(`Direct Keeta send requires a crypto address as the recipient`));\n\t\t\t\t}\n\t\t\t\tawait this.#authorizedSend(options, recipient, sendValue, this.request.source.asset);\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tconst error = err instanceof Error ? err : new Error(String(err));\n\t\t\tthis.#setState({ status: 'failed', error, completedSteps: [...executedSteps], failedAtStepIndex: index });\n\t\t\tthis.#emit('failed', error, [...executedSteps], index);\n\t\t\tthrow(error);\n\t\t}\n\n\t\tconst result: AnchorChainingPathExecuteResult = { steps: executedSteps };\n\t\tthis.#setState({ status: 'completed', result });\n\t\tthis.#emit('completed', result);\n\t\treturn(result);\n\t}\n}\n\n/**\n * Forwarding-only chaining plan for persistent-forwarding routes. Resolves deposit\n * addresses and fee estimates but cannot be executed: the user funds the\n * external deposit address directly.\n */\nexport class AnchorChainingForwardingOnlyPlan extends AnchorChainingPath {\n\treadonly #plan: AnchorChainingPathComputedPlan;\n\n\tprivate constructor(path: AnchorChainingPath, plan: AnchorChainingPathComputedPlan) {\n\t\tsuper({ request: path.request, path: path.path, parent: path.parent });\n\t\tthis.#plan = plan;\n\t}\n\n\tget plan(): AnchorChainingPathComputedPlan {\n\t\treturn(this.#plan);\n\t}\n\n\tgetDepositAddress(): string | null {\n\t\treturn(getForwardingDepositAddress(this));\n\t}\n\n\tlistFees(): AnchorChainingPlanFeeBreakdown {\n\t\treturn(listChainingPlanFees(this));\n\t}\n\n\t/**\n\t * Always validated as forwarding-only, since that is the only mode this\n\t * class is ever computed under.\n\t */\n\toverride validate(options?: AnchorChainingPathValidateOptions): AnchorChainingPathValidationResult {\n\t\treturn(super.validate({ ...options, forwardingOnly: true }));\n\t}\n\n\tstatic async create(path: AnchorChainingPath, options?: ComputePlanOptions): Promise<AnchorChainingForwardingOnlyPlan> {\n\t\tconst computed = await AnchorChainingPlan.create(path, { ...options, forwardingOnly: true });\n\t\tif (!isForwardingPlan(computed)) {\n\t\t\tthrow(new Error('Computed plan does not qualify as a forwarding-only route'));\n\t\t}\n\n\t\treturn(new AnchorChainingForwardingOnlyPlan(path, computed.plan));\n\t}\n}\n\ntype AnchorPlanPathError = { success: false; error: unknown; failedAt: { providerID: string | null; }};\ntype AnchorChainingFullPlanResult = (({ success: true; plan: AnchorChainingPlan; } | AnchorPlanPathError) & { path: AnchorChainingPath; });\ntype AnchorChainingFullForwardingOnlyPlanResult = (({ success: true; plan: AnchorChainingForwardingOnlyPlan; } | AnchorPlanPathError) & { path: AnchorChainingPath; });\n\nexport class AnchorChaining {\n\tprivate client: KeetaNet.UserClient;\n\tprivate resolver: Resolver;\n\treadonly graph: AnchorGraph;\n\tprivate logger?: Logger;\n\n\tconstructor(config: AnchorChainingConfig) {\n\t\tthis.client = config.client;\n\t\tif (config.resolver) {\n\t\t\tthis.resolver = config.resolver;\n\t\t} else {\n\t\t\tthis.resolver = getDefaultResolver(config.client);\n\t\t}\n\t\tthis.graph = new AnchorGraph({ resolver: this.resolver, client: this.client, logger: config.logger });\n\t\tif (config.logger !== undefined) {\n\t\t\tthis.logger = config.logger;\n\t\t}\n\t}\n\n\tasync getPaths(input: AnchorChainingPathInput, options?: AnchorChainingFindPathsOptions): Promise<AnchorChainingPath[] | null> {\n\t\tconst forwardingOpts = normalizeForwardingOnlyOptions(options?.forwardingOnly);\n\t\tif (forwardingOpts && (forwardingOpts.maxLegs ?? DEFAULT_FORWARDING_MAX_LEGS) < 1) {\n\t\t\treturn(null);\n\t\t}\n\n\t\t// Direct send: same Keeta location, same asset, same rail no providers needed.\n\t\tconst sourceLocation = toAssetLocation(input.source.location);\n\t\tconst destinationLocation = toAssetLocation(input.destination.location);\n\n\t\tlet foundPaths: AnchorChainingStepLike[][] | null = null;\n\n\t\tif (\n\t\t\tinput.source.rail === 'KEETA_SEND' &&\n\t\t\tinput.destination.rail === 'KEETA_SEND' &&\n\t\t\tconvertAssetLocationToString(sourceLocation) === convertAssetLocationToString(destinationLocation) &&\n\t\t\tisChainLocation(sourceLocation, 'keeta') &&\n\t\t\tisChainLocation(destinationLocation, 'keeta') &&\n\t\t\tisAnchorChainingAssetEqual(input.source.asset, input.destination.asset)\n\t\t) {\n\t\t\t// Direct Keeta sends are never forwarding routes.\n\t\t\tif (forwardingOpts) {\n\t\t\t\treturn(null);\n\t\t\t}\n\n\t\t\tconst fromTo = {\n\t\t\t\tasset: input.source.asset,\n\t\t\t\tlocation: sourceLocation,\n\t\t\t\trail: 'KEETA_SEND'\n\t\t\t} as const;\n\n\t\t\tfoundPaths = [\n\t\t\t\t[{ type: 'keetaSend', from: fromTo, to: fromTo }]\n\t\t\t];\n\t\t} else {\n\t\t\tfoundPaths = await this.graph.findPaths(input, options);\n\t\t}\n\n\t\t// Filter out paths with non-chain steps in intermediate positions\n\t\tfoundPaths = foundPaths?.filter(path => {\n\t\t\tfor (let i = 0; i < path.length - 1; i++) {\n\t\t\t\tconst item = path[i];\n\t\t\t\tif (!item) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst toLocation = toAssetLocation(item.to.location);\n\t\t\t\tif (toLocation.type !== 'chain' && i < path.length - 1) {\n\t\t\t\t\treturn(false);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn(true);\n\t\t});\n\n\t\tif (foundPaths.length === 0) {\n\t\t\treturn(null);\n\t\t}\n\n\t\tconst retval: AnchorChainingPath[] = [];\n\n\t\tfor (const path of foundPaths) {\n\t\t\tretval.push(new AnchorChainingPath({ request: input, path, parent: this }));\n\t\t}\n\n\t\tif (forwardingOpts) {\n\t\t\tconst forwardingPaths = retval.filter((path) => isForwardingPath(path, forwardingOpts));\n\t\t\treturn(forwardingPaths.length === 0 ? null : forwardingPaths);\n\t\t}\n\n\t\treturn(retval);\n\t}\n\n\tasync getPlans(input: AnchorChainingPathInput, options: GetPlansOptions & { includeAllOutput: true; forwardingOnly: true | ForwardingOnlyOptions }): Promise<AnchorChainingFullForwardingOnlyPlanResult[] | null>;\n\tasync getPlans(input: AnchorChainingPathInput, options: GetPlansOptions & { includeAllOutput: true; forwardingOnly?: false; }): Promise<AnchorChainingFullPlanResult[] | null>;\n\tasync getPlans(input: AnchorChainingPathInput, options: GetPlansOptions & { includeAllOutput?: false; forwardingOnly: true | ForwardingOnlyOptions }): Promise<AnchorChainingForwardingOnlyPlan[] | null>;\n\tasync getPlans(input: AnchorChainingPathInput, options?: GetPlansOptions): Promise<AnchorChainingPlan[] | null>;\n\tasync getPlans(input: AnchorChainingPathInput, options?: GetPlansOptions): Promise<(AnchorChainingPlan | AnchorChainingForwardingOnlyPlan | AnchorChainingFullPlanResult | AnchorChainingFullForwardingOnlyPlanResult)[] | null> {\n\t\tconst forwardingOpts = normalizeForwardingOnlyOptions(options?.forwardingOnly);\n\t\tconst paths = await this.getPaths(input, {\n\t\t\t...(options?.forwardingOnly ? { forwardingOnly: options.forwardingOnly } : {}),\n\t\t\t...(options?.maxPathLength !== undefined ? { maxPathLength: options.maxPathLength } : {})\n\t\t});\n\n\t\tif (!paths) {\n\t\t\treturn(null);\n\t\t}\n\n\t\tconst limit = options?.limit ?? 3;\n\n\t\tconst sortedPaths = paths.sort((a, b) => a.path.length - b.path.length);\n\n\t\tlet successCount = 0;\n\t\tlet lowestStepsSuccessCount = Infinity;\n\t\tlet lastAttemptedPathIdx = -1;\n\n\t\tconst maxAttemptLoops = 3;\n\t\tlet currentAttemptLoop = 0;\n\n\t\tconst allOutput: PromiseSettledResult<AnchorChainingPlan | AnchorChainingForwardingOnlyPlan>[] = [];\n\n\t\twhile (successCount < limit && lastAttemptedPathIdx < sortedPaths.length - 1 && currentAttemptLoop < maxAttemptLoops) {\n\t\t\tcurrentAttemptLoop++;\n\n\t\t\tconst pathsToTry = sortedPaths.slice(lastAttemptedPathIdx + 1, lastAttemptedPathIdx + 1 + (limit - successCount));\n\n\t\t\tif (pathsToTry.length === 0 || !pathsToTry[0]) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (pathsToTry[0].path.length > lowestStepsSuccessCount) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst currentTry = await Promise.allSettled(pathsToTry.map(async function(path) {\n\t\t\t\tconst computeOptions = toComputePlanOptions(options, forwardingOpts);\n\t\t\t\tif (forwardingOpts) {\n\t\t\t\t\treturn(await AnchorChainingForwardingOnlyPlan.create(path, computeOptions));\n\t\t\t\t}\n\n\t\t\t\treturn(await AnchorChainingPlan.create(path, computeOptions));\n\t\t\t}));\n\n\t\t\tallOutput.push(...currentTry);\n\n\t\t\tfor (let i = 0; i < currentTry.length; i++) {\n\t\t\t\tconst result = currentTry[i];\n\t\t\t\tconst path = pathsToTry[i];\n\n\t\t\t\tif (!result || !path) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (result.status === 'fulfilled') {\n\t\t\t\t\tconst qualifies = !forwardingOpts || isForwardingPlan(result.value);\n\t\t\t\t\tif (qualifies) {\n\t\t\t\t\t\tsuccessCount++;\n\t\t\t\t\t\tif (path && path.path.length < lowestStepsSuccessCount) {\n\t\t\t\t\t\t\tlowestStepsSuccessCount = path.path.length;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlastAttemptedPathIdx += pathsToTry.length;\n\t\t}\n\n\t\tconst ret: (AnchorChainingPlan | AnchorChainingForwardingOnlyPlan | AnchorChainingFullPlanResult | AnchorChainingFullForwardingOnlyPlanResult)[] = [];\n\n\t\tfor (let i = 0; i < allOutput.length; i++) {\n\t\t\tconst path = sortedPaths[i];\n\t\t\tconst plan = allOutput[i];\n\n\t\t\tif (!path || !plan) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (options?.includeAllOutput) {\n\t\t\t\tif (plan.status === 'rejected') {\n\t\t\t\t\tret.push({\n\t\t\t\t\t\t...(AnchorChainingPlanCreateError.resolveErrorResponse(plan.reason)),\n\t\t\t\t\t\tpath\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tconst isForwardingPlanResult = isForwardingPlan(plan.value);\n\t\t\t\t\tif (forwardingOpts && !isForwardingPlanResult.isForwardingOnly) {\n\t\t\t\t\t\tret.push({ success: false, error: new Error('Plan does not qualify as a forwarding-only route'), path, failedAt: { providerID: isForwardingPlanResult.providerID }});\n\t\t\t\t\t} else if (plan.value instanceof AnchorChainingForwardingOnlyPlan) {\n\t\t\t\t\t\tret.push({ success: true, plan: plan.value, path });\n\t\t\t\t\t} else if (plan.value instanceof AnchorChainingPlan) {\n\t\t\t\t\t\tret.push({ success: true, plan: plan.value, path });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (plan.status === 'rejected') {\n\t\t\t\t\tthis.logger?.debug(`AnchorChaining::getPlans`, `Error computing plan for a path:`, plan.reason);\n\t\t\t\t} else if (forwardingOpts && !isForwardingPlan(plan.value).isForwardingOnly) {\n\t\t\t\t\tthis.logger?.debug(`AnchorChaining::getPlans`, `Skipping plan that does not qualify as forwarding-only`);\n\t\t\t\t} else {\n\t\t\t\t\tret.push(plan.value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (forwardingOpts && !options?.includeAllOutput && ret.length === 0) {\n\t\t\treturn(null);\n\t\t}\n\n\t\treturn(ret);\n\t}\n}\n"]}