@aephia/atlas-kit 0.6.0-next.10 → 0.6.0-next.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.
- package/README.md +3 -1
- package/dist/cargo/actions/deposit.d.ts +1 -1
- package/dist/cargo/actions/deposit.d.ts.map +1 -1
- package/dist/cargo/actions/deposit.js +29 -15
- package/dist/cargo/actions/deposit.js.map +1 -1
- package/dist/cargo/actions/index.d.ts.map +1 -1
- package/dist/cargo/actions/index.js +11 -16
- package/dist/cargo/actions/index.js.map +1 -1
- package/dist/cargo/actions/wallet-token.d.ts +1 -1
- package/dist/cargo/actions/wallet-token.d.ts.map +1 -1
- package/dist/cargo/actions/wallet-token.js +1 -9
- package/dist/cargo/actions/wallet-token.js.map +1 -1
- package/dist/cargo/actions/withdrawal.d.ts.map +1 -1
- package/dist/cargo/actions/withdrawal.js +32 -30
- package/dist/cargo/actions/withdrawal.js.map +1 -1
- package/dist/claim-stakes/actions/index.d.ts +13 -0
- package/dist/claim-stakes/actions/index.d.ts.map +1 -1
- package/dist/claim-stakes/actions/index.js +138 -112
- package/dist/claim-stakes/actions/index.js.map +1 -1
- package/dist/claim-stakes/index.d.ts +14 -0
- package/dist/claim-stakes/index.d.ts.map +1 -1
- package/dist/claim-stakes/index.js +23 -2
- package/dist/claim-stakes/index.js.map +1 -1
- package/dist/client/context.d.ts.map +1 -1
- package/dist/client/context.js +1 -1
- package/dist/client/context.js.map +1 -1
- package/dist/client/contracts.d.ts +16 -6
- package/dist/client/contracts.d.ts.map +1 -1
- package/dist/client/errors.d.ts +6 -2
- package/dist/client/errors.d.ts.map +1 -1
- package/dist/client/errors.js +31 -1
- package/dist/client/errors.js.map +1 -1
- package/dist/client/index.d.ts +35 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +35 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/rpc-subscription-provider.d.ts +35 -0
- package/dist/client/rpc-subscription-provider.d.ts.map +1 -0
- package/dist/client/rpc-subscription-provider.js +190 -0
- package/dist/client/rpc-subscription-provider.js.map +1 -0
- package/dist/combat/actions/index.d.ts.map +1 -1
- package/dist/combat/actions/index.js +105 -68
- package/dist/combat/actions/index.js.map +1 -1
- package/dist/crafting/actions/index.d.ts +11 -0
- package/dist/crafting/actions/index.d.ts.map +1 -1
- package/dist/crafting/actions/index.js +102 -109
- package/dist/crafting/actions/index.js.map +1 -1
- package/dist/crafting/index.d.ts +33 -3
- package/dist/crafting/index.d.ts.map +1 -1
- package/dist/crafting/index.js +45 -16
- package/dist/crafting/index.js.map +1 -1
- package/dist/factions/actions/index.d.ts +1 -0
- package/dist/factions/actions/index.d.ts.map +1 -1
- package/dist/factions/actions/index.js +2 -1
- package/dist/factions/actions/index.js.map +1 -1
- package/dist/factions/index.d.ts +1 -1
- package/dist/factions/index.d.ts.map +1 -1
- package/dist/factions/index.js +14 -8
- package/dist/factions/index.js.map +1 -1
- package/dist/factions/profile-faction.d.ts +20 -8
- package/dist/factions/profile-faction.d.ts.map +1 -1
- package/dist/factions/profile-faction.js +20 -8
- package/dist/factions/profile-faction.js.map +1 -1
- package/dist/fleets/actions/add-ship.d.ts +35 -0
- package/dist/fleets/actions/add-ship.d.ts.map +1 -0
- package/dist/fleets/actions/add-ship.js +149 -0
- package/dist/fleets/actions/add-ship.js.map +1 -0
- package/dist/fleets/actions/create-fleet.d.ts +36 -0
- package/dist/fleets/actions/create-fleet.d.ts.map +1 -0
- package/dist/fleets/actions/create-fleet.js +138 -0
- package/dist/fleets/actions/create-fleet.js.map +1 -0
- package/dist/fleets/actions/crew-transfer.d.ts +41 -0
- package/dist/fleets/actions/crew-transfer.d.ts.map +1 -0
- package/dist/fleets/actions/crew-transfer.js +114 -0
- package/dist/fleets/actions/crew-transfer.js.map +1 -0
- package/dist/fleets/actions/dock-bounds.d.ts +38 -0
- package/dist/fleets/actions/dock-bounds.d.ts.map +1 -0
- package/dist/fleets/actions/dock-bounds.js +46 -0
- package/dist/fleets/actions/dock-bounds.js.map +1 -0
- package/dist/fleets/actions/index.d.ts +37 -16
- package/dist/fleets/actions/index.d.ts.map +1 -1
- package/dist/fleets/actions/index.js +246 -154
- package/dist/fleets/actions/index.js.map +1 -1
- package/dist/fleets/actions/respawn.d.ts +38 -0
- package/dist/fleets/actions/respawn.d.ts.map +1 -0
- package/dist/fleets/actions/respawn.js +122 -0
- package/dist/fleets/actions/respawn.js.map +1 -0
- package/dist/fleets/actions/ship-import.d.ts.map +1 -1
- package/dist/fleets/actions/ship-import.js +43 -14
- package/dist/fleets/actions/ship-import.js.map +1 -1
- package/dist/fleets/cooldown.d.ts +44 -0
- package/dist/fleets/cooldown.d.ts.map +1 -0
- package/dist/fleets/cooldown.js +43 -0
- package/dist/fleets/cooldown.js.map +1 -0
- package/dist/fleets/coordinate-warp-estimate.d.ts +70 -0
- package/dist/fleets/coordinate-warp-estimate.d.ts.map +1 -0
- package/dist/fleets/coordinate-warp-estimate.js +46 -0
- package/dist/fleets/coordinate-warp-estimate.js.map +1 -0
- package/dist/fleets/index.d.ts +35 -0
- package/dist/fleets/index.d.ts.map +1 -1
- package/dist/fleets/index.js +52 -2
- package/dist/fleets/index.js.map +1 -1
- package/dist/fleets/movement-arithmetic.d.ts +21 -0
- package/dist/fleets/movement-arithmetic.d.ts.map +1 -0
- package/dist/fleets/movement-arithmetic.js +41 -0
- package/dist/fleets/movement-arithmetic.js.map +1 -0
- package/dist/fleets/subwarp-estimate.d.ts +70 -0
- package/dist/fleets/subwarp-estimate.d.ts.map +1 -0
- package/dist/fleets/subwarp-estimate.js +38 -0
- package/dist/fleets/subwarp-estimate.js.map +1 -0
- package/dist/fleets/travel-profile.d.ts +102 -0
- package/dist/fleets/travel-profile.d.ts.map +1 -0
- package/dist/fleets/travel-profile.js +120 -0
- package/dist/fleets/travel-profile.js.map +1 -0
- package/dist/fleets/warp-lane-estimate.d.ts +59 -0
- package/dist/fleets/warp-lane-estimate.d.ts.map +1 -0
- package/dist/fleets/warp-lane-estimate.js +36 -0
- package/dist/fleets/warp-lane-estimate.js.map +1 -0
- package/dist/fleets/warp-lane-policy.d.ts +68 -0
- package/dist/fleets/warp-lane-policy.d.ts.map +1 -0
- package/dist/fleets/warp-lane-policy.js +91 -0
- package/dist/fleets/warp-lane-policy.js.map +1 -0
- package/dist/fleets/warp-lane-toll.d.ts +55 -0
- package/dist/fleets/warp-lane-toll.d.ts.map +1 -0
- package/dist/fleets/warp-lane-toll.js +79 -0
- package/dist/fleets/warp-lane-toll.js.map +1 -0
- package/dist/identity/actions/create-profile.d.ts +2 -0
- package/dist/identity/actions/create-profile.d.ts.map +1 -1
- package/dist/identity/actions/create-profile.js +14 -9
- package/dist/identity/actions/create-profile.js.map +1 -1
- package/dist/identity/actions/index.d.ts +3 -3
- package/dist/identity/actions/index.d.ts.map +1 -1
- package/dist/identity/actions/index.js +50 -28
- package/dist/identity/actions/index.js.map +1 -1
- package/dist/identity/index.d.ts +12 -2
- package/dist/identity/index.d.ts.map +1 -1
- package/dist/identity/index.js +10 -1
- package/dist/identity/index.js.map +1 -1
- package/dist/identity/permissions.d.ts +19 -6
- package/dist/identity/permissions.d.ts.map +1 -1
- package/dist/identity/permissions.js +27 -10
- package/dist/identity/permissions.js.map +1 -1
- package/dist/identity/research-state.d.ts +60 -0
- package/dist/identity/research-state.d.ts.map +1 -0
- package/dist/identity/research-state.js +68 -0
- package/dist/identity/research-state.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -3
- package/dist/index.js.map +1 -1
- package/dist/internal/c4/account-decoding.d.ts +12 -0
- package/dist/internal/c4/account-decoding.d.ts.map +1 -0
- package/dist/internal/c4/account-decoding.js +36 -0
- package/dist/internal/c4/account-decoding.js.map +1 -0
- package/dist/internal/c4/cargo-bytes-config.d.ts +7 -0
- package/dist/internal/c4/cargo-bytes-config.d.ts.map +1 -0
- package/dist/internal/c4/cargo-bytes-config.js +19 -0
- package/dist/internal/c4/cargo-bytes-config.js.map +1 -0
- package/dist/internal/c4/character-modifier.d.ts +1 -1
- package/dist/internal/c4/character-modifier.d.ts.map +1 -1
- package/dist/internal/c4/character-registration.d.ts +2 -0
- package/dist/internal/c4/character-registration.d.ts.map +1 -1
- package/dist/internal/c4/character-registration.js +2 -0
- package/dist/internal/c4/character-registration.js.map +1 -1
- package/dist/internal/c4/character.d.ts +155 -0
- package/dist/internal/c4/character.d.ts.map +1 -0
- package/dist/internal/c4/character.js +79 -0
- package/dist/internal/c4/character.js.map +1 -0
- package/dist/internal/c4/claim-stake-configuration.js +4 -2
- package/dist/internal/c4/claim-stake-configuration.js.map +1 -1
- package/dist/internal/c4/claim-stake-definitions.d.ts +4 -4
- package/dist/internal/c4/claim-stake-definitions.d.ts.map +1 -1
- package/dist/internal/c4/claim-stake-definitions.js.map +1 -1
- package/dist/internal/c4/claim-stake.d.ts +4 -27
- package/dist/internal/c4/claim-stake.d.ts.map +1 -1
- package/dist/internal/c4/claim-stake.js +30 -41
- package/dist/internal/c4/claim-stake.js.map +1 -1
- package/dist/internal/c4/combat.d.ts +0 -27
- package/dist/internal/c4/combat.d.ts.map +1 -1
- package/dist/internal/c4/combat.js +10 -52
- package/dist/internal/c4/combat.js.map +1 -1
- package/dist/internal/c4/crafting-process-codec.d.ts +13 -0
- package/dist/internal/c4/crafting-process-codec.d.ts.map +1 -0
- package/dist/internal/c4/crafting-process-codec.js +34 -0
- package/dist/internal/c4/crafting-process-codec.js.map +1 -0
- package/dist/internal/c4/crafting.d.ts +25 -33
- package/dist/internal/c4/crafting.d.ts.map +1 -1
- package/dist/internal/c4/crafting.js +61 -49
- package/dist/internal/c4/crafting.js.map +1 -1
- package/dist/internal/c4/currency-cache.d.ts +6 -0
- package/dist/internal/c4/currency-cache.d.ts.map +1 -0
- package/dist/internal/c4/currency-cache.js +30 -0
- package/dist/internal/c4/currency-cache.js.map +1 -0
- package/dist/internal/c4/docking-funding.d.ts +4 -0
- package/dist/internal/c4/docking-funding.d.ts.map +1 -0
- package/dist/internal/c4/docking-funding.js +11 -0
- package/dist/internal/c4/docking-funding.js.map +1 -0
- package/dist/internal/c4/faction-adapter.d.ts +12 -0
- package/dist/internal/c4/faction-adapter.d.ts.map +1 -0
- package/dist/internal/c4/faction-adapter.js +52 -0
- package/dist/internal/c4/faction-adapter.js.map +1 -0
- package/dist/internal/c4/faction-epoch-meter.d.ts +10 -0
- package/dist/internal/c4/faction-epoch-meter.d.ts.map +1 -0
- package/dist/internal/c4/faction-epoch-meter.js +31 -0
- package/dist/internal/c4/faction-epoch-meter.js.map +1 -0
- package/dist/internal/c4/faction-treasury.d.ts +23 -0
- package/dist/internal/c4/faction-treasury.d.ts.map +1 -0
- package/dist/internal/c4/faction-treasury.js +48 -0
- package/dist/internal/c4/faction-treasury.js.map +1 -0
- package/dist/internal/c4/faction.d.ts +18 -0
- package/dist/internal/c4/faction.d.ts.map +1 -0
- package/dist/internal/c4/faction.js +18 -0
- package/dist/internal/c4/faction.js.map +1 -0
- package/dist/internal/c4/factions.d.ts +9 -57
- package/dist/internal/c4/factions.d.ts.map +1 -1
- package/dist/internal/c4/factions.js +29 -156
- package/dist/internal/c4/factions.js.map +1 -1
- package/dist/internal/c4/fleet-arrival.d.ts +28 -0
- package/dist/internal/c4/fleet-arrival.d.ts.map +1 -0
- package/dist/internal/c4/fleet-arrival.js +42 -0
- package/dist/internal/c4/fleet-arrival.js.map +1 -0
- package/dist/internal/c4/fleet-creation.d.ts +7 -0
- package/dist/internal/c4/fleet-creation.d.ts.map +1 -0
- package/dist/internal/c4/fleet-creation.js +180 -0
- package/dist/internal/c4/fleet-creation.js.map +1 -0
- package/dist/internal/c4/fleet-crew-binding.d.ts +9 -0
- package/dist/internal/c4/fleet-crew-binding.d.ts.map +1 -1
- package/dist/internal/c4/fleet-crew-binding.js +20 -3
- package/dist/internal/c4/fleet-crew-binding.js.map +1 -1
- package/dist/internal/c4/fleet-respawn.d.ts +17 -0
- package/dist/internal/c4/fleet-respawn.d.ts.map +1 -0
- package/dist/internal/c4/fleet-respawn.js +62 -0
- package/dist/internal/c4/fleet-respawn.js.map +1 -0
- package/dist/internal/c4/fleet-ship-assembly.d.ts +11 -0
- package/dist/internal/c4/fleet-ship-assembly.d.ts.map +1 -0
- package/dist/internal/c4/fleet-ship-assembly.js +44 -0
- package/dist/internal/c4/fleet-ship-assembly.js.map +1 -0
- package/dist/internal/c4/fleet.d.ts +45 -19
- package/dist/internal/c4/fleet.d.ts.map +1 -1
- package/dist/internal/c4/fleet.js +37 -29
- package/dist/internal/c4/fleet.js.map +1 -1
- package/dist/internal/c4/game-definition-layout.d.ts +2 -0
- package/dist/internal/c4/game-definition-layout.d.ts.map +1 -1
- package/dist/internal/c4/game-definition-layout.js +4 -0
- package/dist/internal/c4/game-definition-layout.js.map +1 -1
- package/dist/internal/c4/game.d.ts +47 -12
- package/dist/internal/c4/game.d.ts.map +1 -1
- package/dist/internal/c4/game.js +110 -21
- package/dist/internal/c4/game.js.map +1 -1
- package/dist/internal/c4/identity.d.ts +2 -152
- package/dist/internal/c4/identity.d.ts.map +1 -1
- package/dist/internal/c4/identity.js +6 -110
- package/dist/internal/c4/identity.js.map +1 -1
- package/dist/internal/c4/local-market-order.d.ts +31 -0
- package/dist/internal/c4/local-market-order.d.ts.map +1 -0
- package/dist/internal/c4/local-market-order.js +47 -0
- package/dist/internal/c4/local-market-order.js.map +1 -0
- package/dist/internal/c4/loot-layout.js +1 -1
- package/dist/internal/c4/loot-layout.js.map +1 -1
- package/dist/internal/c4/loyalty.d.ts +0 -27
- package/dist/internal/c4/loyalty.d.ts.map +1 -1
- package/dist/internal/c4/loyalty.js +14 -43
- package/dist/internal/c4/loyalty.js.map +1 -1
- package/dist/internal/c4/market.d.ts +2 -38
- package/dist/internal/c4/market.d.ts.map +1 -1
- package/dist/internal/c4/market.js +13 -51
- package/dist/internal/c4/market.js.map +1 -1
- package/dist/internal/c4/mining-instructions.d.ts +2 -0
- package/dist/internal/c4/mining-instructions.d.ts.map +1 -0
- package/dist/internal/c4/mining-instructions.js +3 -0
- package/dist/internal/c4/mining-instructions.js.map +1 -0
- package/dist/internal/c4/open-signal.d.ts +8 -0
- package/dist/internal/c4/open-signal.d.ts.map +1 -0
- package/dist/internal/c4/open-signal.js +37 -0
- package/dist/internal/c4/open-signal.js.map +1 -0
- package/dist/internal/c4/pda.js +1 -1
- package/dist/internal/c4/pda.js.map +1 -1
- package/dist/internal/c4/profile-faction.d.ts.map +1 -1
- package/dist/internal/c4/profile-faction.js +11 -21
- package/dist/internal/c4/profile-faction.js.map +1 -1
- package/dist/internal/c4/profile-permissions.d.ts +5 -3
- package/dist/internal/c4/profile-permissions.d.ts.map +1 -1
- package/dist/internal/c4/profile-permissions.js +61 -8
- package/dist/internal/c4/profile-permissions.js.map +1 -1
- package/dist/internal/c4/region-geometry.d.ts +8 -0
- package/dist/internal/c4/region-geometry.d.ts.map +1 -0
- package/dist/internal/c4/region-geometry.js +43 -0
- package/dist/internal/c4/region-geometry.js.map +1 -0
- package/dist/internal/c4/rewards.d.ts +0 -27
- package/dist/internal/c4/rewards.d.ts.map +1 -1
- package/dist/internal/c4/rewards.js +16 -41
- package/dist/internal/c4/rewards.js.map +1 -1
- package/dist/internal/c4/runtime-bindings.d.ts +4 -0
- package/dist/internal/c4/runtime-bindings.d.ts.map +1 -0
- package/dist/internal/c4/runtime-bindings.js +4 -0
- package/dist/internal/c4/runtime-bindings.js.map +1 -0
- package/dist/internal/c4/scan-detection-codecs.d.ts +3 -0
- package/dist/internal/c4/scan-detection-codecs.d.ts.map +1 -0
- package/dist/internal/c4/scan-detection-codecs.js +3 -0
- package/dist/internal/c4/scan-detection-codecs.js.map +1 -0
- package/dist/internal/c4/scan-lifecycle.d.ts +306 -0
- package/dist/internal/c4/scan-lifecycle.d.ts.map +1 -0
- package/dist/internal/c4/scan-lifecycle.js +261 -0
- package/dist/internal/c4/scan-lifecycle.js.map +1 -0
- package/dist/internal/c4/scanning.d.ts +1 -28
- package/dist/internal/c4/scanning.d.ts.map +1 -1
- package/dist/internal/c4/scanning.js +7 -36
- package/dist/internal/c4/scanning.js.map +1 -1
- package/dist/internal/c4/ship-import.d.ts +4 -0
- package/dist/internal/c4/ship-import.d.ts.map +1 -0
- package/dist/internal/c4/ship-import.js +13 -0
- package/dist/internal/c4/ship-import.js.map +1 -0
- package/dist/internal/c4/ship-stats.d.ts.map +1 -1
- package/dist/internal/c4/ship-stats.js +25 -21
- package/dist/internal/c4/ship-stats.js.map +1 -1
- package/dist/internal/c4/starbase.d.ts +0 -32
- package/dist/internal/c4/starbase.d.ts.map +1 -1
- package/dist/internal/c4/starbase.js +12 -62
- package/dist/internal/c4/starbase.js.map +1 -1
- package/dist/internal/c4/world.d.ts +36 -7
- package/dist/internal/c4/world.d.ts.map +1 -1
- package/dist/internal/c4/world.js +67 -48
- package/dist/internal/c4/world.js.map +1 -1
- package/dist/internal/cargo.d.ts +2 -0
- package/dist/internal/cargo.d.ts.map +1 -1
- package/dist/internal/cargo.js +8 -0
- package/dist/internal/cargo.js.map +1 -1
- package/dist/internal/fleet.d.ts +1 -0
- package/dist/internal/fleet.d.ts.map +1 -1
- package/dist/internal/fleet.js +3 -1
- package/dist/internal/fleet.js.map +1 -1
- package/dist/internal/loyalty-atlas-bank-state.d.ts +16 -0
- package/dist/internal/loyalty-atlas-bank-state.d.ts.map +1 -0
- package/dist/internal/loyalty-atlas-bank-state.js +10 -0
- package/dist/internal/loyalty-atlas-bank-state.js.map +1 -0
- package/dist/internal/planning/action-runtime.d.ts +38 -0
- package/dist/internal/planning/action-runtime.d.ts.map +1 -0
- package/dist/internal/planning/action-runtime.js +63 -0
- package/dist/internal/planning/action-runtime.js.map +1 -0
- package/dist/internal/planning/arrival-guards.d.ts +20 -0
- package/dist/internal/planning/arrival-guards.d.ts.map +1 -0
- package/dist/internal/planning/arrival-guards.js +187 -0
- package/dist/internal/planning/arrival-guards.js.map +1 -0
- package/dist/internal/planning/authorization-adapter.d.ts +45 -37
- package/dist/internal/planning/authorization-adapter.d.ts.map +1 -1
- package/dist/internal/planning/authorization-adapter.js +165 -76
- package/dist/internal/planning/authorization-adapter.js.map +1 -1
- package/dist/internal/planning/character-registration-guard.d.ts +4 -0
- package/dist/internal/planning/character-registration-guard.d.ts.map +1 -0
- package/dist/internal/planning/character-registration-guard.js +58 -0
- package/dist/internal/planning/character-registration-guard.js.map +1 -0
- package/dist/internal/planning/character-registration.d.ts +23 -0
- package/dist/internal/planning/character-registration.d.ts.map +1 -0
- package/dist/internal/planning/character-registration.js +87 -0
- package/dist/internal/planning/character-registration.js.map +1 -0
- package/dist/internal/planning/currency-cache-guard.d.ts +4 -0
- package/dist/internal/planning/currency-cache-guard.d.ts.map +1 -0
- package/dist/internal/planning/currency-cache-guard.js +32 -0
- package/dist/internal/planning/currency-cache-guard.js.map +1 -0
- package/dist/internal/planning/democracy-history.d.ts +50 -0
- package/dist/internal/planning/democracy-history.d.ts.map +1 -0
- package/dist/internal/planning/democracy-history.js +198 -0
- package/dist/internal/planning/democracy-history.js.map +1 -0
- package/dist/internal/planning/faction-enrollment.d.ts +0 -2
- package/dist/internal/planning/faction-enrollment.d.ts.map +1 -1
- package/dist/internal/planning/faction-enrollment.js +1 -22
- package/dist/internal/planning/faction-enrollment.js.map +1 -1
- package/dist/internal/planning/faction-trade-guards.d.ts +30 -0
- package/dist/internal/planning/faction-trade-guards.d.ts.map +1 -0
- package/dist/internal/planning/faction-trade-guards.js +15 -0
- package/dist/internal/planning/faction-trade-guards.js.map +1 -0
- package/dist/internal/planning/faction-trade-state.d.ts +16 -0
- package/dist/internal/planning/faction-trade-state.d.ts.map +1 -0
- package/dist/internal/planning/faction-trade-state.js +43 -0
- package/dist/internal/planning/faction-trade-state.js.map +1 -0
- package/dist/internal/planning/fleet-arrival.d.ts +40 -0
- package/dist/internal/planning/fleet-arrival.d.ts.map +1 -0
- package/dist/internal/planning/fleet-arrival.js +106 -0
- package/dist/internal/planning/fleet-arrival.js.map +1 -0
- package/dist/internal/planning/fleet-attack-xp.d.ts +20 -0
- package/dist/internal/planning/fleet-attack-xp.d.ts.map +1 -0
- package/dist/internal/planning/fleet-attack-xp.js +110 -0
- package/dist/internal/planning/fleet-attack-xp.js.map +1 -0
- package/dist/internal/planning/fleet-creation.d.ts +30 -0
- package/dist/internal/planning/fleet-creation.d.ts.map +1 -0
- package/dist/internal/planning/fleet-creation.js +109 -0
- package/dist/internal/planning/fleet-creation.js.map +1 -0
- package/dist/internal/planning/fleet-crew-guard.d.ts +28 -0
- package/dist/internal/planning/fleet-crew-guard.d.ts.map +1 -0
- package/dist/internal/planning/fleet-crew-guard.js +47 -0
- package/dist/internal/planning/fleet-crew-guard.js.map +1 -0
- package/dist/internal/planning/fleet-crew-transfer.d.ts +7 -0
- package/dist/internal/planning/fleet-crew-transfer.d.ts.map +1 -0
- package/dist/internal/planning/fleet-crew-transfer.js +132 -0
- package/dist/internal/planning/fleet-crew-transfer.js.map +1 -0
- package/dist/internal/planning/fleet-dock-funding-guard.d.ts +42 -0
- package/dist/internal/planning/fleet-dock-funding-guard.d.ts.map +1 -0
- package/dist/internal/planning/fleet-dock-funding-guard.js +225 -0
- package/dist/internal/planning/fleet-dock-funding-guard.js.map +1 -0
- package/dist/internal/planning/fleet-dock-funding.d.ts +9 -0
- package/dist/internal/planning/fleet-dock-funding.d.ts.map +1 -0
- package/dist/internal/planning/fleet-dock-funding.js +154 -0
- package/dist/internal/planning/fleet-dock-funding.js.map +1 -0
- package/dist/internal/planning/fleet-docking-guard.d.ts +4 -0
- package/dist/internal/planning/fleet-docking-guard.d.ts.map +1 -0
- package/dist/internal/planning/fleet-docking-guard.js +42 -0
- package/dist/internal/planning/fleet-docking-guard.js.map +1 -0
- package/dist/internal/planning/fleet-docking.d.ts +10 -0
- package/dist/internal/planning/fleet-docking.d.ts.map +1 -0
- package/dist/internal/planning/fleet-docking.js +85 -0
- package/dist/internal/planning/fleet-docking.js.map +1 -0
- package/dist/internal/planning/fleet-respawn.d.ts +28 -0
- package/dist/internal/planning/fleet-respawn.d.ts.map +1 -0
- package/dist/internal/planning/fleet-respawn.js +167 -0
- package/dist/internal/planning/fleet-respawn.js.map +1 -0
- package/dist/internal/planning/fleet-ship-assembly.d.ts +36 -0
- package/dist/internal/planning/fleet-ship-assembly.d.ts.map +1 -0
- package/dist/internal/planning/fleet-ship-assembly.js +138 -0
- package/dist/internal/planning/fleet-ship-assembly.js.map +1 -0
- package/dist/internal/planning/governance-fees.d.ts +64 -0
- package/dist/internal/planning/governance-fees.d.ts.map +1 -0
- package/dist/internal/planning/governance-fees.js +239 -0
- package/dist/internal/planning/governance-fees.js.map +1 -0
- package/dist/internal/planning/local-market-order-funding.d.ts +8 -0
- package/dist/internal/planning/local-market-order-funding.d.ts.map +1 -0
- package/dist/internal/planning/local-market-order-funding.js +127 -0
- package/dist/internal/planning/local-market-order-funding.js.map +1 -0
- package/dist/internal/planning/local-market-order.d.ts +40 -0
- package/dist/internal/planning/local-market-order.d.ts.map +1 -0
- package/dist/internal/planning/local-market-order.js +166 -0
- package/dist/internal/planning/local-market-order.js.map +1 -0
- package/dist/internal/planning/mining-stop.d.ts +14 -0
- package/dist/internal/planning/mining-stop.d.ts.map +1 -0
- package/dist/internal/planning/mining-stop.js +41 -0
- package/dist/internal/planning/mining-stop.js.map +1 -0
- package/dist/internal/planning/movement-character.d.ts +7 -0
- package/dist/internal/planning/movement-character.d.ts.map +1 -0
- package/dist/internal/planning/movement-character.js +41 -0
- package/dist/internal/planning/movement-character.js.map +1 -0
- package/dist/internal/planning/movement-xp-guard.d.ts +4 -0
- package/dist/internal/planning/movement-xp-guard.d.ts.map +1 -0
- package/dist/internal/planning/movement-xp-guard.js +103 -0
- package/dist/internal/planning/movement-xp-guard.js.map +1 -0
- package/dist/internal/planning/open-signal-guard.d.ts +3 -0
- package/dist/internal/planning/open-signal-guard.d.ts.map +1 -0
- package/dist/internal/planning/open-signal-guard.js +31 -0
- package/dist/internal/planning/open-signal-guard.js.map +1 -0
- package/dist/internal/planning/open-signal.d.ts +31 -0
- package/dist/internal/planning/open-signal.d.ts.map +1 -0
- package/dist/internal/planning/open-signal.js +86 -0
- package/dist/internal/planning/open-signal.js.map +1 -0
- package/dist/internal/planning/recipe-state.d.ts +6 -0
- package/dist/internal/planning/recipe-state.d.ts.map +1 -0
- package/dist/internal/planning/recipe-state.js +20 -0
- package/dist/internal/planning/recipe-state.js.map +1 -0
- package/dist/internal/planning/rent.d.ts +19 -0
- package/dist/internal/planning/rent.d.ts.map +1 -0
- package/dist/internal/planning/rent.js +35 -0
- package/dist/internal/planning/rent.js.map +1 -0
- package/dist/internal/planning/respawn-guards.d.ts +3 -0
- package/dist/internal/planning/respawn-guards.d.ts.map +1 -0
- package/dist/internal/planning/respawn-guards.js +41 -0
- package/dist/internal/planning/respawn-guards.js.map +1 -0
- package/dist/internal/planning/runtime-guards.d.ts +43 -0
- package/dist/internal/planning/runtime-guards.d.ts.map +1 -0
- package/dist/internal/planning/runtime-guards.js +638 -0
- package/dist/internal/planning/runtime-guards.js.map +1 -0
- package/dist/internal/planning/scan-completion-guard.d.ts +43 -0
- package/dist/internal/planning/scan-completion-guard.d.ts.map +1 -0
- package/dist/internal/planning/scan-completion-guard.js +94 -0
- package/dist/internal/planning/scan-completion-guard.js.map +1 -0
- package/dist/internal/planning/scan-completion.d.ts +20 -0
- package/dist/internal/planning/scan-completion.d.ts.map +1 -0
- package/dist/internal/planning/scan-completion.js +197 -0
- package/dist/internal/planning/scan-completion.js.map +1 -0
- package/dist/internal/planning/scan-detect-guard.d.ts +34 -0
- package/dist/internal/planning/scan-detect-guard.d.ts.map +1 -0
- package/dist/internal/planning/scan-detect-guard.js +77 -0
- package/dist/internal/planning/scan-detect-guard.js.map +1 -0
- package/dist/internal/planning/scan-detect.d.ts +24 -0
- package/dist/internal/planning/scan-detect.d.ts.map +1 -0
- package/dist/internal/planning/scan-detect.js +245 -0
- package/dist/internal/planning/scan-detect.js.map +1 -0
- package/dist/internal/planning/scan-input.d.ts +9 -0
- package/dist/internal/planning/scan-input.d.ts.map +1 -0
- package/dist/internal/planning/scan-input.js +58 -0
- package/dist/internal/planning/scan-input.js.map +1 -0
- package/dist/internal/planning/ship-import-funding.d.ts +22 -0
- package/dist/internal/planning/ship-import-funding.d.ts.map +1 -0
- package/dist/internal/planning/ship-import-funding.js +53 -0
- package/dist/internal/planning/ship-import-funding.js.map +1 -0
- package/dist/internal/planning/ship-token.d.ts +0 -1
- package/dist/internal/planning/ship-token.d.ts.map +1 -1
- package/dist/internal/planning/ship-token.js +2 -5
- package/dist/internal/planning/ship-token.js.map +1 -1
- package/dist/internal/planning/starbase-system-guard.d.ts +6 -0
- package/dist/internal/planning/starbase-system-guard.d.ts.map +1 -0
- package/dist/internal/planning/starbase-system-guard.js +93 -0
- package/dist/internal/planning/starbase-system-guard.js.map +1 -0
- package/dist/internal/planning/starbase-system.d.ts +15 -0
- package/dist/internal/planning/starbase-system.d.ts.map +1 -0
- package/dist/internal/planning/starbase-system.js +25 -0
- package/dist/internal/planning/starbase-system.js.map +1 -0
- package/dist/internal/planning/token-mint.d.ts +4 -0
- package/dist/internal/planning/token-mint.d.ts.map +1 -0
- package/dist/internal/planning/token-mint.js +15 -0
- package/dist/internal/planning/token-mint.js.map +1 -0
- package/dist/internal/planning/trade-faction-market.d.ts +20 -0
- package/dist/internal/planning/trade-faction-market.d.ts.map +1 -0
- package/dist/internal/planning/trade-faction-market.js +56 -0
- package/dist/internal/planning/trade-faction-market.js.map +1 -0
- package/dist/internal/planning/xp-runtime.d.ts +36 -0
- package/dist/internal/planning/xp-runtime.d.ts.map +1 -0
- package/dist/internal/planning/xp-runtime.js +126 -0
- package/dist/internal/planning/xp-runtime.js.map +1 -0
- package/dist/internal/system-program.d.ts +4 -0
- package/dist/internal/system-program.d.ts.map +1 -0
- package/dist/internal/system-program.js +3 -0
- package/dist/internal/system-program.js.map +1 -0
- package/dist/loyalty/actions/index.d.ts.map +1 -1
- package/dist/loyalty/actions/index.js +8 -21
- package/dist/loyalty/actions/index.js.map +1 -1
- package/dist/loyalty/index.d.ts.map +1 -1
- package/dist/loyalty/index.js +2 -6
- package/dist/loyalty/index.js.map +1 -1
- package/dist/markets/actions/index.d.ts +61 -3
- package/dist/markets/actions/index.d.ts.map +1 -1
- package/dist/markets/actions/index.js +143 -37
- package/dist/markets/actions/index.js.map +1 -1
- package/dist/markets/actions/trade-faction-market.d.ts +43 -0
- package/dist/markets/actions/trade-faction-market.d.ts.map +1 -0
- package/dist/markets/actions/trade-faction-market.js +282 -0
- package/dist/markets/actions/trade-faction-market.js.map +1 -0
- package/dist/markets/index.d.ts +38 -7
- package/dist/markets/index.d.ts.map +1 -1
- package/dist/markets/index.js +57 -10
- package/dist/markets/index.js.map +1 -1
- package/dist/mining/actions/index.d.ts +87 -0
- package/dist/mining/actions/index.d.ts.map +1 -0
- package/dist/mining/actions/index.js +332 -0
- package/dist/mining/actions/index.js.map +1 -0
- package/dist/mining/estimate.d.ts +114 -0
- package/dist/mining/estimate.d.ts.map +1 -0
- package/dist/mining/estimate.js +127 -0
- package/dist/mining/estimate.js.map +1 -0
- package/dist/mining/index.d.ts +9 -2
- package/dist/mining/index.d.ts.map +1 -1
- package/dist/mining/index.js +7 -2
- package/dist/mining/index.js.map +1 -1
- package/dist/mining/profile.d.ts +82 -0
- package/dist/mining/profile.d.ts.map +1 -0
- package/dist/mining/profile.js +109 -0
- package/dist/mining/profile.js.map +1 -0
- package/dist/planning/assembly.d.ts +5 -0
- package/dist/planning/assembly.d.ts.map +1 -1
- package/dist/planning/assembly.js +30 -2
- package/dist/planning/assembly.js.map +1 -1
- package/dist/planning/execution.d.ts +18 -3
- package/dist/planning/execution.d.ts.map +1 -1
- package/dist/planning/execution.js +492 -40
- package/dist/planning/execution.js.map +1 -1
- package/dist/planning/index.d.ts +196 -149
- package/dist/planning/index.d.ts.map +1 -1
- package/dist/planning/index.js +910 -121
- package/dist/planning/index.js.map +1 -1
- package/dist/planning/plan-sequence-checkpoint.d.ts +9 -0
- package/dist/planning/plan-sequence-checkpoint.d.ts.map +1 -1
- package/dist/planning/plan-sequence-checkpoint.js +16 -7
- package/dist/planning/plan-sequence-checkpoint.js.map +1 -1
- package/dist/planning/plan-sequence-execution.d.ts +5 -0
- package/dist/planning/plan-sequence-execution.d.ts.map +1 -1
- package/dist/planning/plan-sequence-execution.js +74 -30
- package/dist/planning/plan-sequence-execution.js.map +1 -1
- package/dist/planning/plan-sequence.d.ts +2 -1
- package/dist/planning/plan-sequence.d.ts.map +1 -1
- package/dist/planning/plan-sequence.js +8 -1
- package/dist/planning/plan-sequence.js.map +1 -1
- package/dist/planning/simulation.d.ts +25 -1
- package/dist/planning/simulation.d.ts.map +1 -1
- package/dist/planning/simulation.js +111 -11
- package/dist/planning/simulation.js.map +1 -1
- package/dist/registry/cargo.d.ts +7 -12
- package/dist/registry/cargo.d.ts.map +1 -1
- package/dist/registry/cargo.js +19 -19
- package/dist/registry/cargo.js.map +1 -1
- package/dist/registry/docking.d.ts +10 -0
- package/dist/registry/docking.d.ts.map +1 -0
- package/dist/registry/docking.js +12 -0
- package/dist/registry/docking.js.map +1 -0
- package/dist/registry/index.d.ts +4 -0
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/onboarding.d.ts +10 -2
- package/dist/registry/onboarding.d.ts.map +1 -1
- package/dist/registry/onboarding.js +20 -7
- package/dist/registry/onboarding.js.map +1 -1
- package/dist/registry/scanning.d.ts +7 -0
- package/dist/registry/scanning.d.ts.map +1 -0
- package/dist/registry/scanning.js +13 -0
- package/dist/registry/scanning.js.map +1 -0
- package/dist/registry/ship-stats-snapshot.js +19 -19
- package/dist/registry/ship-stats-snapshot.js.map +1 -1
- package/dist/registry/ships.d.ts +22 -2
- package/dist/registry/ships.d.ts.map +1 -1
- package/dist/registry/ships.js +31 -4
- package/dist/registry/ships.js.map +1 -1
- package/dist/registry/xp-runtime.d.ts +4 -0
- package/dist/registry/xp-runtime.d.ts.map +1 -0
- package/dist/registry/xp-runtime.js +14 -0
- package/dist/registry/xp-runtime.js.map +1 -0
- package/dist/scanning/actions/index.d.ts +116 -0
- package/dist/scanning/actions/index.d.ts.map +1 -0
- package/dist/scanning/actions/index.js +185 -0
- package/dist/scanning/actions/index.js.map +1 -0
- package/dist/scanning/index.d.ts +5 -2
- package/dist/scanning/index.d.ts.map +1 -1
- package/dist/scanning/index.js +13 -9
- package/dist/scanning/index.js.map +1 -1
- package/dist/scanning/lifecycle.d.ts +77 -0
- package/dist/scanning/lifecycle.d.ts.map +1 -0
- package/dist/scanning/lifecycle.js +93 -0
- package/dist/scanning/lifecycle.js.map +1 -0
- package/dist/scanning/odds.d.ts +111 -0
- package/dist/scanning/odds.d.ts.map +1 -0
- package/dist/scanning/odds.js +294 -0
- package/dist/scanning/odds.js.map +1 -0
- package/dist/scanning/signals.d.ts +121 -0
- package/dist/scanning/signals.d.ts.map +1 -0
- package/dist/scanning/signals.js +171 -0
- package/dist/scanning/signals.js.map +1 -0
- package/dist/starbases/actions/index.js +1 -1
- package/dist/starbases/actions/index.js.map +1 -1
- package/dist/world/index.d.ts +110 -5
- package/dist/world/index.d.ts.map +1 -1
- package/dist/world/index.js +109 -4
- package/dist/world/index.js.map +1 -1
- package/dist/world/planet-claim-stake-plots.d.ts +130 -0
- package/dist/world/planet-claim-stake-plots.d.ts.map +1 -0
- package/dist/world/planet-claim-stake-plots.js +110 -0
- package/dist/world/planet-claim-stake-plots.js.map +1 -0
- package/dist/world/starbase-status.d.ts +176 -0
- package/dist/world/starbase-status.d.ts.map +1 -0
- package/dist/world/starbase-status.js +153 -0
- package/dist/world/starbase-status.js.map +1 -0
- package/package.json +10 -2
|
@@ -1,12 +1,39 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { validateCurrencyCache } from '../internal/c4/currency-cache.js';
|
|
2
|
+
import { revalidateDockFunding } from '../internal/planning/fleet-dock-funding.js';
|
|
3
|
+
import { decodeDockingSequences } from '../registry/docking.js';
|
|
4
|
+
import { revalidateMarketOrder, marketOrderFundingAddresses, } from '../internal/planning/local-market-order-funding.js';
|
|
5
|
+
import { resolveFleetCrewTransfer } from '../internal/planning/fleet-crew-transfer.js';
|
|
6
|
+
import { revalidateScanCompletion } from '../internal/planning/scan-completion.js';
|
|
7
|
+
import { openSignalAddresses, validateOpenSignal, } from '../internal/planning/open-signal.js';
|
|
8
|
+
import { revalidateDetect } from '../internal/planning/scan-detect.js';
|
|
9
|
+
import { resolveFleetRespawn } from '../internal/planning/fleet-respawn.js';
|
|
10
|
+
import { validateFleetAttackActors } from '../internal/planning/fleet-attack-xp.js';
|
|
11
|
+
import { RENT_ADDRESS, readRent } from '../internal/planning/rent.js';
|
|
12
|
+
import { getBase64Decoder, } from '@solana/kit';
|
|
13
|
+
import { hashMovementCharacter } from '../internal/planning/movement-character.js';
|
|
14
|
+
import { validateFleetDockingPolicy } from '../internal/planning/fleet-docking.js';
|
|
15
|
+
import { validateStarbaseSystem } from '../internal/planning/starbase-system.js';
|
|
16
|
+
import { revalidateCharacterRegistration, isEmptySystemAccount, } from '../internal/planning/character-registration.js';
|
|
17
|
+
import { validateFleetArrivalIntent } from '../internal/planning/fleet-arrival.js';
|
|
18
|
+
import { isRuntimeGuard, revalidateRuntimeGuards, } from '../internal/planning/runtime-guards.js';
|
|
19
|
+
import { isFactionTradeGuard } from '../internal/planning/faction-trade-guards.js';
|
|
20
|
+
import { resolveShipImportFunding, validateShipImportFunding, } from '../internal/planning/ship-import-funding.js';
|
|
21
|
+
import { matchesFleetMiningState } from '../internal/planning/mining-stop.js';
|
|
22
|
+
import { requireGameAddress } from '../internal/game-context.js';
|
|
23
|
+
import { matchesFactionTradeState } from '../internal/planning/faction-trade-state.js';
|
|
24
|
+
import { resolveFleetShipAssembly, validateFleetShipAssembly, } from '../internal/planning/fleet-ship-assembly.js';
|
|
25
|
+
import { resolveFleetCreation, validateFleetCreation, } from '../internal/planning/fleet-creation.js';
|
|
26
|
+
import { validateTokenMint } from '../internal/planning/token-mint.js';
|
|
27
|
+
import { hashGameShipConfigurations, decodeGameShipAssemblyCatalog, } from '../registry/ships.js';
|
|
2
28
|
import { validateGameForCharacterRegistration } from '../registry/onboarding.js';
|
|
3
29
|
import { hashAccountState } from '../internal/planning/account-state.js';
|
|
4
|
-
import {
|
|
30
|
+
import { hashGameCargoConfigurationGuards } from '../registry/cargo.js';
|
|
5
31
|
import { validateWalletCargoCache } from '../internal/c4/wallet-cargo-cache.js';
|
|
6
32
|
import { getAddressEncoder, getProgramDerivedAddress, getAddressDecoder, getBase58Decoder, getBase64EncodedWireTransaction, getSignatureFromTransaction, isAddress, isTransactionModifyingSigner, isTransactionPartialSigner, isTransactionSendingSigner, signAndSendTransactionWithSigners, signTransactionWithSigners, } from '@solana/kit';
|
|
7
33
|
import { InvalidActionInputError, SageSdkError } from '../client/errors.js';
|
|
8
34
|
import { invalidateContextAddresses, readContextRawAccounts, } from '../client/reconciliation.js';
|
|
9
|
-
import {
|
|
35
|
+
import { assembleValidatedPlanWithContext, validateAssemblyPolicy, validatePlanAssemblyPolicy, validatePlan, } from './assembly.js';
|
|
36
|
+
import { hashRecipeConfiguration, validateRecipeUsage, } from '../internal/planning/recipe-state.js';
|
|
10
37
|
const DEFAULT_TIMEOUT_MS = 60_000;
|
|
11
38
|
const DEFAULT_POLL_INTERVAL_MS = 500;
|
|
12
39
|
const MAX_HOST_TIMER_MS = 2_147_483_647;
|
|
@@ -33,15 +60,26 @@ class MissingWriteTransportError extends SageSdkError {
|
|
|
33
60
|
super('MISSING_WRITE_TRANSPORT', 'This SAGE context has no writeRpc transport, so it cannot execute a Plan. Pass the optional writeRpc transport when creating the context, then retry.');
|
|
34
61
|
}
|
|
35
62
|
}
|
|
36
|
-
class ActionPreconditionFailedError extends SageSdkError {
|
|
63
|
+
export class ActionPreconditionFailedError extends SageSdkError {
|
|
37
64
|
describes;
|
|
38
65
|
observedSlot;
|
|
39
|
-
constructor(precondition, observedSlot) {
|
|
40
|
-
super('ACTION_PRECONDITION_FAILED', `The account state required by this Plan changed at ${
|
|
66
|
+
constructor(precondition, observedSlot, cause, address = precondition.address) {
|
|
67
|
+
super('ACTION_PRECONDITION_FAILED', `The account state required by this Plan changed at ${address}: ${cause ?? precondition.describes} Refresh the affected game state and create a new Plan before retrying.`, { address });
|
|
41
68
|
this.describes = precondition.describes;
|
|
42
69
|
this.observedSlot = observedSlot;
|
|
43
70
|
}
|
|
44
71
|
}
|
|
72
|
+
/** The cause a wrapped guard failure may carry: only a validator's own
|
|
73
|
+
* precondition cause and remedy for the guarded address. Adapter, provider and
|
|
74
|
+
* unknown failures yield `undefined`, so the wrapper falls back to the guard's
|
|
75
|
+
* generic description and never concatenates inner exception text. */
|
|
76
|
+
function guardCause(precondition, error) {
|
|
77
|
+
return error instanceof SageSdkError &&
|
|
78
|
+
error.code === 'ACTION_PRECONDITION_FAILED' &&
|
|
79
|
+
(error.address === undefined || error.address === precondition.address)
|
|
80
|
+
? error.message
|
|
81
|
+
: undefined;
|
|
82
|
+
}
|
|
45
83
|
class TransactionExpiredError extends SageSdkError {
|
|
46
84
|
signature;
|
|
47
85
|
lastValidBlockHeight;
|
|
@@ -267,15 +305,6 @@ function assertPlanTransactionMessage(expected, actual) {
|
|
|
267
305
|
invalid('signers', 'modified compiled transaction message', 'signers that preserve the assembled fee payer, instructions, programs, and account roles while optionally replacing only the transaction lifetime', 'Use a signer that signs the assembled Plan without changing its message, or reassemble a new Plan for the intended transaction before retrying.');
|
|
268
306
|
}
|
|
269
307
|
}
|
|
270
|
-
function readFinalLastValidBlockHeight(transaction) {
|
|
271
|
-
if (!('lastValidBlockHeight' in transaction.lifetimeConstraint))
|
|
272
|
-
return null;
|
|
273
|
-
const value = transaction.lifetimeConstraint.lastValidBlockHeight;
|
|
274
|
-
if (typeof value !== 'bigint' || value < 0n || value > MAX_U64) {
|
|
275
|
-
invalid('signers', 'invalid final lastValidBlockHeight metadata', 'a final transaction lifetime with lastValidBlockHeight encoded as an unsigned 64-bit bigint', 'Use a signer that returns trustworthy blockhash lifetime metadata, or use an opaque sending signer whose lifetime cannot produce a definite-expiry claim.');
|
|
276
|
-
}
|
|
277
|
-
return value;
|
|
278
|
-
}
|
|
279
308
|
// Original Token Account layout: mint/authority at 0/32, initialized state at
|
|
280
309
|
// 108, and u32 COption tags at 72/109/129. No capability decoder is imported.
|
|
281
310
|
function matchesTokenAccount(account, expected) {
|
|
@@ -293,15 +322,219 @@ function matchesTokenAccount(account, expected) {
|
|
|
293
322
|
return (decoder.decode(account.data.subarray(0, 32)) === expected.mint &&
|
|
294
323
|
decoder.decode(account.data.subarray(32, 64)) === expected.owner);
|
|
295
324
|
}
|
|
296
|
-
|
|
297
|
-
const
|
|
325
|
+
function checkRegistrationFunding(registrations, fee) {
|
|
326
|
+
const balances = new Map();
|
|
327
|
+
for (const registration of registrations) {
|
|
328
|
+
const previous = balances.get(registration.funder);
|
|
329
|
+
if (previous === undefined || registration.observedLamports < previous)
|
|
330
|
+
balances.set(registration.funder, registration.observedLamports);
|
|
331
|
+
}
|
|
332
|
+
if (fee && balances.has(fee.payer))
|
|
333
|
+
balances.set(fee.payer, balances.get(fee.payer) - fee.lamports);
|
|
334
|
+
for (const registration of registrations) {
|
|
335
|
+
const balance = balances.get(registration.funder);
|
|
336
|
+
if (balance < registration.requiredLamports)
|
|
337
|
+
throw new SageSdkError('ACTION_PRECONDITION_FAILED', 'Character registration funding cannot cover the ordered upfront storage and applicable transaction fee. Fund the wallet separately and recreate the Plan; a later Character refund cannot fund an earlier allocation.', { address: registration.funder });
|
|
338
|
+
balances.set(registration.funder, balance - registration.netDebit);
|
|
339
|
+
}
|
|
340
|
+
if (fee)
|
|
341
|
+
for (const registration of registrations) {
|
|
342
|
+
const balance = balances.get(registration.funder);
|
|
343
|
+
if (balance !== 0n && balance < registration.minimumBalance)
|
|
344
|
+
throw new SageSdkError('ACTION_PRECONDITION_FAILED', 'Character registration leaves the funder below its empty-System-account rent minimum. Leave zero or a rent-exempt balance after storage and fees, then recreate the Plan.', { address: registration.funder });
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
async function checkPreconditions(context, allPreconditions, steps, commitment) {
|
|
348
|
+
for (const guard of allPreconditions) {
|
|
349
|
+
if (guard.kind === 'fleet-crew-transfer') {
|
|
350
|
+
try {
|
|
351
|
+
await resolveFleetCrewTransfer(context, guard, guard, commitment);
|
|
352
|
+
}
|
|
353
|
+
catch (error) {
|
|
354
|
+
throw new ActionPreconditionFailedError(guard, undefined, error instanceof SageSdkError
|
|
355
|
+
? error.message
|
|
356
|
+
: 'Crew transfer prerequisites could not be verified. Refresh crew state and recreate the Plan.');
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
if (guard.kind === 'scan-completion')
|
|
360
|
+
await revalidateScanCompletion(context, guard, commitment);
|
|
361
|
+
if (guard.kind === 'scan-detect')
|
|
362
|
+
await revalidateDetect(context, guard, commitment);
|
|
363
|
+
if (guard.kind === 'fleet-attack') {
|
|
364
|
+
try {
|
|
365
|
+
await validateFleetAttackActors(context, guard);
|
|
366
|
+
}
|
|
367
|
+
catch (error) {
|
|
368
|
+
throw new ActionPreconditionFailedError(guard, undefined, guardCause(guard, error) ??
|
|
369
|
+
'The attacking or defending Fleet or Character could not be verified. Refresh both Fleets and their Characters, then recreate the Plan before signing.');
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
for (const guard of allPreconditions) {
|
|
374
|
+
if (guard.kind !== 'fleet-respawn')
|
|
375
|
+
continue;
|
|
376
|
+
try {
|
|
377
|
+
const current = await resolveFleetRespawn(context, { ...guard, fleet: guard.address }, guard, commitment);
|
|
378
|
+
const planned = steps[0].instruction;
|
|
379
|
+
const fresh = current.instruction;
|
|
380
|
+
if (planned.programAddress !== fresh.programAddress ||
|
|
381
|
+
planned.data?.length !== fresh.data?.length ||
|
|
382
|
+
fresh.data?.some((v, i) => planned.data?.[i] !== v) ||
|
|
383
|
+
planned.accounts?.length !== fresh.accounts?.length ||
|
|
384
|
+
fresh.accounts?.some((a, i) => planned.accounts?.[i]?.address !== a.address ||
|
|
385
|
+
planned.accounts?.[i]?.role !== a.role))
|
|
386
|
+
throw new SageSdkError('ACTION_PRECONDITION_FAILED', 'Recovery instruction accounts changed. Recreate and inspect the recovery Plan before signing.');
|
|
387
|
+
}
|
|
388
|
+
catch (error) {
|
|
389
|
+
throw new ActionPreconditionFailedError(guard, undefined, error instanceof SageSdkError
|
|
390
|
+
? error.message
|
|
391
|
+
: 'Recovery prerequisites could not be validated. Refresh the Fleet and recreate the Plan.');
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
const checkedXp = new Set();
|
|
395
|
+
const freshGameVersions = new Map();
|
|
396
|
+
const registrationFunding = [];
|
|
397
|
+
const initializations = new Map();
|
|
398
|
+
for (const guard of allPreconditions) {
|
|
399
|
+
if (guard.kind !== 'character-registration')
|
|
400
|
+
continue;
|
|
401
|
+
registrationFunding.push(await revalidateCharacterRegistration(context, guard, commitment, freshGameVersions, initializations));
|
|
402
|
+
}
|
|
403
|
+
checkRegistrationFunding(registrationFunding);
|
|
404
|
+
for (const guard of allPreconditions) {
|
|
405
|
+
if (guard.kind !== 'fleet-arrival')
|
|
406
|
+
continue;
|
|
407
|
+
try {
|
|
408
|
+
const current = await validateFleetArrivalIntent(context, guard.intent, freshGameVersions);
|
|
409
|
+
for (const xp of allPreconditions) {
|
|
410
|
+
if (xp.kind !== 'xp-runtime' ||
|
|
411
|
+
xp.intent.game !== current.xp.intent.game ||
|
|
412
|
+
xp.intent.character !== current.xp.intent.character ||
|
|
413
|
+
xp.intent.structure !== current.xp.intent.structure ||
|
|
414
|
+
(xp.intent.profile !== undefined &&
|
|
415
|
+
xp.intent.profile !== current.intent.profile))
|
|
416
|
+
continue;
|
|
417
|
+
if (['xpBudget', 'xpBudgetConfig', 'xpAccrual'].some((key) => xp.accounts[key] !== current.xp.accounts[key]))
|
|
418
|
+
throw new SageSdkError('ACTION_PRECONDITION_FAILED', 'Arrival XP runtime changed. Refresh the Fleet and recreate the Plan.');
|
|
419
|
+
checkedXp.add(xp);
|
|
420
|
+
}
|
|
421
|
+
if (current.character !== guard.character ||
|
|
422
|
+
current.regionTracker !== guard.regionTracker)
|
|
423
|
+
throw new SageSdkError('ACTION_PRECONDITION_FAILED', 'Arrival account links changed. Refresh the Fleet and recreate the Plan.');
|
|
424
|
+
}
|
|
425
|
+
catch (error) {
|
|
426
|
+
throw new ActionPreconditionFailedError(guard, undefined, error instanceof SageSdkError
|
|
427
|
+
? error.message
|
|
428
|
+
: 'Arrival prerequisites could not be validated. Refresh the Fleet and recreate the Plan.');
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
await revalidateRuntimeGuards(context, allPreconditions
|
|
432
|
+
.filter(isRuntimeGuard)
|
|
433
|
+
.filter((guard) => !checkedXp.has(guard)), freshGameVersions);
|
|
434
|
+
const preconditions = allPreconditions.filter((guard) => !isRuntimeGuard(guard) &&
|
|
435
|
+
guard.kind !== 'fleet-attack' &&
|
|
436
|
+
guard.kind !== 'fleet-arrival' &&
|
|
437
|
+
guard.kind !== 'character-registration' &&
|
|
438
|
+
guard.kind !== 'scan-detect' &&
|
|
439
|
+
guard.kind !== 'scan-completion' &&
|
|
440
|
+
guard.kind !== 'fleet-respawn' &&
|
|
441
|
+
guard.kind !== 'fleet-crew-transfer');
|
|
442
|
+
const fleetCreationAccounts = new Map();
|
|
443
|
+
const fleetAssemblyAccounts = new Map();
|
|
444
|
+
const importFundingAccounts = new Map();
|
|
445
|
+
const assemblyGames = new Set();
|
|
446
|
+
const assemblyCatalogs = new Map();
|
|
447
|
+
const requiredAddresses = new Set(preconditions.map(({ address }) => address));
|
|
448
|
+
for (const guard of preconditions) {
|
|
449
|
+
if (guard.kind === 'fleet-dock-funding' && guard.status === 'available') {
|
|
450
|
+
for (const address of [
|
|
451
|
+
guard.profile,
|
|
452
|
+
guard.starbasePlayer,
|
|
453
|
+
guard.system,
|
|
454
|
+
guard.game,
|
|
455
|
+
RENT_ADDRESS,
|
|
456
|
+
])
|
|
457
|
+
requiredAddresses.add(address);
|
|
458
|
+
}
|
|
459
|
+
if (guard.kind === 'fleet-docking-policy')
|
|
460
|
+
requiredAddresses.add(guard.ownership);
|
|
461
|
+
if (guard.kind === 'local-market-order' && guard.status === 'available') {
|
|
462
|
+
for (const address of [
|
|
463
|
+
guard.character,
|
|
464
|
+
guard.starbasePlayer,
|
|
465
|
+
...marketOrderFundingAddresses(guard.profile, allPreconditions),
|
|
466
|
+
])
|
|
467
|
+
requiredAddresses.add(address);
|
|
468
|
+
}
|
|
469
|
+
if (guard.kind === 'scan-signal-open') {
|
|
470
|
+
for (const address of openSignalAddresses(guard))
|
|
471
|
+
requiredAddresses.add(address);
|
|
472
|
+
}
|
|
473
|
+
if (guard.kind !== 'fleet-create')
|
|
474
|
+
continue;
|
|
475
|
+
const resolved = await resolveFleetCreation(guard);
|
|
476
|
+
if (resolved.fleet !== guard.address)
|
|
477
|
+
throw new ActionPreconditionFailedError(guard, undefined, 'The Fleet address does not match this Game, Profile and exact label. Recreate the Fleet creation Plan from its intended label.');
|
|
478
|
+
fleetCreationAccounts.set(guard, resolved);
|
|
479
|
+
for (const address of [
|
|
480
|
+
resolved.game,
|
|
481
|
+
resolved.profile,
|
|
482
|
+
resolved.system,
|
|
483
|
+
resolved.character,
|
|
484
|
+
resolved.profileFaction,
|
|
485
|
+
resolved.starbasePlayer,
|
|
486
|
+
resolved.fleet,
|
|
487
|
+
resolved.rent,
|
|
488
|
+
resolved.clock,
|
|
489
|
+
])
|
|
490
|
+
requiredAddresses.add(address);
|
|
491
|
+
}
|
|
492
|
+
for (const guard of preconditions) {
|
|
493
|
+
if (guard.kind !== 'fleet-add-ship')
|
|
494
|
+
continue;
|
|
495
|
+
const resolved = await resolveFleetShipAssembly(guard);
|
|
496
|
+
fleetAssemblyAccounts.set(guard, resolved);
|
|
497
|
+
assemblyGames.add(resolved.game);
|
|
498
|
+
for (const address of [
|
|
499
|
+
resolved.game,
|
|
500
|
+
resolved.profile,
|
|
501
|
+
resolved.system,
|
|
502
|
+
resolved.character,
|
|
503
|
+
resolved.profileFaction,
|
|
504
|
+
resolved.starbasePlayer,
|
|
505
|
+
resolved.fleet,
|
|
506
|
+
resolved.rent,
|
|
507
|
+
resolved.clock,
|
|
508
|
+
])
|
|
509
|
+
requiredAddresses.add(address);
|
|
510
|
+
}
|
|
511
|
+
for (const guard of preconditions) {
|
|
512
|
+
if (guard.kind !== 'ship-import-funding')
|
|
513
|
+
continue;
|
|
514
|
+
let resolved;
|
|
515
|
+
try {
|
|
516
|
+
resolved = await resolveShipImportFunding(guard);
|
|
517
|
+
}
|
|
518
|
+
catch {
|
|
519
|
+
throw new ActionPreconditionFailedError(guard, undefined, 'The ship import target does not match its Game, Profile and System. Refresh the canonical StarbasePlayer and prepare a new import.');
|
|
520
|
+
}
|
|
521
|
+
importFundingAccounts.set(guard, resolved);
|
|
522
|
+
for (const address of [
|
|
523
|
+
resolved.profile,
|
|
524
|
+
resolved.character,
|
|
525
|
+
resolved.starbasePlayer,
|
|
526
|
+
resolved.rent,
|
|
527
|
+
])
|
|
528
|
+
requiredAddresses.add(address);
|
|
529
|
+
}
|
|
530
|
+
const addresses = [...requiredAddresses];
|
|
298
531
|
const accounts = await readContextRawAccounts(context, addresses, {
|
|
299
532
|
commitment,
|
|
300
533
|
});
|
|
301
534
|
const byAddress = new Map(addresses.map((address, index) => [address, accounts[index]]));
|
|
302
535
|
const cargoIdsByGame = new Map();
|
|
303
536
|
for (const guard of preconditions) {
|
|
304
|
-
if (guard.kind !== 'game-cargo-config')
|
|
537
|
+
if (guard.kind !== 'game-cargo-bytes-config')
|
|
305
538
|
continue;
|
|
306
539
|
const ids = cargoIdsByGame.get(guard.address) ?? [];
|
|
307
540
|
ids.push(guard.cargoId);
|
|
@@ -319,23 +552,195 @@ async function checkPreconditions(context, preconditions, commitment) {
|
|
|
319
552
|
// Invocation-local only: every execution attempt still reads and decodes fresh state.
|
|
320
553
|
const cargoHashesByGame = new Map();
|
|
321
554
|
const validatedGames = new Set();
|
|
322
|
-
|
|
555
|
+
// One exact decode per fresh Game row, shared by every Game guard below.
|
|
556
|
+
const gameDecodes = new Map();
|
|
557
|
+
const profileFunding = new Map();
|
|
558
|
+
const fundedTargets = new Set();
|
|
559
|
+
const recordFunding = (guard, funding) => {
|
|
560
|
+
// Repeated guards for one action are assertions, not additional debits.
|
|
561
|
+
// Every guard still validates its own ceiling before reaching here.
|
|
562
|
+
const target = `${guard.kind}:${guard.address}`;
|
|
563
|
+
if (fundedTargets.has(target))
|
|
564
|
+
return;
|
|
565
|
+
fundedTargets.add(target);
|
|
566
|
+
const current = profileFunding.get(guard.profile);
|
|
567
|
+
profileFunding.set(guard.profile, {
|
|
568
|
+
debit: (current?.debit ?? 0n) + funding.profileDebit,
|
|
569
|
+
reserve: funding.profileReserve,
|
|
570
|
+
guard,
|
|
571
|
+
});
|
|
572
|
+
};
|
|
573
|
+
const fleetFailure = (guard, error) => {
|
|
574
|
+
// Only SDK diagnostics from this bounded validation batch are exposed.
|
|
575
|
+
// Never stringify provider/codec objects or retain their inner causes.
|
|
576
|
+
if (error instanceof SageSdkError &&
|
|
577
|
+
error.address !== undefined &&
|
|
578
|
+
requiredAddresses.has(error.address))
|
|
579
|
+
return new ActionPreconditionFailedError(guard, byAddress.get(error.address)?.slot, error.message, error.address);
|
|
580
|
+
return new ActionPreconditionFailedError(guard, undefined, 'Fleet prerequisites could not be validated. Refresh the related accounts and replan with a supported binding version.');
|
|
581
|
+
};
|
|
582
|
+
// A docking Plan from another deployment is reported as such before any
|
|
583
|
+
// freshness guard, whatever the saved guard order.
|
|
584
|
+
for (const precondition of preconditions)
|
|
585
|
+
if ((precondition.kind === 'fleet-dock-funding' ||
|
|
586
|
+
precondition.kind === 'fleet-docking-policy') &&
|
|
587
|
+
precondition.game !== requireGameAddress(context))
|
|
588
|
+
throw fleetFailure(precondition, new SageSdkError('ACTION_PRECONDITION_FAILED', precondition.kind === 'fleet-dock-funding'
|
|
589
|
+
? `The docking Plan belongs to Game ${precondition.game}, but the context uses Game ${requireGameAddress(context)}. Recreate it with the intended Game context.`
|
|
590
|
+
: 'The docking faction policy belongs to another Game. Recreate the Plan with the intended Game context.', { address: precondition.address }));
|
|
591
|
+
// Dependent docking estimates run after every other freshness guard, so an
|
|
592
|
+
// exact account-state or policy diagnostic wins whatever the saved order.
|
|
593
|
+
const ordered = [
|
|
594
|
+
...preconditions.filter((g) => g.kind !== 'fleet-dock-funding'),
|
|
595
|
+
...preconditions.filter((g) => g.kind === 'fleet-dock-funding'),
|
|
596
|
+
];
|
|
597
|
+
for (const precondition of ordered) {
|
|
323
598
|
const account = byAddress.get(precondition.address);
|
|
599
|
+
if (precondition.kind === 'fleet-dock-funding') {
|
|
600
|
+
try {
|
|
601
|
+
const funding = revalidateDockFunding(precondition, byAddress, precondition.status === 'available'
|
|
602
|
+
? decodeDockingSequences(byAddress.get(precondition.game), gameDecodes)
|
|
603
|
+
: undefined);
|
|
604
|
+
if (funding)
|
|
605
|
+
recordFunding(precondition, funding);
|
|
606
|
+
}
|
|
607
|
+
catch (error) {
|
|
608
|
+
throw fleetFailure(precondition, error);
|
|
609
|
+
}
|
|
610
|
+
continue;
|
|
611
|
+
}
|
|
612
|
+
if (precondition.kind === 'local-market-order') {
|
|
613
|
+
try {
|
|
614
|
+
if (precondition.game !== requireGameAddress(context))
|
|
615
|
+
throw new SageSdkError('ACTION_PRECONDITION_FAILED', 'The order belongs to another Game. Recreate it with the intended Game context.');
|
|
616
|
+
revalidateMarketOrder(precondition, byAddress, allPreconditions);
|
|
617
|
+
}
|
|
618
|
+
catch (error) {
|
|
619
|
+
const failedAddress = error instanceof SageSdkError ? error.address : undefined;
|
|
620
|
+
throw new ActionPreconditionFailedError(precondition, byAddress.get(failedAddress ?? precondition.address)?.slot, error instanceof SageSdkError
|
|
621
|
+
? error.message
|
|
622
|
+
: 'The Local Market debit bounds could not be verified. Refresh its funding accounts and recreate the order Plan.', failedAddress);
|
|
623
|
+
}
|
|
624
|
+
continue;
|
|
625
|
+
}
|
|
626
|
+
if (precondition.kind === 'scan-signal-open') {
|
|
627
|
+
if (precondition.game !== requireGameAddress(context))
|
|
628
|
+
throw new ActionPreconditionFailedError(precondition, undefined, 'This signal setup belongs to a different configured Game. Refetch and recreate the Plan using the intended Game context.');
|
|
629
|
+
try {
|
|
630
|
+
recordFunding(precondition, await validateOpenSignal(precondition, byAddress, precondition.authorityHash));
|
|
631
|
+
}
|
|
632
|
+
catch (error) {
|
|
633
|
+
throw fleetFailure(precondition, error);
|
|
634
|
+
}
|
|
635
|
+
continue;
|
|
636
|
+
}
|
|
637
|
+
if (precondition.kind === 'ship-import-funding') {
|
|
638
|
+
try {
|
|
639
|
+
const funding = validateShipImportFunding(precondition, importFundingAccounts.get(precondition), byAddress, precondition.maximumProfileDebit);
|
|
640
|
+
recordFunding(precondition, funding);
|
|
641
|
+
}
|
|
642
|
+
catch (error) {
|
|
643
|
+
throw fleetFailure(precondition, error);
|
|
644
|
+
}
|
|
645
|
+
continue;
|
|
646
|
+
}
|
|
647
|
+
if (precondition.kind === 'fleet-add-ship') {
|
|
648
|
+
try {
|
|
649
|
+
const game = byAddress.get(precondition.game);
|
|
650
|
+
let catalog = assemblyCatalogs.get(precondition.game);
|
|
651
|
+
if (!catalog && game) {
|
|
652
|
+
catalog = decodeGameShipAssemblyCatalog(game, gameDecodes);
|
|
653
|
+
assemblyCatalogs.set(precondition.game, catalog);
|
|
654
|
+
}
|
|
655
|
+
const funding = await validateFleetShipAssembly(precondition, fleetAssemblyAccounts.get(precondition), byAddress, precondition, catalog);
|
|
656
|
+
recordFunding(precondition, funding);
|
|
657
|
+
}
|
|
658
|
+
catch (error) {
|
|
659
|
+
throw fleetFailure(precondition, error);
|
|
660
|
+
}
|
|
661
|
+
continue;
|
|
662
|
+
}
|
|
663
|
+
if (precondition.kind === 'fleet-create') {
|
|
664
|
+
try {
|
|
665
|
+
const funding = await validateFleetCreation(precondition, fleetCreationAccounts.get(precondition), byAddress, precondition.maximumProfileDebit);
|
|
666
|
+
recordFunding(precondition, funding);
|
|
667
|
+
}
|
|
668
|
+
catch (error) {
|
|
669
|
+
throw fleetFailure(precondition, error);
|
|
670
|
+
}
|
|
671
|
+
continue;
|
|
672
|
+
}
|
|
673
|
+
if (precondition.kind === 'fleet-docking-policy') {
|
|
674
|
+
try {
|
|
675
|
+
await validateFleetDockingPolicy(account, byAddress.get(precondition.ownership), precondition);
|
|
676
|
+
}
|
|
677
|
+
catch (error) {
|
|
678
|
+
throw fleetFailure(precondition, error);
|
|
679
|
+
}
|
|
680
|
+
continue;
|
|
681
|
+
}
|
|
324
682
|
let narrowed = true;
|
|
683
|
+
let cause;
|
|
325
684
|
if (precondition.kind === 'token-account')
|
|
326
685
|
narrowed =
|
|
327
686
|
account !== undefined && matchesTokenAccount(account, precondition);
|
|
328
|
-
if (precondition.kind === '
|
|
687
|
+
if (precondition.kind === 'currency-cache' ||
|
|
688
|
+
precondition.kind === 'movement-character' ||
|
|
689
|
+
precondition.kind === 'starbase-system' ||
|
|
690
|
+
precondition.kind === 'fleet-mining' ||
|
|
691
|
+
isFactionTradeGuard(precondition) ||
|
|
692
|
+
precondition.kind === 'recipe-state' ||
|
|
693
|
+
precondition.kind === 'token-mint' ||
|
|
694
|
+
precondition.kind === 'game-ship-config' ||
|
|
329
695
|
precondition.kind === 'game-account' ||
|
|
330
|
-
precondition.kind === 'game-cargo-config' ||
|
|
696
|
+
precondition.kind === 'game-cargo-bytes-config' ||
|
|
331
697
|
precondition.kind === 'cargo-cache') {
|
|
332
698
|
try {
|
|
333
699
|
if (!account)
|
|
334
700
|
narrowed = false;
|
|
701
|
+
else if (precondition.kind === 'currency-cache') {
|
|
702
|
+
narrowed = precondition.game === requireGameAddress(context);
|
|
703
|
+
if (narrowed)
|
|
704
|
+
await validateCurrencyCache(account, precondition.game);
|
|
705
|
+
}
|
|
706
|
+
else if (precondition.kind === 'movement-character') {
|
|
707
|
+
narrowed =
|
|
708
|
+
precondition.game === requireGameAddress(context) &&
|
|
709
|
+
(await hashMovementCharacter(account, precondition)) ===
|
|
710
|
+
precondition.stateHash;
|
|
711
|
+
}
|
|
712
|
+
else if (precondition.kind === 'starbase-system') {
|
|
713
|
+
narrowed = precondition.game === requireGameAddress(context);
|
|
714
|
+
if (narrowed)
|
|
715
|
+
await validateStarbaseSystem(account, precondition);
|
|
716
|
+
}
|
|
717
|
+
else if (precondition.kind === 'fleet-mining') {
|
|
718
|
+
narrowed =
|
|
719
|
+
precondition.game === requireGameAddress(context) &&
|
|
720
|
+
(await matchesFleetMiningState(account, precondition));
|
|
721
|
+
}
|
|
722
|
+
else if (isFactionTradeGuard(precondition)) {
|
|
723
|
+
narrowed = await matchesFactionTradeState(account, precondition);
|
|
724
|
+
}
|
|
725
|
+
else if (precondition.kind === 'recipe-state') {
|
|
726
|
+
narrowed =
|
|
727
|
+
(await hashRecipeConfiguration(account)) ===
|
|
728
|
+
precondition.configHash;
|
|
729
|
+
if (narrowed)
|
|
730
|
+
validateRecipeUsage(account, precondition.requiredUses);
|
|
731
|
+
}
|
|
732
|
+
else if (precondition.kind === 'token-mint') {
|
|
733
|
+
narrowed = validateTokenMint(account) === precondition.decimals;
|
|
734
|
+
}
|
|
335
735
|
else if (precondition.kind === 'game-ship-config') {
|
|
336
736
|
let hashes = shipHashesByGame.get(precondition.address);
|
|
337
737
|
if (!hashes) {
|
|
338
|
-
|
|
738
|
+
let catalog = assemblyCatalogs.get(precondition.address);
|
|
739
|
+
if (!catalog && assemblyGames.has(precondition.address)) {
|
|
740
|
+
catalog = decodeGameShipAssemblyCatalog(account, gameDecodes);
|
|
741
|
+
assemblyCatalogs.set(precondition.address, catalog);
|
|
742
|
+
}
|
|
743
|
+
hashes = await hashGameShipConfigurations(account, shipIdsByGame.get(precondition.address), catalog, gameDecodes);
|
|
339
744
|
shipHashesByGame.set(precondition.address, hashes);
|
|
340
745
|
}
|
|
341
746
|
narrowed =
|
|
@@ -343,14 +748,20 @@ async function checkPreconditions(context, preconditions, commitment) {
|
|
|
343
748
|
}
|
|
344
749
|
else if (precondition.kind === 'game-account') {
|
|
345
750
|
if (!validatedGames.has(account.address)) {
|
|
346
|
-
|
|
751
|
+
if (assemblyGames.has(precondition.address)) {
|
|
752
|
+
if (!assemblyCatalogs.has(precondition.address))
|
|
753
|
+
assemblyCatalogs.set(precondition.address, decodeGameShipAssemblyCatalog(account, gameDecodes));
|
|
754
|
+
}
|
|
755
|
+
else
|
|
756
|
+
validateGameForCharacterRegistration(account, gameDecodes);
|
|
347
757
|
validatedGames.add(account.address);
|
|
348
758
|
}
|
|
349
759
|
}
|
|
350
|
-
else if (precondition.kind === 'game-cargo-config') {
|
|
760
|
+
else if (precondition.kind === 'game-cargo-bytes-config') {
|
|
351
761
|
let hashes = cargoHashesByGame.get(precondition.address);
|
|
352
762
|
if (!hashes) {
|
|
353
|
-
|
|
763
|
+
const ids = cargoIdsByGame.get(precondition.address);
|
|
764
|
+
hashes = await hashGameCargoConfigurationGuards(account, ids, gameDecodes);
|
|
354
765
|
cargoHashesByGame.set(precondition.address, hashes);
|
|
355
766
|
}
|
|
356
767
|
narrowed =
|
|
@@ -369,22 +780,35 @@ async function checkPreconditions(context, preconditions, commitment) {
|
|
|
369
780
|
canonical === account.address && bump === precondition.bump;
|
|
370
781
|
}
|
|
371
782
|
}
|
|
372
|
-
catch {
|
|
783
|
+
catch (error) {
|
|
373
784
|
narrowed = false;
|
|
785
|
+
cause = guardCause(precondition, error);
|
|
374
786
|
}
|
|
375
787
|
}
|
|
376
788
|
if (!narrowed ||
|
|
377
789
|
(precondition.kind === 'token-account-or-absent' &&
|
|
378
790
|
account !== undefined &&
|
|
379
791
|
!matchesTokenAccount(account, precondition)) ||
|
|
792
|
+
(precondition.kind === 'system-account-or-absent' &&
|
|
793
|
+
account !== undefined &&
|
|
794
|
+
(account.owner !== '11111111111111111111111111111111' ||
|
|
795
|
+
account.executable ||
|
|
796
|
+
account.data.length !== 0)) ||
|
|
380
797
|
(precondition.kind === 'account-absent' && account !== undefined) ||
|
|
381
798
|
(precondition.kind === 'account-state' &&
|
|
382
799
|
(account === undefined ||
|
|
383
800
|
(await hashAccountState(account.owner, account.data)) !==
|
|
384
801
|
precondition.dataHash))) {
|
|
385
|
-
throw new ActionPreconditionFailedError(precondition, account?.slot);
|
|
802
|
+
throw new ActionPreconditionFailedError(precondition, account?.slot, cause);
|
|
386
803
|
}
|
|
387
804
|
}
|
|
805
|
+
for (const [profile, funding] of profileFunding) {
|
|
806
|
+
// Validation above guarantees a fresh Profile from the same finite batch.
|
|
807
|
+
const account = byAddress.get(profile);
|
|
808
|
+
if (account.lamports < funding.reserve + funding.debit)
|
|
809
|
+
throw new ActionPreconditionFailedError(funding.guard, account.slot, 'The Profile cannot cover the combined Profile storage debits while preserving its rent reserve. Fund the Profile explicitly, then recreate and inspect the Plans.', profile);
|
|
810
|
+
}
|
|
811
|
+
return registrationFunding;
|
|
388
812
|
}
|
|
389
813
|
function commitmentReached(actual, requested) {
|
|
390
814
|
if (actual === null)
|
|
@@ -511,7 +935,9 @@ async function confirmTransaction(writeRpc, signature, lastValidBlockHeight, opt
|
|
|
511
935
|
}
|
|
512
936
|
}
|
|
513
937
|
}
|
|
514
|
-
async function signAndSubmit(writeRpc, transaction, signers, sendingSigner, commitment, lifecycle) {
|
|
938
|
+
async function signAndSubmit(writeRpc, transaction, contextSlot, signers, sendingSigner, commitment, lifecycle) {
|
|
939
|
+
// Capture RPC metadata before handing the transaction to any signer.
|
|
940
|
+
const { blockhash, lastValidBlockHeight: assembledHeight } = transaction.lifetimeConstraint;
|
|
515
941
|
await lifecycle?.onBeforeSign();
|
|
516
942
|
if (sendingSigner !== undefined) {
|
|
517
943
|
let enteredOpaqueSender = false;
|
|
@@ -520,7 +946,6 @@ async function signAndSubmit(writeRpc, transaction, signers, sendingSigner, comm
|
|
|
520
946
|
async signAndSendTransactions(transactions, config) {
|
|
521
947
|
for (const signed of transactions) {
|
|
522
948
|
assertPlanTransactionMessage(transaction, signed);
|
|
523
|
-
readFinalLastValidBlockHeight(signed);
|
|
524
949
|
}
|
|
525
950
|
await lifecycle?.onBeforeOpaqueInvoke();
|
|
526
951
|
enteredOpaqueSender = true;
|
|
@@ -546,8 +971,13 @@ async function signAndSubmit(writeRpc, transaction, signers, sendingSigner, comm
|
|
|
546
971
|
const signed = await signTransactionWithSigners(signingSigners, transaction);
|
|
547
972
|
assertPlanTransactionMessage(transaction, signed);
|
|
548
973
|
const signature = getSignatureFromTransaction(signed);
|
|
549
|
-
const lastValidBlockHeight =
|
|
550
|
-
|
|
974
|
+
const lastValidBlockHeight = 'blockhash' in signed.lifetimeConstraint &&
|
|
975
|
+
signed.lifetimeConstraint.blockhash === blockhash
|
|
976
|
+
? assembledHeight
|
|
977
|
+
: null;
|
|
978
|
+
await lifecycle?.onSigned(signature, lastValidBlockHeight === null
|
|
979
|
+
? null
|
|
980
|
+
: Object.freeze({ lastValidBlockHeight, contextSlot }));
|
|
551
981
|
await lifecycle?.onBeforeSubmit();
|
|
552
982
|
try {
|
|
553
983
|
const submittedSignature = await writeRpc
|
|
@@ -611,19 +1041,41 @@ export async function executePlanWithLifecycle(context, plan, options, lifecycle
|
|
|
611
1041
|
const writeRpc = context.writeRpc;
|
|
612
1042
|
if (writeRpc === undefined)
|
|
613
1043
|
throw new MissingWriteTransportError();
|
|
614
|
-
|
|
615
|
-
const
|
|
1044
|
+
// Guard order is not trusted: funding follows instruction order, including hydrated Plans.
|
|
1045
|
+
const ordered = [...plan.preconditions].sort((a, b) => {
|
|
1046
|
+
const index = (guard) => guard.kind === 'character-registration'
|
|
1047
|
+
? plan.steps.findIndex((step) => step.instruction.accounts?.[2]?.address === guard.address)
|
|
1048
|
+
: -1;
|
|
1049
|
+
return index(a) - index(b);
|
|
1050
|
+
});
|
|
1051
|
+
const registrationFunding = await checkPreconditions(context, ordered, plan.steps, validated.commitment);
|
|
1052
|
+
const { transaction, contextSlot } = await assembleValidatedPlanWithContext(writeRpc, plan, {
|
|
616
1053
|
feePayer: validated.feePayer.address,
|
|
617
1054
|
commitment: validated.commitment,
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
: { computeUnitLimit: validated.computeUnitLimit }),
|
|
621
|
-
...(validated.priorityFeeMicroLamports === undefined
|
|
622
|
-
? {}
|
|
623
|
-
: { priorityFeeMicroLamports: validated.priorityFeeMicroLamports }),
|
|
1055
|
+
computeUnitLimit: validated.computeUnitLimit,
|
|
1056
|
+
priorityFeeMicroLamports: validated.priorityFeeMicroLamports,
|
|
624
1057
|
});
|
|
1058
|
+
if (registrationFunding.length > 0) {
|
|
1059
|
+
if (typeof writeRpc.getFeeForMessage !== 'function')
|
|
1060
|
+
throw new SageSdkError('MISSING_WRITE_TRANSPORT', 'The writeRpc transport has no callable getFeeForMessage method, so Character registration cannot check current transaction fees before signing. Update the custom writeRpc transport to implement the required SageWriteRpc getFeeForMessage method, then retry.');
|
|
1061
|
+
const payer = validated.feePayer.address;
|
|
1062
|
+
const { value: fee } = await writeRpc
|
|
1063
|
+
.getFeeForMessage(getBase64Decoder().decode(transaction.messageBytes), { commitment: validated.commitment })
|
|
1064
|
+
.send();
|
|
1065
|
+
if (typeof fee !== 'bigint' || fee < 0n)
|
|
1066
|
+
throw new SageSdkError('ACTION_PRECONDITION_FAILED', 'Current transaction fee could not be determined. Refresh the blockhash and recreate the registration Plan before signing.', { address: payer });
|
|
1067
|
+
if (!registrationFunding.some((funding) => funding.funder === payer)) {
|
|
1068
|
+
const [account, rent] = await readContextRawAccounts(context, [payer, RENT_ADDRESS], { commitment: validated.commitment });
|
|
1069
|
+
if (!account || !isEmptySystemAccount(account) || !rent)
|
|
1070
|
+
throw new SageSdkError('ACTION_PRECONDITION_FAILED', 'Registration fee payer must be an existing empty System wallet with current Rent available. Select and fund it separately.', { address: payer });
|
|
1071
|
+
const remaining = account.lamports - fee;
|
|
1072
|
+
if (remaining < 0n || (remaining > 0n && remaining < readRent(rent)(0)))
|
|
1073
|
+
throw new SageSdkError('ACTION_PRECONDITION_FAILED', 'Registration fee payer cannot pay the current fee and retain zero or a rent-exempt balance. Fund it separately.', { address: payer });
|
|
1074
|
+
}
|
|
1075
|
+
checkRegistrationFunding(registrationFunding, { payer, lamports: fee });
|
|
1076
|
+
}
|
|
625
1077
|
await lifecycle?.onPrepared(sendingSigner === undefined ? 'observable' : 'opaque');
|
|
626
|
-
const submission = await signAndSubmit(writeRpc, transaction, signers, sendingSigner, validated.commitment, lifecycle);
|
|
1078
|
+
const submission = await signAndSubmit(writeRpc, transaction, contextSlot, signers, sendingSigner, validated.commitment, lifecycle);
|
|
627
1079
|
if (submission.status === 'unknown')
|
|
628
1080
|
return submission;
|
|
629
1081
|
const result = await confirmTransaction(writeRpc, submission.signature, submission.lastValidBlockHeight, validated);
|