@aephia/atlas-kit 0.6.0-next.134 → 0.6.0-next.135

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.
Files changed (54) hide show
  1. package/dist/cargo/actions/deposit.d.ts.map +1 -1
  2. package/dist/cargo/actions/deposit.js +15 -15
  3. package/dist/cargo/actions/deposit.js.map +1 -1
  4. package/dist/cargo/actions/index.d.ts.map +1 -1
  5. package/dist/cargo/actions/index.js +20 -15
  6. package/dist/cargo/actions/index.js.map +1 -1
  7. package/dist/internal/c4/discriminators.d.ts +1 -0
  8. package/dist/internal/c4/discriminators.d.ts.map +1 -1
  9. package/dist/internal/c4/discriminators.js +3 -1
  10. package/dist/internal/c4/discriminators.js.map +1 -1
  11. package/dist/internal/c4/fleet-storage.d.ts +36 -0
  12. package/dist/internal/c4/fleet-storage.d.ts.map +1 -0
  13. package/dist/internal/c4/fleet-storage.js +72 -0
  14. package/dist/internal/c4/fleet-storage.js.map +1 -0
  15. package/dist/internal/planning/cargo-storage-actions.d.ts +8 -0
  16. package/dist/internal/planning/cargo-storage-actions.d.ts.map +1 -0
  17. package/dist/internal/planning/cargo-storage-actions.js +97 -0
  18. package/dist/internal/planning/cargo-storage-actions.js.map +1 -0
  19. package/dist/internal/planning/mining-storage-actions.d.ts +11 -0
  20. package/dist/internal/planning/mining-storage-actions.d.ts.map +1 -0
  21. package/dist/internal/planning/mining-storage-actions.js +66 -0
  22. package/dist/internal/planning/mining-storage-actions.js.map +1 -0
  23. package/dist/internal/planning/profile-storage-funding-guard.d.ts +17 -10
  24. package/dist/internal/planning/profile-storage-funding-guard.d.ts.map +1 -1
  25. package/dist/internal/planning/profile-storage-funding-guard.js +32 -64
  26. package/dist/internal/planning/profile-storage-funding-guard.js.map +1 -1
  27. package/dist/internal/planning/profile-storage-funding.d.ts +1 -13
  28. package/dist/internal/planning/profile-storage-funding.d.ts.map +1 -1
  29. package/dist/internal/planning/profile-storage-funding.js +1 -13
  30. package/dist/internal/planning/profile-storage-funding.js.map +1 -1
  31. package/dist/internal/planning/storage-action-readers.d.ts +10 -0
  32. package/dist/internal/planning/storage-action-readers.d.ts.map +1 -0
  33. package/dist/internal/planning/storage-action-readers.js +25 -0
  34. package/dist/internal/planning/storage-action-readers.js.map +1 -0
  35. package/dist/internal/planning/storage-actions.d.ts +81 -0
  36. package/dist/internal/planning/storage-actions.d.ts.map +1 -0
  37. package/dist/internal/planning/storage-actions.js +177 -0
  38. package/dist/internal/planning/storage-actions.js.map +1 -0
  39. package/dist/mining/actions/index.d.ts.map +1 -1
  40. package/dist/mining/actions/index.js +71 -25
  41. package/dist/mining/actions/index.js.map +1 -1
  42. package/dist/planning/execution.d.ts.map +1 -1
  43. package/dist/planning/execution.js +11 -10
  44. package/dist/planning/execution.js.map +1 -1
  45. package/dist/planning/index.d.ts +2 -12
  46. package/dist/planning/index.d.ts.map +1 -1
  47. package/dist/planning/index.js +2 -2
  48. package/dist/planning/index.js.map +1 -1
  49. package/dist/planning/plan-construction.js +1 -1
  50. package/package.json +1 -1
  51. package/dist/internal/planning/cargo-storage.d.ts +0 -71
  52. package/dist/internal/planning/cargo-storage.d.ts.map +0 -1
  53. package/dist/internal/planning/cargo-storage.js +0 -274
  54. package/dist/internal/planning/cargo-storage.js.map +0 -1
@@ -0,0 +1,11 @@
1
+ import type { Address, Instruction } from '@solana/kit';
2
+ import type { RawAccount } from '../../client/contracts.js';
3
+ import { type StorageAction } from './storage-actions.js';
4
+ /** Reads a mining start's or stop's, or a subwarp stop's, storage effect from
5
+ * its bytes and the fresh Fleet. */
6
+ export declare function readMiningStorageAction(instruction: Instruction, accounts: ReadonlyMap<Address, RawAccount | undefined>): StorageAction;
7
+ /** The storage effect of settling a subwarp-arrived Fleet before it starts
8
+ * mining, as `combinePlans(settlement, mining)` runs: the Fleet first returns
9
+ * to Idle at its rent minimum, then grows by the mining state. */
10
+ export declare function subwarpSettlementAction(start: StorageAction, fleet: RawAccount): StorageAction;
11
+ //# sourceMappingURL=mining-storage-actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mining-storage-actions.d.ts","sourceRoot":"","sources":["../../../src/internal/planning/mining-storage-actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAW5D,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE3E;oCACoC;AACpC,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,CAAC,GACrD,aAAa,CAkDf;AAED;;kEAEkE;AAClE,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,aAAa,EACpB,KAAK,EAAE,UAAU,GAChB,aAAa,CAKf"}
@@ -0,0 +1,66 @@
1
+ import { decodeStartMiningData, decodeStopMiningData, decodeStopSubwarpData, fleetHoldLines, settleSubwarpState, startMiningState, stopMiningChange, } from '../c4/fleet-storage.js';
2
+ import { storageInstruction } from './profile-storage-funding-guard.js';
3
+ import { present, totals } from './storage-actions.js';
4
+ /** Reads a mining start's or stop's, or a subwarp stop's, storage effect from
5
+ * its bytes and the fresh Fleet. */
6
+ export function readMiningStorageAction(instruction, accounts) {
7
+ const { kind } = storageInstruction(instruction);
8
+ const metas = instruction.accounts;
9
+ const data = instruction.data;
10
+ const signer = {
11
+ profile: metas[1].address,
12
+ authority: metas[0].address,
13
+ };
14
+ if (kind === 'stop-subwarp') {
15
+ const fleet = present(accounts, metas[5].address);
16
+ return {
17
+ ...signer,
18
+ keyIndex: decodeStopSubwarpData(data).keyIndex,
19
+ settlement: 'each',
20
+ accounts: [{ address: fleet.address, state: settleSubwarpState(fleet) }],
21
+ };
22
+ }
23
+ if (kind === 'start-mining') {
24
+ const { keyIndex, resources } = decodeStartMiningData(data);
25
+ const fleet = present(accounts, metas[4].address);
26
+ return {
27
+ ...signer,
28
+ keyIndex,
29
+ settlement: 'each',
30
+ accounts: [
31
+ {
32
+ address: fleet.address,
33
+ state: startMiningState(fleet, resources),
34
+ },
35
+ ],
36
+ };
37
+ }
38
+ const { keyIndex } = decodeStopMiningData(data);
39
+ const fleet = present(accounts, metas[5].address);
40
+ const { state, resources } = stopMiningChange(fleet);
41
+ // Each mined resource may land a line in the hold. Consumption that empties
42
+ // a line is not credited, so this bounds the growth from above.
43
+ return {
44
+ ...signer,
45
+ keyIndex,
46
+ settlement: 'each',
47
+ accounts: [
48
+ {
49
+ address: fleet.address,
50
+ state,
51
+ held: fleetHoldLines(fleet),
52
+ added: totals(resources.map((cargoId) => [cargoId, 1n])),
53
+ },
54
+ ],
55
+ };
56
+ }
57
+ /** The storage effect of settling a subwarp-arrived Fleet before it starts
58
+ * mining, as `combinePlans(settlement, mining)` runs: the Fleet first returns
59
+ * to Idle at its rent minimum, then grows by the mining state. */
60
+ export function subwarpSettlementAction(start, fleet) {
61
+ return {
62
+ ...start,
63
+ accounts: [{ address: fleet.address, state: settleSubwarpState(fleet) }],
64
+ };
65
+ }
66
+ //# sourceMappingURL=mining-storage-actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mining-storage-actions.js","sourceRoot":"","sources":["../../../src/internal/planning/mining-storage-actions.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAsB,MAAM,sBAAsB,CAAC;AAE3E;oCACoC;AACpC,MAAM,UAAU,uBAAuB,CACrC,WAAwB,EACxB,QAAsD;IAEtD,MAAM,EAAE,IAAI,EAAE,GAAG,kBAAkB,CAAC,WAAW,CAAE,C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AAO,CAAC,CAAC;IACnD,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACrD,4EAA4E;IAC5E,gEAAgE;IAChE,OAAO;QACL,GAAG,MAAM;QACT,QAAQ;QACR,UAAU,EAAE,MAAM;QAClB,QAAQ,EAAE;YACR;gBACE,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,KAAK;gBACL,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;gBAC3B,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;aACzD;SACF;KACF,CAAC;AACJ,CAAC;AAED;;kEAEkE;AAClE,MAAM,UAAU,uBAAuB,CACrC,KAAoB,EACpB,KAAiB;IAEjB,OAAO;QACL,GAAG,KAAK;QACR,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;KACzE,CAAC;AACJ,CAAC"}
@@ -3,19 +3,26 @@ import type { PlanPrecondition, PlanStep } from '../../planning/index.js';
3
3
  import { type GuardSchema } from './plan-fields.js';
4
4
  /** Bytes one new cargo line (u16 cargo id, u64 amount) adds to a cargo pod. */
5
5
  export declare const CARGO_LINE_BYTES = 10;
6
- /** Cargo instructions whose storage the Profile funds. */
7
- export type CargoStorageInstruction = 'deposit' | 'starbase-transfer' | 'within-fleet-transfer';
8
- /** Which Profile-funded cargo instruction this is, if any. */
9
- export declare function cargoStorageInstruction(instruction: Instruction): CargoStorageInstruction | undefined;
10
- /** Persisted Profile storage funding of one action that resizes up to two
11
- * accounts the program normalizes to their rent minimum from the Profile. */
6
+ /** Instructions whose account storage the Profile funds. Each is evaluated in
7
+ * Plan order; all but a subwarp stop also carry a funding guard. */
8
+ export type StorageInstruction = 'deposit' | 'starbase-transfer' | 'within-fleet-transfer' | 'start-mining' | 'stop-mining' | 'stop-subwarp';
9
+ /** Which Profile-funded instruction this is, if any, the index of the account
10
+ * its guard names, and whether it carries a guard. */
11
+ export declare function storageInstruction(instruction: Instruction): {
12
+ readonly kind: StorageInstruction;
13
+ readonly primary: number;
14
+ readonly guarded: boolean;
15
+ } | undefined;
16
+ /** Persisted Profile storage funding of one action: the Profile, signer and
17
+ * first resized account that bind it to its instruction, and the planned
18
+ * debit ceiling. Everything else is rederived from the instruction. */
12
19
  export type ProfileStorageFundingGuard = Extract<PlanPrecondition, {
13
20
  readonly kind: 'profile-storage-funding';
14
21
  }>;
15
22
  export declare const PROFILE_STORAGE_FUNDING_SCHEMA: GuardSchema;
16
- /** Binds every Profile-funded cargo instruction to exactly one storage
17
- * funding guard for its Profile, signing key and resized accounts, so a saved
18
- * Plan cannot drop or retarget its funding check. Each guard must also name a
19
- * complete account pair. */
23
+ /** Binds every guarded Profile-funded instruction to exactly one storage funding guard
24
+ * for its Profile, signer and first resized account, so a saved Plan cannot
25
+ * drop or retarget its funding check; a guard without its instruction is
26
+ * refused too. */
20
27
  export declare function validateProfileStorageFundingGuards(steps: readonly PlanStep[], guards: readonly PlanPrecondition[]): void;
21
28
  //# sourceMappingURL=profile-storage-funding-guard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"profile-storage-funding-guard.d.ts","sourceRoot":"","sources":["../../../src/internal/planning/profile-storage-funding-guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAO1E,OAAO,EAGL,KAAK,WAAW,EAEjB,MAAM,kBAAkB,CAAC;AAE1B,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,0DAA0D;AAC1D,MAAM,MAAM,uBAAuB,GACjC,SAAS,GAAG,mBAAmB,GAAG,uBAAuB,CAAC;AAQ5D,8DAA8D;AAC9D,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,WAAW,GACvB,uBAAuB,GAAG,SAAS,CAKrC;AAED;6EAC6E;AAC7E,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAC9C,gBAAgB,EAChB;IAAE,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAA;CAAE,CAC7C,CAAC;AAaF,eAAO,MAAM,8BAA8B,EAAE,WAyB5C,CAAC;AAEF;;;4BAG4B;AAC5B,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,SAAS,QAAQ,EAAE,EAC1B,MAAM,EAAE,SAAS,gBAAgB,EAAE,GAClC,IAAI,CAyDN"}
1
+ {"version":3,"file":"profile-storage-funding-guard.d.ts","sourceRoot":"","sources":["../../../src/internal/planning/profile-storage-funding-guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAU1E,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAC;AAE1B,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC;oEACoE;AACpE,MAAM,MAAM,kBAAkB,GAC1B,SAAS,GACT,mBAAmB,GACnB,uBAAuB,GACvB,cAAc,GACd,aAAa,GACb,cAAc,CAAC;AAiBnB;sDACsD;AACtD,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,WAAW,GACvD;IACE,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B,GACD,SAAS,CAMZ;AAED;;uEAEuE;AACvE,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAC9C,gBAAgB,EAChB;IAAE,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAA;CAAE,CAC7C,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,WAe5C,CAAC;AAEF;;;kBAGkB;AAClB,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,SAAS,QAAQ,EAAE,EAC1B,MAAM,EAAE,SAAS,gBAAgB,EAAE,GAClC,IAAI,CA2BN"}
@@ -1,45 +1,36 @@
1
1
  import { SageSdkError } from '../../client/errors.js';
2
- import { DEPOSIT_CARGO_TO_GAME_DISCRIMINATOR, TRANSFER_CARGO_TO_FLEET_DISCRIMINATOR, TRANSFER_CARGO_WITHIN_FLEET_DISCRIMINATOR, } from '../c4/discriminators.js';
2
+ import { DEPOSIT_CARGO_TO_GAME_DISCRIMINATOR, START_MINING_ASTEROID_DISCRIMINATOR, STOP_MINING_ASTEROID_DISCRIMINATOR, STOP_SUBWARP_DISCRIMINATOR, TRANSFER_CARGO_TO_FLEET_DISCRIMINATOR, TRANSFER_CARGO_WITHIN_FLEET_DISCRIMINATOR, } from '../c4/discriminators.js';
3
3
  import { SAGE_PROGRAM_ADDRESS } from '../c4/runtime-bindings.js';
4
4
  import { MAX_U64, } from './plan-fields.js';
5
5
  /** Bytes one new cargo line (u16 cargo id, u64 amount) adds to a cargo pod. */
6
6
  export const CARGO_LINE_BYTES = 10;
7
- const CARGO_INSTRUCTIONS = [
8
- ['deposit', DEPOSIT_CARGO_TO_GAME_DISCRIMINATOR],
9
- ['starbase-transfer', TRANSFER_CARGO_TO_FLEET_DISCRIMINATOR],
10
- ['within-fleet-transfer', TRANSFER_CARGO_WITHIN_FLEET_DISCRIMINATOR],
7
+ /** Each kind's discriminator, the instruction account index of the first
8
+ * account it resizes, which names the guard, and whether it carries one. Every
9
+ * one signs with account 0 and validates the Profile at account 1. A subwarp
10
+ * stop only returns the Fleet to Idle, which releases storage and refunds the
11
+ * Profile, so it has no guard; it is evaluated so later actions see the
12
+ * settled Fleet. */
13
+ const STORAGE_INSTRUCTIONS = [
14
+ ['deposit', DEPOSIT_CARGO_TO_GAME_DISCRIMINATOR, 5, true],
15
+ ['starbase-transfer', TRANSFER_CARGO_TO_FLEET_DISCRIMINATOR, 4, true],
16
+ ['within-fleet-transfer', TRANSFER_CARGO_WITHIN_FLEET_DISCRIMINATOR, 4, true],
17
+ ['start-mining', START_MINING_ASTEROID_DISCRIMINATOR, 4, true],
18
+ ['stop-mining', STOP_MINING_ASTEROID_DISCRIMINATOR, 5, true],
19
+ ['stop-subwarp', STOP_SUBWARP_DISCRIMINATOR, 5, false],
11
20
  ];
12
- /** Which Profile-funded cargo instruction this is, if any. */
13
- export function cargoStorageInstruction(instruction) {
21
+ /** Which Profile-funded instruction this is, if any, the index of the account
22
+ * its guard names, and whether it carries a guard. */
23
+ export function storageInstruction(instruction) {
14
24
  if (instruction.programAddress !== SAGE_PROGRAM_ADDRESS)
15
25
  return undefined;
16
- return CARGO_INSTRUCTIONS.find(([, discriminator]) => discriminator.every((byte, index) => instruction.data?.[index] === byte))?.[0];
26
+ const entry = STORAGE_INSTRUCTIONS.find(([, discriminator]) => discriminator.every((byte, index) => instruction.data?.[index] === byte));
27
+ return entry && { kind: entry[0], primary: entry[2], guarded: entry[3] };
17
28
  }
18
- const LENGTH = {
19
- min: 0,
20
- max: Number.MAX_SAFE_INTEGER,
21
- accepted: 'an observed account data length in bytes',
22
- };
23
- const GROWTH = {
24
- min: -65_535,
25
- max: 65_535,
26
- accepted: 'a signed account growth in bytes',
27
- };
28
29
  export const PROFILE_STORAGE_FUNDING_SCHEMA = {
29
30
  fields: [
30
31
  ['address', 'address'],
31
32
  ['profile', 'address'],
32
33
  ['authority', 'address'],
33
- ['keyIndex', { min: 0, max: 65535, accepted: 'a u16 Profile key index' }],
34
- [
35
- 'settlement',
36
- { values: ['each', 'pair'], accepted: 'each or pair settlement' },
37
- ],
38
- ['length', LENGTH],
39
- ['growth', GROWTH],
40
- ['paired', 'address', true],
41
- ['pairedLength', LENGTH, true],
42
- ['pairedGrowth', GROWTH, true],
43
34
  [
44
35
  'maximumProfileDebit',
45
36
  {
@@ -51,48 +42,25 @@ export const PROFILE_STORAGE_FUNDING_SCHEMA = {
51
42
  ['describes', 'string'],
52
43
  ],
53
44
  };
54
- /** Binds every Profile-funded cargo instruction to exactly one storage
55
- * funding guard for its Profile, signing key and resized accounts, so a saved
56
- * Plan cannot drop or retarget its funding check. Each guard must also name a
57
- * complete account pair. */
45
+ /** Binds every guarded Profile-funded instruction to exactly one storage funding guard
46
+ * for its Profile, signer and first resized account, so a saved Plan cannot
47
+ * drop or retarget its funding check; a guard without its instruction is
48
+ * refused too. */
58
49
  export function validateProfileStorageFundingGuards(steps, guards) {
59
- const funding = guards.filter((guard) => guard.kind === 'profile-storage-funding');
60
- for (const guard of funding) {
61
- const fields = [guard.paired, guard.pairedLength, guard.pairedGrowth];
62
- const paired = fields.every((field) => field !== undefined);
63
- if ((!paired && fields.some((field) => field !== undefined)) ||
64
- (guard.settlement === 'pair' && !paired) ||
65
- guard.paired === guard.address)
66
- throw new SageSdkError('ACTION_PRECONDITION_FAILED', 'A Profile storage funding guard names an incomplete or inconsistent account pair. Recreate the Plan with its capability planner.', { address: guard.address });
67
- }
68
- const remaining = [...funding];
69
- let instructions = 0;
50
+ const remaining = guards.filter((guard) => guard.kind === 'profile-storage-funding');
70
51
  for (const { instruction } of steps) {
71
- const kind = cargoStorageInstruction(instruction);
72
- if (!kind)
52
+ const known = storageInstruction(instruction);
53
+ if (!known?.guarded)
73
54
  continue;
74
- instructions += 1;
75
- const metas = instruction.accounts ?? [];
76
- // A recognized cargo instruction has at least its 8-byte discriminator and
77
- // encodes its u16 key index last.
78
- const data = instruction.data;
79
- const keyIndex = data[data.length - 2] | (data[data.length - 1] << 8);
80
- const [address, paired, settlement] = kind === 'deposit'
81
- ? [metas[5]?.address, undefined, 'each']
82
- : kind === 'starbase-transfer'
83
- ? [metas[4]?.address, metas[8]?.address, 'pair']
84
- : [metas[4]?.address, undefined, 'each'];
85
- const index = remaining.findIndex((guard) => guard.authority === metas[0]?.address &&
55
+ const metas = instruction.accounts;
56
+ const index = remaining.findIndex((guard) => guard.authority === metas?.[0]?.address &&
86
57
  guard.profile === metas[1]?.address &&
87
- guard.keyIndex === keyIndex &&
88
- guard.address === address &&
89
- guard.paired === paired &&
90
- guard.settlement === settlement);
58
+ guard.address === metas[known.primary]?.address);
91
59
  if (index < 0)
92
- throw new SageSdkError('ACTION_PRECONDITION_FAILED', 'A cargo instruction has no matching Profile storage funding guard for its Profile, key and resized accounts. Recreate the Plan with its cargo planner.');
60
+ throw new SageSdkError('ACTION_PRECONDITION_FAILED', 'An instruction that resizes Profile-funded storage has no matching Profile storage funding guard for its Profile, signer and account. Recreate the Plan with its planner.');
93
61
  remaining.splice(index, 1);
94
62
  }
95
- if (remaining.length > 0 || instructions !== funding.length)
96
- throw new SageSdkError('ACTION_PRECONDITION_FAILED', 'A Profile storage funding guard has no matching cargo instruction. Recreate the Plan with its cargo planner.');
63
+ if (remaining.length > 0)
64
+ throw new SageSdkError('ACTION_PRECONDITION_FAILED', 'A Profile storage funding guard has no matching instruction. Recreate the Plan with its planner.');
97
65
  }
98
66
  //# sourceMappingURL=profile-storage-funding-guard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"profile-storage-funding-guard.js","sourceRoot":"","sources":["../../../src/internal/planning/profile-storage-funding-guard.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EACL,mCAAmC,EACnC,qCAAqC,EACrC,yCAAyC,GAC1C,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACL,OAAO,GAIR,MAAM,kBAAkB,CAAC;AAE1B,+EAA+E;AAC/E,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAMnC,MAAM,kBAAkB,GAAG;IACzB,CAAC,SAAS,EAAE,mCAAmC,CAAC;IAChD,CAAC,mBAAmB,EAAE,qCAAqC,CAAC;I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IAAI,YAAY,CACpB,4BAA4B,EAC5B,wJAAwJ,CACzJ,CAAC;QACJ,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAC7B,CAAC;IACD,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,YAAY,KAAK,OAAO,CAAC,MAAM;QACzD,MAAM,IAAI,YAAY,CACpB,4BAA4B,EAC5B,8GAA8G,CAC/G,CAAC;AACN,CAAC"}
1
+ {"version":3,"file":"profile-storage-funding-guard.js","sourceRoot":"","sources":["../../../src/internal/planning/profile-storage-funding-guard.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EACL,mCAAmC,EACnC,mCAAmC,EACnC,kCAAkC,EAClC,0BAA0B,EAC1B,qCAAqC,EACrC,yCAAyC,GAC1C,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACL,OAAO,GAGR,MAAM,kBAAkB,CAAC;AAE1B,+EAA+E;AAC/E,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAYnC;;;;;oBAKoB;AACpB,MAAM,oBAAoB,GAAG;IAC3B,CAAC,SAAS,EAAE,mCAAmC,EAAE,CAAC,EAAE,IAAI,CAAC;IACzD,CAAC,mBAAmB,EAAE,qCAAqC,EAAE,CAAC,EAAE,IAAI,CAAC;IACrE,CAAC,uBAAuB,EAAE,yCAAyC,EAAE,CAAC,EAAE,IAAI,CAAC;IAC7E,CAAC,cAAc,EAAE,mCAAmC,EAAE,CAAC,EAAE,IAAI,CAAC;IAC9D,CAAC,aAAa,EAAE,kCAAkC,EAAE,CAAC,EAAE,IAAI,CAAC;IAC5D,CAAC,cAAc,EAAE,0BAA0B,EAAE,CAAC,EAAE,KAAK,CAAC;CAC9C,CAAC;AAEX;sDACsD;AACtD,MAAM,UAAU,kBAAkB,CAAC,WAAwB;IAO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C,MAAM,KAAK,GAAG,SAAS,CAAC,SAAS,CAC/B,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,CAAC,SAAS,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO;YACvC,KAAK,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO;YACnC,KAAK,CAAC,OAAO,KAAK,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAClD,CAAC;QACF,IAAI,KAAK,GAAG,CAAC;YACX,MAAM,IAAI,YAAY,CACpB,4BAA4B,EAC5B,2KAA2K,CAC5K,CAAC;QACJ,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAC7B,CAAC;IACD,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;QACtB,MAAM,IAAI,YAAY,CACpB,4BAA4B,EAC5B,kGAAkG,CACnG,CAAC;AACN,CAAC"}
@@ -1,16 +1,6 @@
1
1
  import type { Address } from '@solana/kit';
2
2
  import type { RawAccount } from '../../client/contracts.js';
3
3
  import type { ProfileStorageFundingGuard } from './profile-storage-funding-guard.js';
4
- /** One resized account: its observed data length and the action's byte change. */
5
- export interface StorageResize {
6
- readonly raw: RawAccount;
7
- readonly growthBytes: number;
8
- }
9
- /** The one or two accounts an action resizes. */
10
- export type StorageResizes = readonly [StorageResize] | readonly [StorageResize, StorageResize];
11
- /** How the program settles the accounts: each normalized on its own, or one
12
- * net shortfall for the pair, where one account's surplus funds the other. */
13
- export type StorageSettlement = 'each' | 'pair';
14
4
  export interface ProfileStorageFunding {
15
5
  readonly profileDebit: bigint;
16
6
  readonly profileReserve: bigint;
@@ -31,11 +21,9 @@ export declare function checkProfileStorageFunding(input: {
31
21
  };
32
22
  /** Builds the guard and the summary sentence for one action's storage funding. */
33
23
  export declare function profileStorageFundingGuard(input: {
24
+ readonly address: Address;
34
25
  readonly profile: Address;
35
26
  readonly authority: Address;
36
- readonly keyIndex: number;
37
- readonly resizes: StorageResizes;
38
- readonly settlement: StorageSettlement;
39
27
  readonly funding: ProfileStorageFunding & {
40
28
  readonly direct: boolean;
41
29
  };
@@ -1 +1 @@
1
- {"version":3,"file":"profile-storage-funding.d.ts","sourceRoot":"","sources":["../../../src/internal/planning/profile-storage-funding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAS5D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAMrF,kFAAkF;AAClF,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,iDAAiD;AACjD,MAAM,MAAM,cAAc,GACxB,SAAS,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;AAErE;8EAC8E;AAC9E,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,MAAM,CAAC;AAEhD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAMD;;kCAEkC;AAClC,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAChD,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CACvC,GAAG,qBAAqB,GAAG;IAAE,QAAQ,CAAC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MAAM,CAAC;IACxB,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CACvC,GAAG,qBAAqB,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAkCvD;AAED,kFAAkF;AAClF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAChD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,qBAAqB,GAAG;QAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC;CACxE,GAAG;IACF,QAAQ,CAAC,KAAK,EAAE,0BAA0B,CAAC;IAC3C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,CAiBA"}
@@ -31,7 +31,6 @@ export function checkProfileStorageFunding(input) {
31
31
  }
32
32
  /** Builds the guard and the summary sentence for one action's storage funding. */
33
33
  export function profileStorageFundingGuard(input) {
34
- const [first, second] = input.resizes;
35
34
  const { profileDebit } = input.funding;
36
35
  const disclosure = profileDebit > 0n
37
36
  ? `The program funds ${profileDebit} lamports of account storage from Profile ${input.profile}'s vault with the signing key (a locked rent deposit, separate from transaction fees).${input.funding.direct ? '' : ' The selected key is not a direct Profile key, so its drainSolVault permission is checked by the program, not locally.'}`
@@ -40,20 +39,9 @@ export function profileStorageFundingGuard(input) {
40
39
  disclosure,
41
40
  guard: {
42
41
  kind: 'profile-storage-funding',
43
- address: first.raw.address,
42
+ address: input.address,
44
43
  profile: input.profile,
45
44
  authority: input.authority,
46
- keyIndex: input.keyIndex,
47
- settlement: input.settlement,
48
- length: first.raw.data.length,
49
- growth: first.growthBytes,
50
- ...(second
51
- ? {
52
- paired: second.raw.address,
53
- pairedLength: second.raw.data.length,
54
- pairedGrowth: second.growthBytes,
55
- }
56
- : {}),
57
45
  maximumProfileDebit: profileDebit,
58
46
  describes: `Account storage funding from the Profile vault stays at most ${profileDebit} lamports, and the signing key and Profile balance can fund it.`,
59
47
  },
@@ -1 +1 @@
1
- {"version":3,"file":"profile-storage-funding.js","sourceRoot":"","sources":["../../../src/internal/planning/profile-storage-funding.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,mDAAmD;AACnD,MAAM,eAAe,GAAG,GAAG,CAAC;AAqB5B,SAAS,IAAI,CAAC,OAAgB,EAAE,OAAe;IAC7C,MAAM,IAAI,YAAY,CAAC,4BAA4B,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;AAC7E,CAAC;AAED;;kCAEkC;AAClC,MAAM,UAAU,0BAA0B,CAAC,KAQ1C;IACC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IACnD,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACrC,IACE,KAAK,CAAC,mBAAmB,KAAK,SAAS;QACvC,YAAY,GAAG,KAAK,CAAC,mBAAmB;QAExC,IAAI,CACF,UAAU,CAAC,OAAO,EAClB,OAAO,MAAM,cAAc,YAAY,oDAAoD,KAAK,CAAC,mBAAmB,4NAA4N,CACjV,CAAC;IACJ,MAAM,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpD,MAAM,GAAG,GAAG,gBAAgB,CAC1B,wBAAwB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,EAChD,KA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AK,CAAC,SAAS;YAC1B,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM;YAC7B,MAAM,EAAE,KAAK,CAAC,WAAW;YACzB,GAAG,CAAC,MAAM;gBACR,CAAC,CAAC;oBACE,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,OAAO;oBAC1B,YAAY,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM;oBACpC,YAAY,EAAE,MAAM,CAAC,WAAW;iBACjC;gBACH,CAAC,CAAC,EAAE,CAAC;YACP,mBAAmB,EAAE,YAAY;YACjC,SAAS,EAAE,gEAAgE,YAAY,iEAAiE;SACzJ;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"profile-storage-funding.js","sourceRoot":"","sources":["../../../src/internal/planning/profile-storage-funding.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,mDAAmD;AACnD,MAAM,eAAe,GAAG,GAAG,CAAC;AAO5B,SAAS,IAAI,CAAC,OAAgB,EAAE,OAAe;IAC7C,MAAM,IAAI,YAAY,CAAC,4BAA4B,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;AAC7E,CAAC;AAED;;kCAEkC;AAClC,MAAM,UAAU,0BAA0B,CAAC,KAQ1C;IACC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IACnD,MAAM,IAAI,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C,CAAC,qBAAqB,YAAY,6CAA6C,KAAK,CAAC,OAAO,yFAAyF,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,wHAAwH,EAAE;QAC5U,CAAC,CAAC,0FAA0F,CAAC;IACjG,OAAO;QACL,UAAU;QACV,KAAK,EAAE;YACL,IAAI,EAAE,yBAAyB;YAC/B,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,mBAAmB,EAAE,YAAY;YACjC,SAAS,EAAE,gEAAgE,YAAY,iEAAiE;SACzJ;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { Address, Instruction } from '@solana/kit';
2
+ import type { RawAccount } from '../../client/contracts.js';
3
+ import { type StorageInstruction } from './profile-storage-funding-guard.js';
4
+ import type { StorageAction } from './storage-actions.js';
5
+ /** Fresh accounts an instruction's storage reads, besides the Profile, Rent
6
+ * sysvar and Game. */
7
+ export declare function storageActionAccounts(kind: StorageInstruction, instruction: Instruction): readonly Address[];
8
+ /** Reads any Profile-funded instruction's storage effect, for execution. */
9
+ export declare function readStorageAction(instruction: Instruction, accounts: ReadonlyMap<Address, RawAccount | undefined>, cargoIdForMint: (mint: Address) => number | undefined): StorageAction;
10
+ //# sourceMappingURL=storage-action-readers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-action-readers.d.ts","sourceRoot":"","sources":["../../../src/internal/planning/storage-action-readers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAG5D,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D;sBACsB;AACtB,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,kBAAkB,EACxB,WAAW,EAAE,WAAW,GACvB,SAAS,OAAO,EAAE,CAMpB;AAED,4EAA4E;AAC5E,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,CAAC,EACtD,cAAc,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,GACpD,aAAa,CAOf"}
@@ -0,0 +1,25 @@
1
+ import { readCargoStorageAction } from './cargo-storage-actions.js';
2
+ import { readMiningStorageAction } from './mining-storage-actions.js';
3
+ import { storageInstruction, } from './profile-storage-funding-guard.js';
4
+ /** Fresh accounts an instruction's storage reads, besides the Profile, Rent
5
+ * sysvar and Game. */
6
+ export function storageActionAccounts(kind, instruction) {
7
+ const at = (index) => instruction.accounts[index].address;
8
+ if (kind === 'deposit')
9
+ return [at(5), at(10)];
10
+ if (kind === 'starbase-transfer')
11
+ return [at(4), at(8)];
12
+ if (kind === 'stop-mining' || kind === 'stop-subwarp')
13
+ return [at(5)];
14
+ return [at(4)];
15
+ }
16
+ /** Reads any Profile-funded instruction's storage effect, for execution. */
17
+ export function readStorageAction(instruction, accounts, cargoIdForMint) {
18
+ const { kind } = storageInstruction(instruction);
19
+ return kind === 'start-mining' ||
20
+ kind === 'stop-mining' ||
21
+ kind === 'stop-subwarp'
22
+ ? readMiningStorageAction(instruction, accounts)
23
+ : readCargoStorageAction(instruction, accounts, cargoIdForMint);
24
+ }
25
+ //# sourceMappingURL=storage-action-readers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-action-readers.js","sourceRoot":"","sources":["../../../src/internal/planning/storage-action-readers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EACL,kBAAkB,GAEnB,MAAM,oCAAoC,CAAC;AAG5C;sBACsB;AACtB,MAAM,UAAU,qBAAqB,CACnC,IAAwB,EACxB,WAAwB;IAExB,MAAM,EAAE,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,WAAW,CAAC,QAAS,CAAC,KAAK,CAAE,CAAC,OAAO,CAAC;IACpE,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/C,IAAI,IAAI,KAAK,mBAAmB;QAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,IAAI,IAAI,KAAK,aAAa,IAAI,IAAI,KAAK,cAAc;QAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACtE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,iBAAiB,CAC/B,WAAwB,EACxB,QAAsD,EACtD,cAAqD;IAErD,MAAM,EAAE,IAAI,EAAE,GAAG,kBAAkB,CAAC,WAAW,CAAE,CAAC;IAClD,OAAO,IAAI,KAAK,cAAc;QAC5B,IAAI,KAAK,aAAa;QACtB,IAAI,KAAK,cAAc;QACvB,CAAC,CAAC,uBAAuB,CAAC,WAAW,EAAE,QAAQ,CAAC;QAChD,CAAC,CAAC,sBAAsB,CAAC,WAAW,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;AACpE,CAAC"}
@@ -0,0 +1,81 @@
1
+ import { type Address, type Instruction } from '@solana/kit';
2
+ import type { RawAccount } from '../../client/contracts.js';
3
+ import type { PlanStep } from '../../planning/index.js';
4
+ import { type ProfileStorageFundingGuard, type StorageInstruction } from './profile-storage-funding-guard.js';
5
+ import { type ProfileStorageFunding } from './profile-storage-funding.js';
6
+ export type CargoLines = ReadonlyMap<number, bigint>;
7
+ /** The encoded size of a Fleet's state in the fresh account and after the
8
+ * action. A Plan tracks each Fleet's state across its actions, so a change is
9
+ * measured from the state the earlier actions left, not the fresh one. */
10
+ export interface StateChange {
11
+ readonly fresh: number;
12
+ readonly after: number;
13
+ }
14
+ /** One account an action resizes: a Fleet state change, and, when it changes
15
+ * a cargo pod, the lines the fresh pod holds and those the action adds to and
16
+ * consumes from. */
17
+ export type StorageAccount = {
18
+ readonly address: Address;
19
+ readonly state?: StateChange;
20
+ } & ({
21
+ readonly held?: undefined;
22
+ } | {
23
+ readonly held: CargoLines;
24
+ readonly added: CargoLines;
25
+ readonly removed?: CargoLines;
26
+ });
27
+ /** How the program settles the resized accounts: each normalized on its own,
28
+ * or one net shortfall across them, where one account's surplus funds another. */
29
+ export type StorageSettlement = 'each' | 'net';
30
+ /** What one instruction does to Profile-funded storage, read from its bytes. */
31
+ export interface StorageAction {
32
+ readonly profile: Address;
33
+ readonly authority: Address;
34
+ readonly keyIndex: number;
35
+ readonly settlement: StorageSettlement;
36
+ readonly accounts: readonly [StorageAccount, ...StorageAccount[]];
37
+ }
38
+ /** One evaluated action's Profile debit. */
39
+ export interface StorageEvaluation {
40
+ readonly profileDebit: bigint;
41
+ }
42
+ export declare const NONE: CargoLines;
43
+ export declare function totals(entries: readonly (readonly [number, bigint | undefined])[]): CargoLines;
44
+ export declare function present(accounts: ReadonlyMap<Address, RawAccount | undefined>, address: Address): RawAccount;
45
+ /** Evaluates actions in order, as the program runs them: each resized account
46
+ * changes by its state change plus a line per cargo id a pod gains and minus a
47
+ * line its consumption empties, and after each action every resized account
48
+ * holds exactly the rent minimum of its new size. Later actions therefore see
49
+ * the state, storage and surplus earlier ones left. */
50
+ export declare function evaluateStorage(actions: readonly StorageAction[], accounts: ReadonlyMap<Address, RawAccount | undefined>): readonly StorageEvaluation[];
51
+ /** The Profile-funded steps of a Plan, in order. */
52
+ export declare function storageSteps(steps: readonly PlanStep[]): readonly (PlanStep & {
53
+ readonly kind: StorageInstruction;
54
+ })[];
55
+ /** One guard's rechecked funding, or the failure to report for it. */
56
+ export type StorageResult = {
57
+ readonly funding: ProfileStorageFunding;
58
+ } | {
59
+ readonly error: unknown;
60
+ };
61
+ /** Rechecks every Profile-funded action's storage before signing. Each
62
+ * action's effect is rederived from its instruction bytes and the fresh
63
+ * accounts, never taken from its guard, and the actions are evaluated in order
64
+ * so each meets the state, storage and surplus the earlier ones left. Each
65
+ * debit must stay within its guard's ceiling and pass the key and balance
66
+ * checks. A Fleet whose state an earlier, unevaluated action writes is refused,
67
+ * since its state change could not be measured. */
68
+ export declare function validateStorageFunding(steps: readonly PlanStep[], guards: readonly ProfileStorageFundingGuard[], accounts: ReadonlyMap<Address, RawAccount | undefined>, readAction: (instruction: Instruction) => StorageAction): ReadonlyMap<ProfileStorageFundingGuard, StorageResult>;
69
+ /** Plans one action's storage funding from the same derivation execution
70
+ * repeats: its guard and the Plan summary sentence. */
71
+ export declare function planStorageFunding(input: {
72
+ readonly action: StorageAction;
73
+ readonly accounts: ReadonlyMap<Address, RawAccount | undefined>;
74
+ readonly label: string;
75
+ /** Actions the Plan is meant to run first, such as a subwarp settlement. */
76
+ readonly preceding?: readonly StorageAction[];
77
+ }): {
78
+ readonly guard: ProfileStorageFundingGuard;
79
+ readonly disclosure: string;
80
+ };
81
+ //# sourceMappingURL=storage-actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-actions.d.ts","sourceRoot":"","sources":["../../../src/internal/planning/storage-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAE7E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAGL,KAAK,0BAA0B,EAC/B,KAAK,kBAAkB,EACxB,MAAM,oCAAoC,CAAC;AAC5C,OA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