@shipload/sdk 1.0.0-next.23 → 1.0.0-next.24

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/lib/testing.js CHANGED
@@ -3248,24 +3248,24 @@ const itemMetadata = {
3248
3248
  208: { name: 'Crystal', description: '', color: '#4ADBFF' },
3249
3249
  209: { name: 'Crystal', description: '', color: '#4ADBFF' },
3250
3250
  210: { name: 'Crystal', description: '', color: '#4ADBFF' },
3251
- 301: { name: 'Gas', description: 'Raw volatile gas.', color: '#B8E4A0' },
3251
+ 301: { name: 'Gas', description: 'Raw volatile gas.', color: '#B877FF' },
3252
3252
  302: {
3253
3253
  name: 'Gas',
3254
3254
  description: 'Refined volatile gas with improved reactivity.',
3255
- color: '#B8E4A0',
3255
+ color: '#B877FF',
3256
3256
  },
3257
3257
  303: {
3258
3258
  name: 'Gas',
3259
3259
  description: 'High-grade volatile gas with exceptional energy density.',
3260
- color: '#B8E4A0',
3260
+ color: '#B877FF',
3261
3261
  },
3262
- 304: { name: 'Gas', description: '', color: '#B8E4A0' },
3263
- 305: { name: 'Gas', description: '', color: '#B8E4A0' },
3264
- 306: { name: 'Gas', description: '', color: '#B8E4A0' },
3265
- 307: { name: 'Gas', description: '', color: '#B8E4A0' },
3266
- 308: { name: 'Gas', description: '', color: '#B8E4A0' },
3267
- 309: { name: 'Gas', description: '', color: '#B8E4A0' },
3268
- 310: { name: 'Gas', description: '', color: '#B8E4A0' },
3262
+ 304: { name: 'Gas', description: '', color: '#B877FF' },
3263
+ 305: { name: 'Gas', description: '', color: '#B877FF' },
3264
+ 306: { name: 'Gas', description: '', color: '#B877FF' },
3265
+ 307: { name: 'Gas', description: '', color: '#B877FF' },
3266
+ 308: { name: 'Gas', description: '', color: '#B877FF' },
3267
+ 309: { name: 'Gas', description: '', color: '#B877FF' },
3268
+ 310: { name: 'Gas', description: '', color: '#B877FF' },
3269
3269
  401: { name: 'Regolith', description: 'Crude regolith dust.', color: '#C4A57B' },
3270
3270
  402: {
3271
3271
  name: 'Regolith',
@@ -3345,7 +3345,7 @@ const itemMetadata = {
3345
3345
  10009: {
3346
3346
  name: 'Reactor',
3347
3347
  description: 'Gas-pressurized vessel for controlled reactions. Vents heat and contains volatility.',
3348
- color: '#B8E4A0',
3348
+ color: '#B877FF',
3349
3349
  },
3350
3350
  10010: {
3351
3351
  name: 'Emitter',
@@ -3375,7 +3375,7 @@ const itemMetadata = {
3375
3375
  10104: {
3376
3376
  name: 'Crafter',
3377
3377
  description: 'Basic crafting system. Processes materials using reaction chambers and cutting tools.',
3378
- color: '#B8E4A0',
3378
+ color: '#B877FF',
3379
3379
  },
3380
3380
  10105: {
3381
3381
  name: 'Storage',
package/lib/testing.m.js CHANGED
@@ -3244,24 +3244,24 @@ const itemMetadata = {
3244
3244
  208: { name: 'Crystal', description: '', color: '#4ADBFF' },
3245
3245
  209: { name: 'Crystal', description: '', color: '#4ADBFF' },
3246
3246
  210: { name: 'Crystal', description: '', color: '#4ADBFF' },
3247
- 301: { name: 'Gas', description: 'Raw volatile gas.', color: '#B8E4A0' },
3247
+ 301: { name: 'Gas', description: 'Raw volatile gas.', color: '#B877FF' },
3248
3248
  302: {
3249
3249
  name: 'Gas',
3250
3250
  description: 'Refined volatile gas with improved reactivity.',
3251
- color: '#B8E4A0',
3251
+ color: '#B877FF',
3252
3252
  },
3253
3253
  303: {
3254
3254
  name: 'Gas',
3255
3255
  description: 'High-grade volatile gas with exceptional energy density.',
3256
- color: '#B8E4A0',
3256
+ color: '#B877FF',
3257
3257
  },
3258
- 304: { name: 'Gas', description: '', color: '#B8E4A0' },
3259
- 305: { name: 'Gas', description: '', color: '#B8E4A0' },
3260
- 306: { name: 'Gas', description: '', color: '#B8E4A0' },
3261
- 307: { name: 'Gas', description: '', color: '#B8E4A0' },
3262
- 308: { name: 'Gas', description: '', color: '#B8E4A0' },
3263
- 309: { name: 'Gas', description: '', color: '#B8E4A0' },
3264
- 310: { name: 'Gas', description: '', color: '#B8E4A0' },
3258
+ 304: { name: 'Gas', description: '', color: '#B877FF' },
3259
+ 305: { name: 'Gas', description: '', color: '#B877FF' },
3260
+ 306: { name: 'Gas', description: '', color: '#B877FF' },
3261
+ 307: { name: 'Gas', description: '', color: '#B877FF' },
3262
+ 308: { name: 'Gas', description: '', color: '#B877FF' },
3263
+ 309: { name: 'Gas', description: '', color: '#B877FF' },
3264
+ 310: { name: 'Gas', description: '', color: '#B877FF' },
3265
3265
  401: { name: 'Regolith', description: 'Crude regolith dust.', color: '#C4A57B' },
3266
3266
  402: {
3267
3267
  name: 'Regolith',
@@ -3341,7 +3341,7 @@ const itemMetadata = {
3341
3341
  10009: {
3342
3342
  name: 'Reactor',
3343
3343
  description: 'Gas-pressurized vessel for controlled reactions. Vents heat and contains volatility.',
3344
- color: '#B8E4A0',
3344
+ color: '#B877FF',
3345
3345
  },
3346
3346
  10010: {
3347
3347
  name: 'Emitter',
@@ -3371,7 +3371,7 @@ const itemMetadata = {
3371
3371
  10104: {
3372
3372
  name: 'Crafter',
3373
3373
  description: 'Basic crafting system. Processes materials using reaction chambers and cutting tools.',
3374
- color: '#B8E4A0',
3374
+ color: '#B877FF',
3375
3375
  },
3376
3376
  10105: {
3377
3377
  name: 'Storage',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shipload/sdk",
3
3
  "description": "SDKs for Shipload",
4
- "version": "1.0.0-next.23",
4
+ "version": "1.0.0-next.24",
5
5
  "homepage": "https://github.com/shipload/toolkit/tree/master/packages/sdk",
6
6
  "repository": {
7
7
  "type": "git",
@@ -3,7 +3,7 @@ import type {ResourceCategory} from '../types'
3
3
  export const categoryColors: Record<ResourceCategory, string> = {
4
4
  ore: '#C26D3F',
5
5
  crystal: '#4ADBFF',
6
- gas: '#B8E4A0',
6
+ gas: '#B877FF',
7
7
  regolith: '#C4A57B',
8
8
  biomass: '#5A8B3E',
9
9
  }
@@ -21,24 +21,6 @@ export const tierColors: Record<number, string> = {
21
21
  10: '#ffffff',
22
22
  }
23
23
 
24
- export const categoryIcons: Record<ResourceCategory, string> = {
25
- ore: '⬡',
26
- crystal: '◈',
27
- gas: '◎',
28
- regolith: '■',
29
- biomass: '❋',
30
- }
31
-
32
- export type CategoryIconShape = 'hex' | 'diamond' | 'star' | 'circle' | 'square'
33
-
34
- export const categoryIconShapes: Record<ResourceCategory, CategoryIconShape> = {
35
- ore: 'hex',
36
- crystal: 'diamond',
37
- gas: 'circle',
38
- regolith: 'square',
39
- biomass: 'star',
40
- }
41
-
42
24
  export const componentIcon = '▣'
43
25
  export const moduleIcon = '⬢'
44
26
 
@@ -48,24 +48,24 @@ export const itemMetadata: Record<number, ItemMetadata> = {
48
48
  210: {name: 'Crystal', description: '', color: '#4ADBFF'},
49
49
 
50
50
  // === Resources / Gas ===
51
- 301: {name: 'Gas', description: 'Raw volatile gas.', color: '#B8E4A0'},
51
+ 301: {name: 'Gas', description: 'Raw volatile gas.', color: '#B877FF'},
52
52
  302: {
53
53
  name: 'Gas',
54
54
  description: 'Refined volatile gas with improved reactivity.',
55
- color: '#B8E4A0',
55
+ color: '#B877FF',
56
56
  },
57
57
  303: {
58
58
  name: 'Gas',
59
59
  description: 'High-grade volatile gas with exceptional energy density.',
60
- color: '#B8E4A0',
61
- },
62
- 304: {name: 'Gas', description: '', color: '#B8E4A0'},
63
- 305: {name: 'Gas', description: '', color: '#B8E4A0'},
64
- 306: {name: 'Gas', description: '', color: '#B8E4A0'},
65
- 307: {name: 'Gas', description: '', color: '#B8E4A0'},
66
- 308: {name: 'Gas', description: '', color: '#B8E4A0'},
67
- 309: {name: 'Gas', description: '', color: '#B8E4A0'},
68
- 310: {name: 'Gas', description: '', color: '#B8E4A0'},
60
+ color: '#B877FF',
61
+ },
62
+ 304: {name: 'Gas', description: '', color: '#B877FF'},
63
+ 305: {name: 'Gas', description: '', color: '#B877FF'},
64
+ 306: {name: 'Gas', description: '', color: '#B877FF'},
65
+ 307: {name: 'Gas', description: '', color: '#B877FF'},
66
+ 308: {name: 'Gas', description: '', color: '#B877FF'},
67
+ 309: {name: 'Gas', description: '', color: '#B877FF'},
68
+ 310: {name: 'Gas', description: '', color: '#B877FF'},
69
69
 
70
70
  // === Resources / Regolith ===
71
71
  401: {name: 'Regolith', description: 'Crude regolith dust.', color: '#C4A57B'},
@@ -160,7 +160,7 @@ export const itemMetadata: Record<number, ItemMetadata> = {
160
160
  name: 'Reactor',
161
161
  description:
162
162
  'Gas-pressurized vessel for controlled reactions. Vents heat and contains volatility.',
163
- color: '#B8E4A0',
163
+ color: '#B877FF',
164
164
  },
165
165
  10010: {
166
166
  name: 'Emitter',
@@ -194,7 +194,7 @@ export const itemMetadata: Record<number, ItemMetadata> = {
194
194
  name: 'Crafter',
195
195
  description:
196
196
  'Basic crafting system. Processes materials using reaction chambers and cutting tools.',
197
- color: '#B8E4A0',
197
+ color: '#B877FF',
198
198
  },
199
199
  10105: {
200
200
  name: 'Storage',
@@ -240,13 +240,10 @@ export * from './capabilities'
240
240
  export {
241
241
  categoryColors,
242
242
  tierColors,
243
- categoryIcons,
244
- categoryIconShapes,
245
243
  componentIcon,
246
244
  moduleIcon,
247
245
  itemAbbreviations,
248
246
  } from './data/colors'
249
- export type {CategoryIconShape} from './data/colors'
250
247
 
251
248
  export {itemTier, itemOffset, itemCategory, isRelatedItem, isCraftedItem} from './data/tiers'
252
249
  export type {CraftedItemCategory} from './data/tiers'
@@ -1,10 +1,10 @@
1
- import type {UInt16Type} from '@wharfkit/antelope'
1
+ import {BlockTimestamp, type UInt16Type} from '@wharfkit/antelope'
2
2
  import {BaseManager} from './base'
3
3
  import type {CoordinatesType, Distance} from '../types'
4
4
  import {hasSystem} from '../utils/system'
5
5
  import {findNearbyPlanets} from '../travel/travel'
6
6
  import type {ServerContract} from '../contracts'
7
- import {type DerivedStratum, deriveStrata} from '../derivation'
7
+ import {type DerivedStratum, deriveStrata, getEffectiveReserve} from '../derivation'
8
8
 
9
9
  export interface LocationStratum extends DerivedStratum {
10
10
  reserveMax: number
@@ -24,7 +24,10 @@ export class LocationsManager extends BaseManager {
24
24
  return findNearbyPlanets(game.config.seed, origin, maxDistance)
25
25
  }
26
26
 
27
- async getStrata(coords: CoordinatesType): Promise<LocationStratum[]> {
27
+ async getStrata(
28
+ coords: CoordinatesType,
29
+ now: BlockTimestamp = BlockTimestamp.fromMilliseconds(Date.now())
30
+ ): Promise<LocationStratum[]> {
28
31
  const game = await this.getGame()
29
32
  const state = await this.getState()
30
33
 
@@ -36,15 +39,26 @@ export class LocationsManager extends BaseManager {
36
39
  y: coords.y,
37
40
  })) as ServerContract.Types.stratum_remaining[]
38
41
 
39
- const overrideMap = new Map<number, number>()
42
+ const epochSeconds = Number(game.config.epochtime)
43
+ const overrideMap = new Map<number, ServerContract.Types.stratum_remaining>()
40
44
  for (const o of overrides) {
41
- overrideMap.set(Number(o.stratum), Number(o.remaining))
45
+ overrideMap.set(Number(o.stratum), o)
42
46
  }
43
47
 
44
- return derived.map((s) => ({
45
- ...s,
46
- reserveMax: s.reserve,
47
- reserve: overrideMap.get(s.index) ?? s.reserve,
48
- }))
48
+ return derived.map((s) => {
49
+ const override = overrideMap.get(s.index)
50
+ const reserve = override
51
+ ? getEffectiveReserve(
52
+ {
53
+ remaining: override.remaining,
54
+ max_reserve: s.reserve,
55
+ last_block: override.last_block,
56
+ },
57
+ now,
58
+ epochSeconds
59
+ )
60
+ : s.reserve
61
+ return {...s, reserveMax: s.reserve, reserve}
62
+ })
49
63
  }
50
64
  }
@@ -29,13 +29,7 @@ import {
29
29
  computeContainerCapabilities,
30
30
  computeContainerT2Capabilities,
31
31
  } from '../derivation/capabilities'
32
- import {
33
- categoryColors,
34
- categoryIcons,
35
- componentIcon,
36
- itemAbbreviations,
37
- moduleIcon,
38
- } from '../data/colors'
32
+ import {categoryColors, componentIcon, itemAbbreviations, moduleIcon} from '../data/colors'
39
33
  import type {ServerContract} from '../contracts'
40
34
  import {
41
35
  ITEM_CONTAINER_T1_PACKED,
@@ -111,7 +105,7 @@ function resolveResource(id: number, stats?: UInt64Type): ResolvedItem {
111
105
  return {
112
106
  itemId: id,
113
107
  name: item.name,
114
- icon: cat ? categoryIcons[cat] : '',
108
+ icon: '',
115
109
  abbreviation: null,
116
110
  category: cat,
117
111
  tier: item.tier,