@aephia/atlas-kit 0.7.0 → 0.8.0-next.1

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 (250) hide show
  1. package/README.md +1 -0
  2. package/dist/claim-stakes/actions/index.d.ts +43 -12
  3. package/dist/claim-stakes/actions/index.d.ts.map +1 -1
  4. package/dist/claim-stakes/actions/index.js +228 -55
  5. package/dist/claim-stakes/actions/index.js.map +1 -1
  6. package/dist/client/context.d.ts.map +1 -1
  7. package/dist/client/context.js +20 -1
  8. package/dist/client/context.js.map +1 -1
  9. package/dist/client/contracts.d.ts +9 -0
  10. package/dist/client/contracts.d.ts.map +1 -1
  11. package/dist/client/deployments.d.ts +16 -0
  12. package/dist/client/deployments.d.ts.map +1 -1
  13. package/dist/client/deployments.js +16 -0
  14. package/dist/client/deployments.js.map +1 -1
  15. package/dist/client/errors.d.ts +1 -1
  16. package/dist/client/errors.d.ts.map +1 -1
  17. package/dist/client/errors.js.map +1 -1
  18. package/dist/client/index.d.ts +18 -0
  19. package/dist/client/index.d.ts.map +1 -1
  20. package/dist/client/index.js +18 -0
  21. package/dist/client/index.js.map +1 -1
  22. package/dist/combat/actions/index.d.ts +11 -0
  23. package/dist/combat/actions/index.d.ts.map +1 -1
  24. package/dist/combat/actions/index.js +20 -12
  25. package/dist/combat/actions/index.js.map +1 -1
  26. package/dist/combat/index.d.ts +4 -2
  27. package/dist/combat/index.d.ts.map +1 -1
  28. package/dist/combat/index.js.map +1 -1
  29. package/dist/crafting/actions/index.d.ts +4 -2
  30. package/dist/crafting/actions/index.d.ts.map +1 -1
  31. package/dist/crafting/actions/index.js +6 -8
  32. package/dist/crafting/actions/index.js.map +1 -1
  33. package/dist/fleets/actions/index.d.ts +14 -10
  34. package/dist/fleets/actions/index.d.ts.map +1 -1
  35. package/dist/fleets/actions/index.js +19 -14
  36. package/dist/fleets/actions/index.js.map +1 -1
  37. package/dist/fleets/composition-stats.d.ts.map +1 -1
  38. package/dist/fleets/composition-stats.js +15 -13
  39. package/dist/fleets/composition-stats.js.map +1 -1
  40. package/dist/fleets/movement-arithmetic.d.ts +9 -1
  41. package/dist/fleets/movement-arithmetic.d.ts.map +1 -1
  42. package/dist/fleets/movement-arithmetic.js +11 -6
  43. package/dist/fleets/movement-arithmetic.js.map +1 -1
  44. package/dist/fleets/warp-lane-toll.d.ts +40 -22
  45. package/dist/fleets/warp-lane-toll.d.ts.map +1 -1
  46. package/dist/fleets/warp-lane-toll.js +36 -33
  47. package/dist/fleets/warp-lane-toll.js.map +1 -1
  48. package/dist/identity/actions/index.d.ts +1 -1
  49. package/dist/identity/actions/index.d.ts.map +1 -1
  50. package/dist/identity/actions/index.js +6 -4
  51. package/dist/identity/actions/index.js.map +1 -1
  52. package/dist/identity/actions/research-unlock.d.ts.map +1 -1
  53. package/dist/identity/actions/research-unlock.js +3 -0
  54. package/dist/identity/actions/research-unlock.js.map +1 -1
  55. package/dist/internal/c4/career-xp.d.ts +26 -2
  56. package/dist/internal/c4/career-xp.d.ts.map +1 -1
  57. package/dist/internal/c4/career-xp.js +31 -4
  58. package/dist/internal/c4/career-xp.js.map +1 -1
  59. package/dist/internal/c4/character.d.ts +10 -0
  60. package/dist/internal/c4/character.d.ts.map +1 -1
  61. package/dist/internal/c4/character.js +38 -11
  62. package/dist/internal/c4/character.js.map +1 -1
  63. package/dist/internal/c4/claim-stake-plots.d.ts +25 -7
  64. package/dist/internal/c4/claim-stake-plots.d.ts.map +1 -1
  65. package/dist/internal/c4/claim-stake-plots.js +64 -16
  66. package/dist/internal/c4/claim-stake-plots.js.map +1 -1
  67. package/dist/internal/c4/claim-stake-standing.d.ts.map +1 -1
  68. package/dist/internal/c4/claim-stake-standing.js +9 -2
  69. package/dist/internal/c4/claim-stake-standing.js.map +1 -1
  70. package/dist/internal/c4/claim-stake-storage.d.ts +3 -2
  71. package/dist/internal/c4/claim-stake-storage.d.ts.map +1 -1
  72. package/dist/internal/c4/claim-stake-storage.js +14 -8
  73. package/dist/internal/c4/claim-stake-storage.js.map +1 -1
  74. package/dist/internal/c4/claim-stake-system-cap.d.ts +15 -0
  75. package/dist/internal/c4/claim-stake-system-cap.d.ts.map +1 -0
  76. package/dist/internal/c4/claim-stake-system-cap.js +31 -0
  77. package/dist/internal/c4/claim-stake-system-cap.js.map +1 -0
  78. package/dist/internal/c4/claim-stake.js +1 -1
  79. package/dist/internal/c4/crafting-process-codec.d.ts +6 -9
  80. package/dist/internal/c4/crafting-process-codec.d.ts.map +1 -1
  81. package/dist/internal/c4/crafting-process-codec.js +9 -30
  82. package/dist/internal/c4/crafting-process-codec.js.map +1 -1
  83. package/dist/internal/c4/crafting-storage.d.ts.map +1 -1
  84. package/dist/internal/c4/crafting-storage.js +1 -0
  85. package/dist/internal/c4/crafting-storage.js.map +1 -1
  86. package/dist/internal/c4/crafting.d.ts +11 -4
  87. package/dist/internal/c4/crafting.d.ts.map +1 -1
  88. package/dist/internal/c4/crafting.js +16 -15
  89. package/dist/internal/c4/crafting.js.map +1 -1
  90. package/dist/internal/c4/discriminators.d.ts +5 -1
  91. package/dist/internal/c4/discriminators.d.ts.map +1 -1
  92. package/dist/internal/c4/discriminators.js +11 -3
  93. package/dist/internal/c4/discriminators.js.map +1 -1
  94. package/dist/internal/c4/fleet-creation.d.ts.map +1 -1
  95. package/dist/internal/c4/fleet-creation.js +3 -2
  96. package/dist/internal/c4/fleet-creation.js.map +1 -1
  97. package/dist/internal/c4/fleet-storage.d.ts.map +1 -1
  98. package/dist/internal/c4/fleet-storage.js +6 -1
  99. package/dist/internal/c4/fleet-storage.js.map +1 -1
  100. package/dist/internal/c4/fleet.d.ts +37 -17
  101. package/dist/internal/c4/fleet.d.ts.map +1 -1
  102. package/dist/internal/c4/fleet.js +4 -1
  103. package/dist/internal/c4/fleet.js.map +1 -1
  104. package/dist/internal/c4/game.d.ts +9 -0
  105. package/dist/internal/c4/game.d.ts.map +1 -1
  106. package/dist/internal/c4/game.js +18 -3
  107. package/dist/internal/c4/game.js.map +1 -1
  108. package/dist/internal/c4/local-market-order.d.ts +1 -0
  109. package/dist/internal/c4/local-market-order.d.ts.map +1 -1
  110. package/dist/internal/c4/local-market-order.js +1 -0
  111. package/dist/internal/c4/local-market-order.js.map +1 -1
  112. package/dist/internal/c4/pda.d.ts +16 -1
  113. package/dist/internal/c4/pda.d.ts.map +1 -1
  114. package/dist/internal/c4/pda.js +26 -1
  115. package/dist/internal/c4/pda.js.map +1 -1
  116. package/dist/internal/c4/profile-permissions.d.ts +1 -1
  117. package/dist/internal/c4/profile-permissions.d.ts.map +1 -1
  118. package/dist/internal/c4/profile-permissions.js +9 -11
  119. package/dist/internal/c4/profile-permissions.js.map +1 -1
  120. package/dist/internal/c4/region-building-policy.d.ts +17 -0
  121. package/dist/internal/c4/region-building-policy.d.ts.map +1 -0
  122. package/dist/internal/c4/region-building-policy.js +40 -0
  123. package/dist/internal/c4/region-building-policy.js.map +1 -0
  124. package/dist/internal/c4/runtime-bindings.d.ts +1 -1
  125. package/dist/internal/c4/runtime-bindings.d.ts.map +1 -1
  126. package/dist/internal/c4/runtime-bindings.js +1 -1
  127. package/dist/internal/c4/runtime-bindings.js.map +1 -1
  128. package/dist/internal/c4/ship-stats.js +17 -17
  129. package/dist/internal/c4/ship-stats.js.map +1 -1
  130. package/dist/internal/c4/world.d.ts +5 -4
  131. package/dist/internal/c4/world.d.ts.map +1 -1
  132. package/dist/internal/c4/world.js +18 -2
  133. package/dist/internal/c4/world.js.map +1 -1
  134. package/dist/internal/cargo.d.ts +3 -0
  135. package/dist/internal/cargo.d.ts.map +1 -1
  136. package/dist/internal/cargo.js +5 -0
  137. package/dist/internal/cargo.js.map +1 -1
  138. package/dist/internal/planning/action-runtime.d.ts +6 -3
  139. package/dist/internal/planning/action-runtime.d.ts.map +1 -1
  140. package/dist/internal/planning/action-runtime.js +1 -6
  141. package/dist/internal/planning/action-runtime.js.map +1 -1
  142. package/dist/internal/planning/arrival-guards.js +2 -2
  143. package/dist/internal/planning/arrival-guards.js.map +1 -1
  144. package/dist/internal/planning/authorization-adapter.d.ts +20 -8
  145. package/dist/internal/planning/authorization-adapter.d.ts.map +1 -1
  146. package/dist/internal/planning/authorization-adapter.js +32 -9
  147. package/dist/internal/planning/authorization-adapter.js.map +1 -1
  148. package/dist/internal/planning/character-access.d.ts +1 -6
  149. package/dist/internal/planning/character-access.d.ts.map +1 -1
  150. package/dist/internal/planning/character-access.js +2 -7
  151. package/dist/internal/planning/character-access.js.map +1 -1
  152. package/dist/internal/planning/character-registration.js +1 -1
  153. package/dist/internal/planning/character-registration.js.map +1 -1
  154. package/dist/internal/planning/crafting-storage-actions.js +3 -3
  155. package/dist/internal/planning/crafting-storage-actions.js.map +1 -1
  156. package/dist/internal/planning/democracy-history.d.ts +5 -0
  157. package/dist/internal/planning/democracy-history.d.ts.map +1 -1
  158. package/dist/internal/planning/democracy-history.js +48 -6
  159. package/dist/internal/planning/democracy-history.js.map +1 -1
  160. package/dist/internal/planning/fleet-arrival.d.ts +2 -2
  161. package/dist/internal/planning/fleet-attack-xp.d.ts.map +1 -1
  162. package/dist/internal/planning/fleet-attack-xp.js +6 -5
  163. package/dist/internal/planning/fleet-attack-xp.js.map +1 -1
  164. package/dist/internal/planning/fleet-dock-funding.js +2 -2
  165. package/dist/internal/planning/fleet-dock-funding.js.map +1 -1
  166. package/dist/internal/planning/fleet-respawn.d.ts.map +1 -1
  167. package/dist/internal/planning/fleet-respawn.js +3 -4
  168. package/dist/internal/planning/fleet-respawn.js.map +1 -1
  169. package/dist/internal/planning/governance-fees.d.ts +14 -4
  170. package/dist/internal/planning/governance-fees.d.ts.map +1 -1
  171. package/dist/internal/planning/governance-fees.js +66 -21
  172. package/dist/internal/planning/governance-fees.js.map +1 -1
  173. package/dist/internal/planning/local-market-order-funding.d.ts.map +1 -1
  174. package/dist/internal/planning/local-market-order-funding.js +2 -2
  175. package/dist/internal/planning/local-market-order-funding.js.map +1 -1
  176. package/dist/internal/planning/mining-stop.js +1 -1
  177. package/dist/internal/planning/mining-stop.js.map +1 -1
  178. package/dist/internal/planning/movement-xp-guard.d.ts.map +1 -1
  179. package/dist/internal/planning/movement-xp-guard.js +0 -1
  180. package/dist/internal/planning/movement-xp-guard.js.map +1 -1
  181. package/dist/internal/planning/plan-guards.js +2 -2
  182. package/dist/internal/planning/rent-catalog.d.ts.map +1 -1
  183. package/dist/internal/planning/rent-catalog.js +14 -4
  184. package/dist/internal/planning/rent-catalog.js.map +1 -1
  185. package/dist/internal/planning/research-unlock.d.ts.map +1 -1
  186. package/dist/internal/planning/research-unlock.js +12 -1
  187. package/dist/internal/planning/research-unlock.js.map +1 -1
  188. package/dist/internal/planning/runtime-guards.d.ts.map +1 -1
  189. package/dist/internal/planning/runtime-guards.js +90 -71
  190. package/dist/internal/planning/runtime-guards.js.map +1 -1
  191. package/dist/internal/planning/xp-runtime.d.ts +4 -5
  192. package/dist/internal/planning/xp-runtime.d.ts.map +1 -1
  193. package/dist/internal/planning/xp-runtime.js +26 -51
  194. package/dist/internal/planning/xp-runtime.js.map +1 -1
  195. package/dist/mining/actions/index.d.ts +5 -3
  196. package/dist/mining/actions/index.d.ts.map +1 -1
  197. package/dist/mining/actions/index.js +7 -5
  198. package/dist/mining/actions/index.js.map +1 -1
  199. package/dist/planning/assembly.d.ts +12 -5
  200. package/dist/planning/assembly.d.ts.map +1 -1
  201. package/dist/planning/assembly.js +22 -18
  202. package/dist/planning/assembly.js.map +1 -1
  203. package/dist/planning/execution.d.ts.map +1 -1
  204. package/dist/planning/execution.js +3 -5
  205. package/dist/planning/execution.js.map +1 -1
  206. package/dist/planning/index.d.ts +3 -2
  207. package/dist/planning/index.d.ts.map +1 -1
  208. package/dist/planning/index.js +2 -2
  209. package/dist/planning/index.js.map +1 -1
  210. package/dist/planning/plan-construction.js +1 -1
  211. package/dist/planning/selected-references.d.ts +17 -0
  212. package/dist/planning/selected-references.d.ts.map +1 -0
  213. package/dist/planning/selected-references.js +42 -0
  214. package/dist/planning/selected-references.js.map +1 -0
  215. package/dist/planning/simulation.d.ts.map +1 -1
  216. package/dist/planning/simulation.js +2 -3
  217. package/dist/planning/simulation.js.map +1 -1
  218. package/dist/ptr/account.d.ts +109 -0
  219. package/dist/ptr/account.d.ts.map +1 -0
  220. package/dist/ptr/account.js +421 -0
  221. package/dist/ptr/account.js.map +1 -0
  222. package/dist/ptr/context.d.ts +4 -0
  223. package/dist/ptr/context.d.ts.map +1 -0
  224. package/dist/ptr/context.js +15 -0
  225. package/dist/ptr/context.js.map +1 -0
  226. package/dist/ptr/errors.d.ts +91 -0
  227. package/dist/ptr/errors.d.ts.map +1 -0
  228. package/dist/ptr/errors.js +74 -0
  229. package/dist/ptr/errors.js.map +1 -0
  230. package/dist/ptr/faucet.d.ts +231 -0
  231. package/dist/ptr/faucet.d.ts.map +1 -0
  232. package/dist/ptr/faucet.js +395 -0
  233. package/dist/ptr/faucet.js.map +1 -0
  234. package/dist/ptr/index.d.ts +22 -0
  235. package/dist/ptr/index.d.ts.map +1 -0
  236. package/dist/ptr/index.js +22 -0
  237. package/dist/ptr/index.js.map +1 -0
  238. package/dist/registry/index.d.ts +1 -1
  239. package/dist/registry/index.js +2 -2
  240. package/dist/registry/onboarding.d.ts +3 -1
  241. package/dist/registry/onboarding.d.ts.map +1 -1
  242. package/dist/registry/onboarding.js +4 -5
  243. package/dist/registry/onboarding.js.map +1 -1
  244. package/dist/registry/ship-stats-snapshot.js +17 -17
  245. package/dist/registry/ship-stats-snapshot.js.map +1 -1
  246. package/dist/world/planet-claim-stake-plots.d.ts +18 -14
  247. package/dist/world/planet-claim-stake-plots.d.ts.map +1 -1
  248. package/dist/world/planet-claim-stake-plots.js +11 -8
  249. package/dist/world/planet-claim-stake-plots.js.map +1 -1
  250. package/package.json +7 -2
@@ -1 +1 @@
1
- {"version":3,"file":"simulation.js","sourceRoot":"","sources":["../../src/planning/simulation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,+BAA+B,EAC/B,mCAAmC,GAGpC,MAAM,aAAa,CAAC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AC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAE3C,IAAI,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;QAChC,MAAM,IAAI,qBAAqB,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;IAC3E,CAAC;IAED,MAAM,UAAU,GAAG,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC;IAC7C,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI;QACJ,oBAAoB,EAAE,MAAM,CAAC,MAAM,CAAC;YAClC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,oBAAoB,CAAC,SAAS;YACxD,oBAAoB,EAAE,MAAM,CAC1B,QAAQ,CAAC,KAAK,CAAC,oBAAoB,CAAC,oBAAoB,CACzD;SACF,CAAC;QACF,GAAG,CAAC,UAAU,KAAK,IAAI;YACrB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC;gBACE,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC;oBACxB,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;oBACxB,cAAc,EAAE,UAAU,CAAC,SAAS;iBACrC,CAAC;aACH,CAAC;QACN,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;QACnC,aAAa;KACd,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,109 @@
1
+ import { type MessagePartialSigner, type TransactionSigner } from '@solana/kit';
2
+ import type { Address, SageContext } from '../client/contracts.js';
3
+ import { type PlayableFaction } from '../factions/actions/index.js';
4
+ import type { StarSystemSnapshot } from '../world/index.js';
5
+ import { type PtrAccountStep, type PtrAccountStepResult } from './errors.js';
6
+ import { type PtrFaucetClaim, type PtrFetch, type PtrZinkTopup } from './faucet.js';
7
+ /** One progress event from `createPtrAccount`.
8
+ *
9
+ * `started` precedes a step; `executed` or `skipped` finishes it.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const event: PtrAccountProgress = { step: 'claimCrew', status: 'started' };
14
+ * ```
15
+ */
16
+ export interface PtrAccountProgress {
17
+ readonly step: PtrAccountStep;
18
+ readonly status: 'started' | 'executed' | 'skipped';
19
+ readonly signature?: string;
20
+ }
21
+ /** Input for `createPtrAccount`.
22
+ *
23
+ * `wallet` pays every fee and storage cost and signs the faucet proofs.
24
+ * `profile` is a fresh signer to create a new Profile, or the address of an
25
+ * existing Profile whose single authority key is the wallet, to resume.
26
+ * `starSystem` is the loaded home Star System whose Starbase the
27
+ * StarbasePlayer registers at. `profileFunding` is the native balance, in
28
+ * lamports, the Profile is topped up to for faction enrollment (default
29
+ * 500,000,000, 0.5 ZINK). `claimCrew` (default `true`) claims faucet crew for
30
+ * the StarbasePlayer.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * import type { MessagePartialSigner, TransactionSigner } from '@solana/kit';
35
+ * declare const wallet: TransactionSigner & MessagePartialSigner;
36
+ * declare const profile: TransactionSigner;
37
+ * declare const starSystem: StarSystemSnapshot;
38
+ * const options: CreatePtrAccountOptions = { wallet, profile, faction: 'ustur', starSystem };
39
+ * ```
40
+ */
41
+ export interface CreatePtrAccountOptions {
42
+ readonly wallet: TransactionSigner & MessagePartialSigner;
43
+ readonly profile: TransactionSigner | Address;
44
+ readonly faction: PlayableFaction;
45
+ readonly starSystem: StarSystemSnapshot;
46
+ readonly profileFunding?: bigint;
47
+ readonly claimCrew?: boolean;
48
+ readonly fetch?: PtrFetch;
49
+ readonly signal?: AbortSignal;
50
+ readonly onProgress?: (event: PtrAccountProgress) => void;
51
+ }
52
+ /** The finished PTR account and what each step did.
53
+ *
54
+ * `faucet` holds the faucet's answers for the requests this call made.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * declare const account: PtrAccount;
59
+ * console.log(account.starbasePlayer, account.steps.map((step) => step.status));
60
+ * ```
61
+ */
62
+ export interface PtrAccount {
63
+ readonly wallet: Address;
64
+ readonly profile: Address;
65
+ readonly character: Address;
66
+ readonly starbasePlayer: Address;
67
+ readonly steps: readonly PtrAccountStepResult[];
68
+ readonly faucet: Readonly<{
69
+ starter?: PtrFaucetClaim;
70
+ topup?: PtrZinkTopup;
71
+ crew?: PtrFaucetClaim;
72
+ }>;
73
+ toJSON(): unknown;
74
+ }
75
+ /** Takes a caller-supplied wallet to a funded, crewed z.ink PTR account.
76
+ *
77
+ * Runs, in order: claim the faucet starter bundle and wait for the wallet's
78
+ * ZINK; request a ZINK top-up when the wallet is low; create a Profile whose
79
+ * single authority key is the wallet; fund the Profile; choose a faction;
80
+ * register a Character; register a StarbasePlayer at the home Star System's
81
+ * Starbase; claim faucet crew for it and wait until the crew is on the
82
+ * StarbasePlayer. Each step reads current state first and
83
+ * is skipped when already satisfied. Each on-chain step is simulated, then
84
+ * executed once with a compute limit from the simulation. The wallet is the
85
+ * fee payer and funder throughout. Faucet requests are spaced 32 seconds
86
+ * apart; nothing is retried.
87
+ *
88
+ * The Profile keeps exactly one authority key, the wallet: PTR's democracy
89
+ * enrollment refuses Profiles with more than one, and authority keys cannot be
90
+ * added or removed after creation. No key is generated, stored or retained;
91
+ * callers pass signers. Only `zink-ptr` with its default programs and Game is
92
+ * accepted, and the context needs `writeRpc`.
93
+ *
94
+ * A failure throws `PtrAccountIncompleteError` naming the completed steps;
95
+ * call again with the Profile address to resume.
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * import { generateKeyPairSigner } from '@solana/kit';
100
+ * declare const ctx: SageContext;
101
+ * declare const starSystem: StarSystemSnapshot;
102
+ * const wallet = await generateKeyPairSigner();
103
+ * const profile = await generateKeyPairSigner();
104
+ * const account = await createPtrAccount(ctx, { wallet, profile, faction: 'ustur', starSystem });
105
+ * console.log(account.starbasePlayer);
106
+ * ```
107
+ */
108
+ export declare function createPtrAccount(ctx: SageContext, options: CreatePtrAccountOptions): Promise<PtrAccount>;
109
+ //# sourceMappingURL=account.d.ts.map
@@ -0,0 +1 @@
1
+ {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AE,kBAAkB,KAAK,IAAI,CAAC;CAC3D;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAChD,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;QACxB,OAAO,CAAC,EAAE,cAAc,CAAC;QACzB,KAAK,CAAC,EAAE,YAAY,CAAC;QACrB,IAAI,CAAC,EAAE,cAAc,CAAC;KACvB,CAAC,CAAC;IACH,MAAM,IAAI,OAAO,CAAC;CACnB;AA+OD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,WAAW,EAChB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,UAAU,CAAC,CA8SrB"}
@@ -0,0 +1,421 @@
1
+ import { AccountRole, isAddress, isOffCurveAddress, } from '@solana/kit';
2
+ import { InvalidActionInputError, SageSdkError } from '../client/errors.js';
3
+ import { readContextRawAccounts } from '../client/reconciliation.js';
4
+ import { getCharacterForProfile, maybeGetCharacterForProfile, maybeGetProfile, } from '../identity/index.js';
5
+ import { planCreateProfile, planRegisterCharacter, } from '../identity/actions/index.js';
6
+ import { maybeGetFactionForProfile } from '../factions/index.js';
7
+ import { planChooseFaction, } from '../factions/actions/index.js';
8
+ import { planRegisterStarbasePlayer } from '../starbases/actions/index.js';
9
+ import { createPlan, executePlan, simulatePlan, } from '../planning/index.js';
10
+ import { deriveStarbasePlayerAddress, starbasePlayerAccountDefinition, } from '../internal/c4/starbase.js';
11
+ import { assertPtrContext } from './context.js';
12
+ import { PtrAccountIncompleteError, } from './errors.js';
13
+ import { PTR_FAUCET_REQUEST_SPACING_MS, claimPtrFaucet, requestPtrZinkTopup, } from './faucet.js';
14
+ const SYSTEM_PROGRAM = '11111111111111111111111111111111';
15
+ const LAMPORTS_PER_ZINK = 1000000000n;
16
+ // The official client tops up below these balances.
17
+ const TOPUP_COMBINED_BELOW = LAMPORTS_PER_ZINK;
18
+ const TOPUP_WALLET_BELOW = LAMPORTS_PER_ZINK / 100n;
19
+ const DEFAULT_PROFILE_FUNDING = 500000000n;
20
+ // Profile AUTH key mask the official client grants the single wallet key.
21
+ const WALLET_KEY_PERMISSIONS = 0x8000000000000fffn;
22
+ const MAX_COMPUTE_UNITS = 1_400_000;
23
+ const COMPUTE_HEADROOM = 1.3;
24
+ const BALANCE_WAIT_MS = 60_000;
25
+ const BALANCE_POLL_MS = 1_500;
26
+ function invalid(field, value, accepted, remedy) {
27
+ throw new InvalidActionInputError(field, value, accepted, remedy);
28
+ }
29
+ function isTransactionSigner(value) {
30
+ if (value === null || typeof value !== 'object')
31
+ return false;
32
+ const signer = value;
33
+ return (typeof signer.address === 'string' &&
34
+ isAddress(signer.address) &&
35
+ (typeof signer.signTransactions === 'function' ||
36
+ typeof signer.modifyAndSignTransactions === 'function' ||
37
+ typeof signer.signAndSendTransactions === 'function'));
38
+ }
39
+ function validateOptions(ctx, input) {
40
+ if (input === null || typeof input !== 'object')
41
+ invalid('options', input, 'an object with wallet, profile, faction and starSystem', 'Pass the wallet signer, a fresh Profile signer or existing Profile address, a faction and the loaded home Star System.');
42
+ const { wallet, profile, faction, starSystem } = input;
43
+ if (!isTransactionSigner(wallet) ||
44
+ typeof wallet.signMessages !==
45
+ 'function' ||
46
+ isOffCurveAddress(wallet.address))
47
+ invalid('options.wallet', wallet, 'a Kit signer that signs both transactions and messages', 'Pass a wallet signer such as one from generateKeyPairSigner(); it pays fees and signs the faucet proofs.');
48
+ let profileSigner;
49
+ let profileAddress;
50
+ if (typeof profile === 'string') {
51
+ if (!isAddress(profile))
52
+ invalid('options.profile', profile, 'an existing Profile address or a fresh Profile signer', 'Pass the Profile address printed by an earlier run to resume, or a new signer to create a Profile.');
53
+ profileAddress = profile;
54
+ }
55
+ else if (isTransactionSigner(profile)) {
56
+ profileSigner = profile;
57
+ profileAddress = profile.address;
58
+ }
59
+ else
60
+ invalid('options.profile', profile, 'an existing Profile address or a fresh Profile signer', 'Pass a new signer such as one from generateKeyPairSigner() to create the Profile, or its address to resume.');
61
+ if (profileAddress === wallet.address)
62
+ invalid('options.profile', profileAddress, 'a Profile address distinct from the wallet', 'Generate a separate Profile signer; the wallet is the Profile key, not the Profile account.');
63
+ if (!['mud', 'oni', 'ustur'].includes(faction))
64
+ invalid('options.faction', faction, 'mud, oni or ustur', 'Choose the faction whose home Star System you pass.');
65
+ if (starSystem === null ||
66
+ typeof starSystem !== 'object' ||
67
+ starSystem.kind !== 'starSystem' ||
68
+ typeof starSystem.address !== 'string' ||
69
+ starSystem.game !== ctx.game)
70
+ invalid('options.starSystem', starSystem, 'a Star System snapshot loaded through this context', 'Load the home Star System with getStarSystem or getStarSystemById for this context and pass it.');
71
+ const profileFunding = input.profileFunding ?? DEFAULT_PROFILE_FUNDING;
72
+ if (typeof profileFunding !== 'bigint' ||
73
+ profileFunding < 0n ||
74
+ profileFunding > 0xffffffffffffffffn)
75
+ invalid('options.profileFunding', profileFunding, 'a nonnegative bigint lamport balance', 'Omit profileFunding for the default 0.5 ZINK, or pass an exact bigint.');
76
+ const claimCrew = input.claimCrew ?? true;
77
+ if (typeof claimCrew !== 'boolean')
78
+ invalid('options.claimCrew', claimCrew, 'a boolean', 'Pass true or false.');
79
+ if (input.onProgress !== undefined && typeof input.onProgress !== 'function')
80
+ invalid('options.onProgress', input.onProgress, 'a function', 'Pass a progress callback or omit it.');
81
+ return {
82
+ wallet,
83
+ profileSigner,
84
+ profile: profileAddress,
85
+ faction,
86
+ starSystem,
87
+ profileFunding,
88
+ claimCrew,
89
+ fetch: input.fetch,
90
+ signal: input.signal,
91
+ onProgress: input.onProgress,
92
+ };
93
+ }
94
+ function delay(ms, signal) {
95
+ return new Promise((resolve, reject) => {
96
+ if (signal?.aborted) {
97
+ reject(signal.reason);
98
+ return;
99
+ }
100
+ const onAbort = () => {
101
+ clearTimeout(timer);
102
+ reject(signal.reason);
103
+ };
104
+ const timer = setTimeout(() => {
105
+ signal?.removeEventListener('abort', onAbort);
106
+ resolve();
107
+ }, ms);
108
+ signal?.addEventListener('abort', onAbort, { once: true });
109
+ });
110
+ }
111
+ function fail(message, address) {
112
+ throw new SageSdkError('ACTION_PRECONDITION_FAILED', message, { address });
113
+ }
114
+ /** Simulates, then executes once with a compute limit from the simulation,
115
+ * unless the signal was aborted in between. */
116
+ async function simulateAndExecute(ctx, plan, wallet, signers, signal) {
117
+ // Simulate at the ceiling: runtime-6 Character registration exceeds the default.
118
+ const simulation = await simulatePlan(ctx, plan, {
119
+ feePayer: wallet.address,
120
+ computeUnitLimit: MAX_COMPUTE_UNITS,
121
+ });
122
+ // Cancellation during simulation must stop before anything is signed.
123
+ signal?.throwIfAborted();
124
+ const computeUnitLimit = simulation.unitsConsumed === undefined
125
+ ? MAX_COMPUTE_UNITS
126
+ : Math.min(MAX_COMPUTE_UNITS, Math.ceil(Number(simulation.unitsConsumed) * COMPUTE_HEADROOM));
127
+ const result = await executePlan(ctx, plan, {
128
+ feePayer: wallet,
129
+ signers,
130
+ computeUnitLimit,
131
+ });
132
+ if (result.status !== 'confirmed')
133
+ throw new SageSdkError('TRANSACTION_OUTCOME_UNKNOWN', `Transaction ${result.signature} for ${plan.kind} was submitted but its outcome is unknown (${result.reason}). Check the signature on z.ink PTR before resuming; resuming re-reads state and skips the step if it landed.`);
134
+ return result.signature;
135
+ }
136
+ function systemTransfer(from, to, lamports) {
137
+ const data = new Uint8Array(12);
138
+ const view = new DataView(data.buffer);
139
+ view.setUint32(0, 2, true);
140
+ view.setBigUint64(4, lamports, true);
141
+ return {
142
+ programAddress: SYSTEM_PROGRAM,
143
+ accounts: [
144
+ { address: from, role: AccountRole.WRITABLE_SIGNER },
145
+ { address: to, role: AccountRole.WRITABLE },
146
+ ],
147
+ data,
148
+ };
149
+ }
150
+ function toJSONResult(account) {
151
+ const value = {
152
+ ...account,
153
+ toJSON() {
154
+ return {
155
+ wallet: account.wallet,
156
+ profile: account.profile,
157
+ character: account.character,
158
+ starbasePlayer: account.starbasePlayer,
159
+ steps: account.steps,
160
+ faucet: account.faucet,
161
+ };
162
+ },
163
+ };
164
+ Object.defineProperty(value, 'toJSON', { enumerable: false });
165
+ return Object.freeze(value);
166
+ }
167
+ /** Takes a caller-supplied wallet to a funded, crewed z.ink PTR account.
168
+ *
169
+ * Runs, in order: claim the faucet starter bundle and wait for the wallet's
170
+ * ZINK; request a ZINK top-up when the wallet is low; create a Profile whose
171
+ * single authority key is the wallet; fund the Profile; choose a faction;
172
+ * register a Character; register a StarbasePlayer at the home Star System's
173
+ * Starbase; claim faucet crew for it and wait until the crew is on the
174
+ * StarbasePlayer. Each step reads current state first and
175
+ * is skipped when already satisfied. Each on-chain step is simulated, then
176
+ * executed once with a compute limit from the simulation. The wallet is the
177
+ * fee payer and funder throughout. Faucet requests are spaced 32 seconds
178
+ * apart; nothing is retried.
179
+ *
180
+ * The Profile keeps exactly one authority key, the wallet: PTR's democracy
181
+ * enrollment refuses Profiles with more than one, and authority keys cannot be
182
+ * added or removed after creation. No key is generated, stored or retained;
183
+ * callers pass signers. Only `zink-ptr` with its default programs and Game is
184
+ * accepted, and the context needs `writeRpc`.
185
+ *
186
+ * A failure throws `PtrAccountIncompleteError` naming the completed steps;
187
+ * call again with the Profile address to resume.
188
+ *
189
+ * @example
190
+ * ```ts
191
+ * import { generateKeyPairSigner } from '@solana/kit';
192
+ * declare const ctx: SageContext;
193
+ * declare const starSystem: StarSystemSnapshot;
194
+ * const wallet = await generateKeyPairSigner();
195
+ * const profile = await generateKeyPairSigner();
196
+ * const account = await createPtrAccount(ctx, { wallet, profile, faction: 'ustur', starSystem });
197
+ * console.log(account.starbasePlayer);
198
+ * ```
199
+ */
200
+ export async function createPtrAccount(ctx, options) {
201
+ assertPtrContext(ctx);
202
+ const input = validateOptions(ctx, options);
203
+ if (ctx.writeRpc === undefined)
204
+ throw new SageSdkError('MISSING_WRITE_TRANSPORT', 'This SAGE context has no writeRpc transport, so createPtrAccount cannot execute its steps. Pass the optional writeRpc transport when creating the context, then retry.');
205
+ const { wallet, profile, signal } = input;
206
+ const transport = {
207
+ ...(input.fetch === undefined ? {} : { fetch: input.fetch }),
208
+ ...(signal === undefined ? {} : { signal }),
209
+ };
210
+ const steps = [];
211
+ const faucet = {};
212
+ let lastFaucetRequest;
213
+ let current = 'claimStarter';
214
+ const emit = (event) => input.onProgress?.(event);
215
+ const begin = (step) => {
216
+ signal?.throwIfAborted();
217
+ current = step;
218
+ emit({ step, status: 'started' });
219
+ };
220
+ const finish = (step, status, signature) => {
221
+ const result = Object.freeze({
222
+ step,
223
+ status,
224
+ ...(signature === undefined ? {} : { signature }),
225
+ });
226
+ steps.push(result);
227
+ emit(result);
228
+ };
229
+ // Spacing is measured from the end of the previous faucet request; it is not a retry.
230
+ const faucetRequest = async (send) => {
231
+ if (lastFaucetRequest !== undefined) {
232
+ const wait = lastFaucetRequest + PTR_FAUCET_REQUEST_SPACING_MS - Date.now();
233
+ if (wait > 0)
234
+ await delay(wait, signal);
235
+ }
236
+ try {
237
+ return await send();
238
+ }
239
+ finally {
240
+ lastFaucetRequest = Date.now();
241
+ }
242
+ };
243
+ const balance = async (address) => {
244
+ const [account] = await readContextRawAccounts(ctx, [address], signal === undefined ? {} : { signal });
245
+ return account?.lamports ?? 0n;
246
+ };
247
+ const waitForBalance = async (above, what) => {
248
+ const deadline = Date.now() + BALANCE_WAIT_MS;
249
+ for (;;) {
250
+ if ((await balance(wallet.address)) > above)
251
+ return;
252
+ if (Date.now() >= deadline)
253
+ fail(`Wallet ${wallet.address} shows no ${what} ${BALANCE_WAIT_MS / 1000} seconds after the faucet accepted the request. The faucet may still be delivering; wait, then resume.`, wallet.address);
254
+ await delay(BALANCE_POLL_MS, signal);
255
+ }
256
+ };
257
+ try {
258
+ // 1. Starter bundle: the faucet answers alreadyClaimed for a repeat.
259
+ begin('claimStarter');
260
+ const starter = await faucetRequest(() => claimPtrFaucet(ctx, { wallet, distribution: 'starter', ...transport }));
261
+ faucet.starter = starter;
262
+ // A repeat claim delivers nothing; a drained wallet is the top-up's job.
263
+ if (!starter.alreadyClaimed)
264
+ await waitForBalance(0n, 'ZINK');
265
+ finish('claimStarter', starter.alreadyClaimed ? 'skipped' : 'executed', starter.signatures[0]);
266
+ // 2. ZINK top-up, only when the wallet is low.
267
+ begin('topUpZink');
268
+ const walletBalance = await balance(wallet.address);
269
+ const profileBalance = await balance(profile);
270
+ if (walletBalance + profileBalance < TOPUP_COMBINED_BELOW ||
271
+ walletBalance < TOPUP_WALLET_BELOW) {
272
+ const topup = await faucetRequest(() => requestPtrZinkTopup(ctx, { wallet, ...transport }));
273
+ faucet.topup = topup;
274
+ if (topup.toppedUp === false)
275
+ finish('topUpZink', 'skipped');
276
+ else {
277
+ await waitForBalance(walletBalance, 'ZINK top-up');
278
+ finish('topUpZink', 'executed', topup.signatures[0]);
279
+ }
280
+ }
281
+ else
282
+ finish('topUpZink', 'skipped');
283
+ // 3. Profile with the wallet as its single authority key.
284
+ begin('createProfile');
285
+ const existingProfile = await maybeGetProfile(ctx, profile, {
286
+ refresh: true,
287
+ });
288
+ if (existingProfile !== undefined) {
289
+ const key = existingProfile.keys[0];
290
+ if (key?.address !== wallet.address ||
291
+ key.scope !== ctx.programs.playerProfile ||
292
+ (key.permissionsRaw & 1n) === 0n)
293
+ fail(`Profile ${profile} exists, but its primary authority key is not wallet ${wallet.address}. Resume with the wallet that created it, or pass a fresh Profile signer.`, profile);
294
+ finish('createProfile', 'skipped');
295
+ }
296
+ else {
297
+ if (input.profileSigner === undefined)
298
+ fail(`Profile ${profile} does not exist. Pass a fresh Profile signer to create it, or the address of an existing Profile to resume.`, profile);
299
+ const plan = await planCreateProfile(ctx, profile, {
300
+ funder: wallet.address,
301
+ keyThreshold: 1,
302
+ keys: [
303
+ {
304
+ address: wallet.address,
305
+ scope: ctx.programs.playerProfile,
306
+ permissionsRaw: WALLET_KEY_PERMISSIONS,
307
+ },
308
+ ],
309
+ });
310
+ finish('createProfile', 'executed', await simulateAndExecute(ctx, plan, wallet, [input.profileSigner], signal));
311
+ }
312
+ // 4. Profile funding for faction enrollment.
313
+ begin('fundProfile');
314
+ const funded = await balance(profile);
315
+ if (funded >= input.profileFunding)
316
+ finish('fundProfile', 'skipped');
317
+ else {
318
+ const amount = input.profileFunding - funded;
319
+ const summary = `Transfer ${amount} lamports from wallet ${wallet.address} to Profile ${profile}, bringing its balance to ${input.profileFunding} lamports for faction enrollment. Transaction fees are separate.`;
320
+ const plan = createPlan(ctx.programs, {
321
+ kind: 'ptr.fund-profile',
322
+ summary,
323
+ preconditions: [],
324
+ steps: [
325
+ {
326
+ instruction: systemTransfer(wallet.address, profile, amount),
327
+ signers: [wallet.address],
328
+ describes: summary,
329
+ },
330
+ ],
331
+ });
332
+ finish('fundProfile', 'executed', await simulateAndExecute(ctx, plan, wallet, [], signal));
333
+ }
334
+ // 5. Faction enrollment.
335
+ begin('chooseFaction');
336
+ const enrollment = await maybeGetFactionForProfile(ctx, profile, {
337
+ refresh: true,
338
+ });
339
+ if (enrollment !== undefined) {
340
+ if (enrollment.faction !== input.faction)
341
+ fail(`Profile ${profile} is already enrolled as ${enrollment.faction}, not ${input.faction}. Resume with faction ${enrollment.faction} and its home Star System.`, profile);
342
+ finish('chooseFaction', 'skipped');
343
+ }
344
+ else {
345
+ const plan = await planChooseFaction(ctx, {
346
+ faction: input.faction,
347
+ authorization: { profile, authority: wallet.address, keyIndex: 0 },
348
+ });
349
+ finish('chooseFaction', 'executed', await simulateAndExecute(ctx, plan, wallet, [], signal));
350
+ }
351
+ // 6. Character.
352
+ begin('registerCharacter');
353
+ let character = await maybeGetCharacterForProfile(ctx, profile, { refresh: true });
354
+ if (character !== undefined)
355
+ finish('registerCharacter', 'skipped');
356
+ else {
357
+ const plan = await planRegisterCharacter(ctx, profile, {
358
+ funder: wallet.address,
359
+ });
360
+ const signature = await simulateAndExecute(ctx, plan, wallet, [], signal);
361
+ character = await getCharacterForProfile(ctx, profile, {
362
+ refresh: true,
363
+ });
364
+ finish('registerCharacter', 'executed', signature);
365
+ }
366
+ // 7. StarbasePlayer at the home Star System.
367
+ begin('registerStarbasePlayer');
368
+ const starbasePlayer = await deriveStarbasePlayerAddress(ctx.programs, input.starSystem.address, character.address);
369
+ const readStarbasePlayer = async () => (await ctx.data.readMany(starbasePlayerAccountDefinition, [starbasePlayer], { refresh: true }))[0];
370
+ let registered = await readStarbasePlayer();
371
+ if (registered !== undefined)
372
+ finish('registerStarbasePlayer', 'skipped');
373
+ else {
374
+ const plan = await planRegisterStarbasePlayer(ctx, character, input.starSystem, { funder: wallet.address });
375
+ const signature = await simulateAndExecute(ctx, plan, wallet, [], signal);
376
+ registered = await readStarbasePlayer();
377
+ if (registered === undefined)
378
+ fail(`StarbasePlayer ${starbasePlayer} is not readable after confirmed registration. Wait for the node to catch up, then resume.`, starbasePlayer);
379
+ finish('registerStarbasePlayer', 'executed', signature);
380
+ }
381
+ // 8. Crew for the StarbasePlayer.
382
+ begin('claimCrew');
383
+ if (!input.claimCrew || registered.data.totalCrew > 0)
384
+ finish('claimCrew', 'skipped');
385
+ else {
386
+ const crew = await faucetRequest(() => claimPtrFaucet(ctx, {
387
+ wallet,
388
+ distribution: 'crew',
389
+ starbasePlayer,
390
+ ...transport,
391
+ }));
392
+ faucet.crew = crew;
393
+ // The faucet may answer PENDING or alreadyClaimed before any crew lands;
394
+ // only crew on the StarbasePlayer completes the account.
395
+ const deadline = Date.now() + BALANCE_WAIT_MS;
396
+ for (;;) {
397
+ const current = await readStarbasePlayer();
398
+ if (current !== undefined && current.data.totalCrew > 0)
399
+ break;
400
+ if (Date.now() >= deadline)
401
+ fail(`StarbasePlayer ${starbasePlayer} shows no crew ${BALANCE_WAIT_MS / 1000} seconds after the faucet ${crew.alreadyClaimed ? 'reported the claim as already made' : `answered ${crew.status}`}. The faucet may still be delivering; wait, then call createPtrAccount again with Profile ${profile} to resume.`, starbasePlayer);
402
+ await delay(BALANCE_POLL_MS, signal);
403
+ }
404
+ finish('claimCrew', crew.alreadyClaimed ? 'skipped' : 'executed', crew.signatures[0]);
405
+ }
406
+ return toJSONResult({
407
+ wallet: wallet.address,
408
+ profile,
409
+ character: character.address,
410
+ starbasePlayer,
411
+ steps: Object.freeze([...steps]),
412
+ faucet: Object.freeze({ ...faucet }),
413
+ });
414
+ }
415
+ catch (cause) {
416
+ if (signal?.aborted && cause === signal.reason)
417
+ throw cause;
418
+ throw new PtrAccountIncompleteError(current, steps, profile, cause);
419
+ }
420
+ }
421
+ //# sourceMappingURL=account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/ptr/account.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,SAAS,EACT,iBAAiB,GAGlB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACL,sBAAsB,EACtB,2BAA2B,EAC3B,eAAe,GAEhB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EACL,iBAAiB,GAElB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,EACL,UAAU,EACV,WAAW,EACX,YAAY,GAEb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,GAChC,MAAM,4BAA4B,CAAC;AACpC,OAAO,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C5C,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CACnB,CAAC;QACJ,CAAC;QAED,OAAO,YAAY,CAAC;YAClB,MAAM,EAAE,MAAM,CAAC,OAAO;YACtB,OAAO;YACP,SAAS,EAAE,SAAS,CAAC,OAAO;YAC5B,cAAc;YACd,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;YAChC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC;SACrC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,MAAM,EAAE,OAAO,IAAI,KAAK,KAAK,MAAM,CAAC,MAAM;YAAE,MAAM,KAAK,CAAC;QAC5D,MAAM,IAAI,yBAAyB,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { SageContext } from '../client/contracts.js';
2
+ /** Refuses every context except `zink-ptr` with its default programs and Game. */
3
+ export declare function assertPtrContext(ctx: SageContext): void;
4
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/ptr/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAO1D,kFAAkF;AAClF,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CAkBvD"}
@@ -0,0 +1,15 @@
1
+ import { ZINK_PTR_GAME_ADDRESS, ZINK_PTR_PROGRAM_ADDRESSES, } from '../client/deployments.js';
2
+ import { PtrContextError } from './errors.js';
3
+ /** Refuses every context except `zink-ptr` with its default programs and Game. */
4
+ export function assertPtrContext(ctx) {
5
+ if (ctx === null || typeof ctx !== 'object' || ctx.cluster !== 'zink-ptr')
6
+ throw new PtrContextError('The ptr entry acts only on z.ink PTR, but this context is for another cluster. Create the context with cluster "zink-ptr" and retry; the public faucet funds no other deployment.');
7
+ const programs = ctx.programs;
8
+ if (programs?.sage !== ZINK_PTR_PROGRAM_ADDRESSES.sage ||
9
+ programs.playerProfile !== ZINK_PTR_PROGRAM_ADDRESSES.playerProfile ||
10
+ programs.profileFaction !== ZINK_PTR_PROGRAM_ADDRESSES.profileFaction)
11
+ throw new PtrContextError('The ptr entry acts only on the default z.ink PTR programs, but this context overrides them. Create the "zink-ptr" context without a programs option and retry.');
12
+ if (ctx.game !== ZINK_PTR_GAME_ADDRESS)
13
+ throw new PtrContextError(`The ptr entry acts only on the default z.ink PTR Game ${ZINK_PTR_GAME_ADDRESS}, but this context selects ${String(ctx.game)}. Create the "zink-ptr" context without a game option and retry.`);
14
+ }
15
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/ptr/context.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,kFAAkF;AAClF,MAAM,UAAU,gBAAgB,CAAC,GAAgB;IAC/C,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,OAAO,KAAK,UAAU;QACvE,MAAM,IAAI,eAAe,CACvB,mLAAmL,CACpL,CAAC;IACJ,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;IAC9B,IACE,QAAQ,EAAE,IAAI,KAAK,0BAA0B,CAAC,IAAI;QAClD,QAAQ,CAAC,aAAa,KAAK,0BAA0B,CAAC,aAAa;QACnE,QAAQ,CAAC,cAAc,KAAK,0BAA0B,CAAC,cAAc;QAErE,MAAM,IAAI,eAAe,CACvB,gKAAgK,CACjK,CAAC;IACJ,IAAI,GAAG,CAAC,IAAI,KAAK,qBAAqB;QACpC,MAAM,IAAI,eAAe,CACvB,yDAAyD,qBAAqB,8BAA8B,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,kEAAkE,CAC/L,CAAC;AACN,CAAC"}