@shipload/sdk 1.0.0-next.3 → 1.0.0-next.31
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/shipload.d.ts +1849 -961
- package/lib/shipload.js +9089 -4854
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +8958 -4805
- package/lib/shipload.m.js.map +1 -1
- package/lib/testing.d.ts +856 -0
- package/lib/testing.js +3739 -0
- package/lib/testing.js.map +1 -0
- package/lib/testing.m.js +3733 -0
- package/lib/testing.m.js.map +1 -0
- package/package.json +15 -2
- package/src/capabilities/craftable.ts +51 -0
- package/src/capabilities/crafting.test.ts +7 -0
- package/src/capabilities/crafting.ts +3 -3
- package/src/capabilities/gathering.ts +17 -7
- package/src/capabilities/index.ts +0 -1
- package/src/capabilities/modules.ts +6 -0
- package/src/capabilities/storage.ts +16 -1
- package/src/contracts/platform.ts +231 -3
- package/src/contracts/server.ts +816 -471
- package/src/data/capabilities.ts +14 -329
- package/src/data/capability-formulas.ts +76 -0
- package/src/data/catalog.ts +0 -5
- package/src/data/colors.ts +14 -47
- package/src/data/entities.json +46 -10
- package/src/data/item-ids.ts +15 -12
- package/src/data/items.json +302 -38
- package/src/data/kind-registry.json +85 -0
- package/src/data/kind-registry.ts +150 -0
- package/src/data/metadata.ts +100 -31
- package/src/data/recipes-runtime.ts +3 -23
- package/src/data/recipes.json +250 -113
- package/src/derivation/build-methods.ts +45 -0
- package/src/derivation/capabilities.ts +415 -0
- package/src/derivation/capability-mappings.ts +117 -0
- package/src/derivation/crafting.ts +23 -24
- package/src/derivation/index.ts +17 -2
- package/src/derivation/reserve-regen.ts +34 -0
- package/src/derivation/resources.ts +125 -38
- package/src/derivation/stars.test.ts +51 -0
- package/src/derivation/stars.ts +15 -0
- package/src/derivation/stats.ts +6 -6
- package/src/derivation/stratum.ts +15 -19
- package/src/derivation/tiers.ts +28 -7
- package/src/entities/entity.ts +98 -0
- package/src/entities/gamestate.ts +3 -28
- package/src/entities/makers.ts +91 -136
- package/src/entities/slot-multiplier.ts +39 -0
- package/src/errors.ts +10 -15
- package/src/format.ts +26 -4
- package/src/index-module.ts +189 -47
- package/src/managers/actions.ts +252 -83
- package/src/managers/base.ts +6 -2
- package/src/managers/construction-types.ts +79 -0
- package/src/managers/construction.ts +396 -0
- package/src/managers/context.ts +11 -1
- package/src/managers/entities.ts +18 -66
- package/src/managers/epochs.ts +40 -0
- package/src/managers/index.ts +17 -1
- package/src/managers/locations.ts +25 -29
- package/src/managers/nft.ts +28 -0
- package/src/managers/plot.ts +127 -0
- package/src/nft/atomicassets.abi.json +1342 -0
- package/src/nft/atomicassets.ts +237 -0
- package/src/nft/atomicdata.ts +130 -0
- package/src/nft/buildImmutableData.ts +321 -0
- package/src/nft/description.ts +37 -15
- package/src/nft/index.ts +3 -0
- package/src/resolution/describe-module.ts +5 -8
- package/src/resolution/display-name.ts +38 -10
- package/src/resolution/resolve-item.ts +22 -20
- package/src/scheduling/accessor.ts +68 -22
- package/src/scheduling/availability.ts +108 -0
- package/src/scheduling/energy.ts +48 -0
- package/src/scheduling/lane-core.ts +130 -0
- package/src/scheduling/lanes.ts +60 -0
- package/src/scheduling/projection.ts +121 -94
- package/src/scheduling/schedule.ts +237 -103
- package/src/scheduling/task-cargo.ts +46 -0
- package/src/shipload.ts +16 -1
- package/src/subscriptions/manager.ts +40 -6
- package/src/subscriptions/mappers.ts +3 -8
- package/src/subscriptions/types.ts +3 -2
- package/src/testing/catalog-hash.ts +19 -0
- package/src/testing/index.ts +2 -0
- package/src/testing/projection-parity.ts +143 -0
- package/src/travel/travel.ts +90 -13
- package/src/types/capabilities.ts +1 -0
- package/src/types/index.ts +0 -1
- package/src/types.ts +19 -12
- package/src/utils/cargo.ts +27 -0
- package/src/utils/display-name.ts +70 -0
- package/src/utils/system.ts +25 -24
- package/src/capabilities/loading.ts +0 -8
- package/src/entities/container.ts +0 -108
- package/src/entities/ship-deploy.ts +0 -258
- package/src/entities/ship.ts +0 -204
- package/src/entities/warehouse.ts +0 -119
- package/src/types/entity-traits.ts +0 -69
package/src/managers/actions.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
Action,
|
|
3
|
+
Checksum256,
|
|
4
|
+
type Checksum256Type,
|
|
3
5
|
Int64,
|
|
4
6
|
Name,
|
|
5
7
|
type NameType,
|
|
8
|
+
UInt8,
|
|
9
|
+
type UInt8Type,
|
|
6
10
|
UInt16,
|
|
7
11
|
type UInt16Type,
|
|
8
12
|
UInt32,
|
|
@@ -11,11 +15,12 @@ import {
|
|
|
11
15
|
type UInt64Type,
|
|
12
16
|
} from '@wharfkit/antelope'
|
|
13
17
|
import {BaseManager} from './base'
|
|
14
|
-
import
|
|
18
|
+
import type {CoordinatesType} from '../types'
|
|
15
19
|
import {ServerContract} from '../contracts'
|
|
20
|
+
import {ATOMICASSETS_ABI, SHIPLOAD_COLLECTION} from '../nft/atomicassets'
|
|
16
21
|
|
|
17
22
|
export type EntityRefInput = {
|
|
18
|
-
entityType:
|
|
23
|
+
entityType: NameType
|
|
19
24
|
entityId: UInt64Type
|
|
20
25
|
}
|
|
21
26
|
|
|
@@ -25,7 +30,6 @@ export class ActionsManager extends BaseManager {
|
|
|
25
30
|
const y = Int64.from(destination.y)
|
|
26
31
|
|
|
27
32
|
return this.server.action('travel', {
|
|
28
|
-
entity_type: EntityType.SHIP,
|
|
29
33
|
id: UInt64.from(shipId),
|
|
30
34
|
x,
|
|
31
35
|
y,
|
|
@@ -51,13 +55,8 @@ export class ActionsManager extends BaseManager {
|
|
|
51
55
|
})
|
|
52
56
|
}
|
|
53
57
|
|
|
54
|
-
resolve(
|
|
55
|
-
entityId: UInt64Type,
|
|
56
|
-
entityType: EntityTypeName = EntityType.SHIP,
|
|
57
|
-
count?: UInt64Type
|
|
58
|
-
): Action {
|
|
58
|
+
resolve(entityId: UInt64Type, count?: UInt64Type): Action {
|
|
59
59
|
const params: ServerContract.ActionParams.resolve = {
|
|
60
|
-
entity_type: entityType,
|
|
61
60
|
id: UInt64.from(entityId),
|
|
62
61
|
}
|
|
63
62
|
if (count !== undefined) {
|
|
@@ -66,42 +65,50 @@ export class ActionsManager extends BaseManager {
|
|
|
66
65
|
return this.server.action('resolve', params)
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
cancel(
|
|
70
|
-
entityId: UInt64Type,
|
|
71
|
-
count: UInt64Type,
|
|
72
|
-
entityType: EntityTypeName = EntityType.SHIP
|
|
73
|
-
): Action {
|
|
68
|
+
cancel(entityId: UInt64Type, laneKey: number, count: UInt64Type): Action {
|
|
74
69
|
return this.server.action('cancel', {
|
|
75
|
-
entity_type: entityType,
|
|
76
70
|
id: UInt64.from(entityId),
|
|
71
|
+
lane_key: UInt8.from(laneKey),
|
|
77
72
|
count: UInt64.from(count),
|
|
78
73
|
})
|
|
79
74
|
}
|
|
80
75
|
|
|
81
|
-
|
|
76
|
+
retarget(sourceId: UInt64Type, taskIndex: UInt64Type, newDestId: UInt64Type): Action {
|
|
77
|
+
return this.server.action('retarget', {
|
|
78
|
+
source_id: UInt64.from(sourceId),
|
|
79
|
+
task_index: UInt64.from(taskIndex),
|
|
80
|
+
new_dest_id: UInt64.from(newDestId),
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
recharge(entityId: UInt64Type): Action {
|
|
82
85
|
return this.server.action('recharge', {
|
|
83
|
-
entity_type: entityType,
|
|
84
86
|
id: UInt64.from(entityId),
|
|
85
87
|
})
|
|
86
88
|
}
|
|
87
89
|
|
|
90
|
+
rename(entityId: UInt64Type, name: string): Action {
|
|
91
|
+
return this.server.action('rename', {
|
|
92
|
+
id: UInt64.from(entityId),
|
|
93
|
+
name,
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
refrshentity(entityId: UInt64Type): Action {
|
|
98
|
+
return this.server.action('refrshentity', {
|
|
99
|
+
entity_id: UInt64.from(entityId),
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
|
|
88
103
|
transfer(
|
|
89
|
-
sourceType: EntityTypeName,
|
|
90
104
|
sourceId: UInt64Type,
|
|
91
|
-
destType: EntityTypeName,
|
|
92
105
|
destId: UInt64Type,
|
|
93
|
-
|
|
94
|
-
stats: UInt64Type,
|
|
95
|
-
quantity: UInt64Type
|
|
106
|
+
items: ServerContract.ActionParams.Type.cargo_item[]
|
|
96
107
|
): Action {
|
|
97
108
|
return this.server.action('transfer', {
|
|
98
|
-
source_type: sourceType,
|
|
99
109
|
source_id: UInt64.from(sourceId),
|
|
100
|
-
dest_type: destType,
|
|
101
110
|
dest_id: UInt64.from(destId),
|
|
102
|
-
|
|
103
|
-
stats: UInt64.from(stats),
|
|
104
|
-
quantity: UInt32.from(quantity),
|
|
111
|
+
items,
|
|
105
112
|
})
|
|
106
113
|
}
|
|
107
114
|
|
|
@@ -119,35 +126,24 @@ export class ActionsManager extends BaseManager {
|
|
|
119
126
|
}
|
|
120
127
|
|
|
121
128
|
gather(
|
|
122
|
-
|
|
123
|
-
|
|
129
|
+
sourceId: UInt64Type,
|
|
130
|
+
destinationId: UInt64Type,
|
|
124
131
|
stratum: UInt16Type,
|
|
125
132
|
quantity: UInt32Type
|
|
126
133
|
): Action {
|
|
127
134
|
return this.server.action('gather', {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
entity_id: UInt64.from(source.entityId),
|
|
131
|
-
}),
|
|
132
|
-
destination: ServerContract.Types.entity_ref.from({
|
|
133
|
-
entity_type: destination.entityType,
|
|
134
|
-
entity_id: UInt64.from(destination.entityId),
|
|
135
|
-
}),
|
|
135
|
+
source_id: UInt64.from(sourceId),
|
|
136
|
+
destination_id: UInt64.from(destinationId),
|
|
136
137
|
stratum: UInt16.from(stratum),
|
|
137
138
|
quantity: UInt32.from(quantity),
|
|
138
139
|
})
|
|
139
140
|
}
|
|
140
141
|
|
|
141
|
-
warp(
|
|
142
|
-
entityId: UInt64Type,
|
|
143
|
-
destination: CoordinatesType,
|
|
144
|
-
entityType: EntityTypeName = EntityType.SHIP
|
|
145
|
-
): Action {
|
|
142
|
+
warp(entityId: UInt64Type, destination: CoordinatesType): Action {
|
|
146
143
|
const x = Int64.from(destination.x)
|
|
147
144
|
const y = Int64.from(destination.y)
|
|
148
145
|
|
|
149
146
|
return this.server.action('warp', {
|
|
150
|
-
entity_type: entityType,
|
|
151
147
|
id: UInt64.from(entityId),
|
|
152
148
|
x,
|
|
153
149
|
y,
|
|
@@ -155,96 +151,269 @@ export class ActionsManager extends BaseManager {
|
|
|
155
151
|
}
|
|
156
152
|
|
|
157
153
|
craft(
|
|
158
|
-
entityType: EntityTypeName,
|
|
159
154
|
entityId: UInt64Type,
|
|
160
155
|
recipeId: number,
|
|
161
156
|
quantity: number,
|
|
162
157
|
inputs: ServerContract.ActionParams.Type.cargo_item[]
|
|
163
158
|
): Action {
|
|
164
|
-
const cargoInputs = inputs.map((i) => ServerContract.Types.cargo_item.from(i))
|
|
165
159
|
return this.server.action('craft', {
|
|
166
|
-
entity_type: entityType,
|
|
167
160
|
id: UInt64.from(entityId),
|
|
168
161
|
recipe_id: UInt16.from(recipeId),
|
|
169
162
|
quantity: UInt32.from(quantity),
|
|
170
|
-
inputs
|
|
163
|
+
inputs,
|
|
171
164
|
})
|
|
172
165
|
}
|
|
173
166
|
|
|
174
|
-
blend(
|
|
175
|
-
entityType: EntityTypeName,
|
|
176
|
-
entityId: UInt64Type,
|
|
177
|
-
inputs: ServerContract.ActionParams.Type.cargo_item[]
|
|
178
|
-
): Action {
|
|
179
|
-
const cargoInputs = inputs.map((i) => ServerContract.Types.cargo_item.from(i))
|
|
167
|
+
blend(entityId: UInt64Type, inputs: ServerContract.ActionParams.Type.cargo_item[]): Action {
|
|
180
168
|
return this.server.action('blend', {
|
|
181
|
-
entity_type: entityType,
|
|
182
169
|
id: UInt64.from(entityId),
|
|
183
|
-
inputs
|
|
170
|
+
inputs,
|
|
184
171
|
})
|
|
185
172
|
}
|
|
186
173
|
|
|
187
|
-
deploy(
|
|
188
|
-
entityType: EntityTypeName,
|
|
189
|
-
entityId: UInt64Type,
|
|
190
|
-
packedItemId: number,
|
|
191
|
-
stats: bigint
|
|
192
|
-
): Action {
|
|
174
|
+
deploy(entityId: UInt64Type, ref: ServerContract.ActionParams.Type.cargo_ref): Action {
|
|
193
175
|
return this.server.action('deploy', {
|
|
194
|
-
entity_type: entityType,
|
|
195
176
|
id: UInt64.from(entityId),
|
|
196
|
-
|
|
197
|
-
|
|
177
|
+
ref,
|
|
178
|
+
})
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
claimplot(
|
|
182
|
+
entityId: UInt64Type,
|
|
183
|
+
targetItemId: UInt16Type,
|
|
184
|
+
coords: ServerContract.ActionParams.Type.coordinates
|
|
185
|
+
): Action {
|
|
186
|
+
return this.server.action('claimplot', {
|
|
187
|
+
builder_id: UInt64.from(entityId),
|
|
188
|
+
target_item_id: UInt16.from(targetItemId),
|
|
189
|
+
coords,
|
|
190
|
+
})
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
buildplot(entityId: UInt64Type, plotId: UInt64Type): Action {
|
|
194
|
+
return this.server.action('buildplot', {
|
|
195
|
+
builder_id: UInt64.from(entityId),
|
|
196
|
+
plot_id: UInt64.from(plotId),
|
|
198
197
|
})
|
|
199
198
|
}
|
|
200
199
|
|
|
201
200
|
addmodule(
|
|
202
|
-
entityType: EntityTypeName,
|
|
203
201
|
entityId: UInt64Type,
|
|
204
202
|
moduleIndex: number,
|
|
205
|
-
|
|
206
|
-
|
|
203
|
+
moduleRef: ServerContract.ActionParams.Type.cargo_ref,
|
|
204
|
+
targetRef: ServerContract.ActionParams.Type.cargo_ref | null = null
|
|
207
205
|
): Action {
|
|
208
206
|
return this.server.action('addmodule', {
|
|
209
|
-
entity_type: entityType,
|
|
210
207
|
entity_id: UInt64.from(entityId),
|
|
211
208
|
module_index: moduleIndex,
|
|
212
|
-
|
|
213
|
-
|
|
209
|
+
module_ref: moduleRef,
|
|
210
|
+
target_ref: targetRef ?? undefined,
|
|
214
211
|
})
|
|
215
212
|
}
|
|
216
213
|
|
|
217
214
|
rmmodule(
|
|
218
|
-
entityType: EntityTypeName,
|
|
219
215
|
entityId: UInt64Type,
|
|
220
216
|
moduleIndex: number,
|
|
221
|
-
|
|
217
|
+
targetRef: ServerContract.ActionParams.Type.cargo_ref | null = null
|
|
222
218
|
): Action {
|
|
223
219
|
return this.server.action('rmmodule', {
|
|
224
|
-
entity_type: entityType,
|
|
225
220
|
entity_id: UInt64.from(entityId),
|
|
226
221
|
module_index: moduleIndex,
|
|
227
|
-
|
|
222
|
+
target_ref: targetRef ?? undefined,
|
|
228
223
|
})
|
|
229
224
|
}
|
|
230
225
|
|
|
231
|
-
|
|
226
|
+
swapmodule(
|
|
227
|
+
entityId: UInt64Type,
|
|
228
|
+
moduleIndex: number,
|
|
229
|
+
moduleRef: ServerContract.ActionParams.Type.cargo_ref
|
|
230
|
+
): Action {
|
|
231
|
+
return this.server.action('swapmodule', {
|
|
232
|
+
entity_id: UInt64.from(entityId),
|
|
233
|
+
module_index: moduleIndex,
|
|
234
|
+
module_ref: moduleRef,
|
|
235
|
+
})
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
async wrap(
|
|
232
239
|
owner: NameType,
|
|
233
|
-
entityType: EntityTypeName,
|
|
234
240
|
entityId: UInt64Type,
|
|
241
|
+
nexusId: UInt64Type,
|
|
235
242
|
cargoId: UInt64Type,
|
|
236
|
-
quantity: UInt64Type
|
|
237
|
-
|
|
238
|
-
|
|
243
|
+
quantity: UInt64Type,
|
|
244
|
+
opts: {claimRam?: boolean} = {}
|
|
245
|
+
): Promise<Action[]> {
|
|
246
|
+
const actions: Action[] = [
|
|
247
|
+
this.platform.action('wrapcargo', {
|
|
248
|
+
game: this.server.account,
|
|
249
|
+
owner: Name.from(owner),
|
|
250
|
+
entity_id: UInt64.from(entityId),
|
|
251
|
+
nexus_id: UInt64.from(nexusId),
|
|
252
|
+
cargo_id: UInt64.from(cargoId),
|
|
253
|
+
quantity: UInt64.from(quantity),
|
|
254
|
+
}),
|
|
255
|
+
]
|
|
256
|
+
const claimRam =
|
|
257
|
+
opts.claimRam ?? (this.atomicAssetsAccount ?? 'atomicassets') !== 'atomicassets'
|
|
258
|
+
if (claimRam) {
|
|
259
|
+
actions.push(this.setLastPayer(owner, SHIPLOAD_COLLECTION))
|
|
260
|
+
}
|
|
261
|
+
return actions
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
undeploy(hostId: UInt64Type, targetId: UInt64Type): Action {
|
|
265
|
+
return this.server.action('undeploy', {
|
|
266
|
+
host_id: UInt64.from(hostId),
|
|
267
|
+
target_id: UInt64.from(targetId),
|
|
268
|
+
})
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
claimStarter(owner: NameType): Action {
|
|
272
|
+
return this.server.action('claimstarter', {
|
|
239
273
|
owner: Name.from(owner),
|
|
240
|
-
|
|
274
|
+
})
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
async wrapEntity(
|
|
278
|
+
owner: NameType,
|
|
279
|
+
entityId: UInt64Type,
|
|
280
|
+
nexusId: UInt64Type,
|
|
281
|
+
opts: {claimRam?: boolean} = {}
|
|
282
|
+
): Promise<Action[]> {
|
|
283
|
+
const actions: Action[] = [
|
|
284
|
+
this.platform.action('wrapentity', {
|
|
285
|
+
game: this.server.account,
|
|
286
|
+
owner: Name.from(owner),
|
|
287
|
+
entity_id: UInt64.from(entityId),
|
|
288
|
+
nexus_id: UInt64.from(nexusId),
|
|
289
|
+
}),
|
|
290
|
+
]
|
|
291
|
+
const claimRam =
|
|
292
|
+
opts.claimRam ?? (this.atomicAssetsAccount ?? 'atomicassets') !== 'atomicassets'
|
|
293
|
+
if (claimRam) {
|
|
294
|
+
actions.push(this.setLastPayer(owner, SHIPLOAD_COLLECTION))
|
|
295
|
+
}
|
|
296
|
+
return actions
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
placecargo(owner: NameType, hostId: UInt64Type, assetId: UInt64Type): Action {
|
|
300
|
+
return this.server.action('placecargo', {
|
|
301
|
+
owner: Name.from(owner),
|
|
302
|
+
host_id: UInt64.from(hostId),
|
|
303
|
+
asset_id: UInt64.from(assetId),
|
|
304
|
+
})
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
placeentity(owner: NameType, assetId: UInt64Type, targetNexusId: UInt64Type): Action {
|
|
308
|
+
return this.server.action('placeentity', {
|
|
309
|
+
owner: Name.from(owner),
|
|
310
|
+
asset_id: UInt64.from(assetId),
|
|
311
|
+
target_nexus_id: UInt64.from(targetNexusId),
|
|
312
|
+
})
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
transferForUnwrap(owner: NameType, assetId: UInt64Type): Action {
|
|
316
|
+
return Action.from(
|
|
317
|
+
{
|
|
318
|
+
account: this.atomicAssetsAccount,
|
|
319
|
+
name: 'transfer',
|
|
320
|
+
authorization: [{actor: Name.from(owner), permission: 'active'}],
|
|
321
|
+
data: {
|
|
322
|
+
from: Name.from(owner),
|
|
323
|
+
to: this.platform.account,
|
|
324
|
+
asset_ids: [UInt64.from(assetId)],
|
|
325
|
+
memo: 'unwrap',
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
ATOMICASSETS_ABI
|
|
329
|
+
)
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// Two top-level actions the wallet signs to unwrap an NFT into a host's cargo.
|
|
333
|
+
unwrapCargoTx(owner: NameType, assetId: UInt64Type, hostId: UInt64Type): Action[] {
|
|
334
|
+
return [this.transferForUnwrap(owner, assetId), this.placecargo(owner, hostId, assetId)]
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// Two top-level actions the wallet signs to place an entity NFT at a nexus.
|
|
338
|
+
unwrapEntityTx(owner: NameType, assetId: UInt64Type, targetNexusId: UInt64Type): Action[] {
|
|
339
|
+
return [
|
|
340
|
+
this.transferForUnwrap(owner, assetId),
|
|
341
|
+
this.placeentity(owner, assetId, targetNexusId),
|
|
342
|
+
]
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
setRamPayer(newPayer: NameType, assetId: UInt64Type): Action {
|
|
346
|
+
return Action.from(
|
|
347
|
+
{
|
|
348
|
+
account: this.atomicAssetsAccount,
|
|
349
|
+
name: 'setrampayer',
|
|
350
|
+
authorization: [{actor: Name.from(newPayer), permission: 'active'}],
|
|
351
|
+
data: {new_payer: Name.from(newPayer), asset_id: UInt64.from(assetId)},
|
|
352
|
+
},
|
|
353
|
+
ATOMICASSETS_ABI
|
|
354
|
+
)
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
setLastPayer(owner: NameType, collectionName: NameType): Action {
|
|
358
|
+
return Action.from(
|
|
359
|
+
{
|
|
360
|
+
account: this.atomicAssetsAccount,
|
|
361
|
+
name: 'setlastpayer',
|
|
362
|
+
authorization: [{actor: Name.from(owner), permission: 'active'}],
|
|
363
|
+
data: {owner: Name.from(owner), collection_name: Name.from(collectionName)},
|
|
364
|
+
},
|
|
365
|
+
ATOMICASSETS_ABI
|
|
366
|
+
)
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
demolish(entityId: UInt64Type): Action {
|
|
370
|
+
return this.server.action('demolish', {
|
|
241
371
|
entity_id: UInt64.from(entityId),
|
|
242
|
-
cargo_id: UInt64.from(cargoId),
|
|
243
|
-
quantity: UInt64.from(quantity),
|
|
244
372
|
})
|
|
245
373
|
}
|
|
246
374
|
|
|
247
375
|
joinGame(account: NameType, companyName: string): Action[] {
|
|
248
376
|
return [this.foundCompany(account, companyName), this.join(account)]
|
|
249
377
|
}
|
|
378
|
+
|
|
379
|
+
commit(oracleId: NameType, epoch: UInt64Type, commit: Checksum256Type): Action {
|
|
380
|
+
return this.server.action('commit', {
|
|
381
|
+
oracle_id: Name.from(oracleId),
|
|
382
|
+
epoch: UInt64.from(epoch),
|
|
383
|
+
commit: Checksum256.from(commit),
|
|
384
|
+
})
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
reveal(oracleId: NameType, epoch: UInt64Type, reveal: Checksum256Type): Action {
|
|
388
|
+
return this.server.action('reveal', {
|
|
389
|
+
oracle_id: Name.from(oracleId),
|
|
390
|
+
epoch: UInt64.from(epoch),
|
|
391
|
+
reveal: Checksum256.from(reveal),
|
|
392
|
+
})
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
addoracle(oracleId: NameType): Action {
|
|
396
|
+
return this.server.action('addoracle', {
|
|
397
|
+
oracle_id: Name.from(oracleId),
|
|
398
|
+
})
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
removeoracle(oracleId: NameType): Action {
|
|
402
|
+
return this.server.action('removeoracle', {
|
|
403
|
+
oracle_id: Name.from(oracleId),
|
|
404
|
+
})
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
setthreshold(threshold: UInt8Type): Action {
|
|
408
|
+
return this.server.action('setthreshold', {
|
|
409
|
+
threshold: UInt8.from(threshold),
|
|
410
|
+
})
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
cleanrsvp(epoch: UInt64Type, maxRows: UInt64Type): Action {
|
|
414
|
+
return this.server.action('cleanrsvp', {
|
|
415
|
+
epoch: UInt64.from(epoch),
|
|
416
|
+
max_rows: UInt64.from(maxRows),
|
|
417
|
+
})
|
|
418
|
+
}
|
|
250
419
|
}
|
package/src/managers/base.ts
CHANGED
|
@@ -15,11 +15,15 @@ export abstract class BaseManager {
|
|
|
15
15
|
return this.context.platform
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
protected get atomicAssetsAccount() {
|
|
19
|
+
return this.context.atomicAssetsAccount
|
|
20
|
+
}
|
|
21
|
+
|
|
18
22
|
protected async getGame() {
|
|
19
23
|
return this.context.getGame()
|
|
20
24
|
}
|
|
21
25
|
|
|
22
|
-
protected async getState() {
|
|
23
|
-
return this.context.getState()
|
|
26
|
+
protected async getState(reload = false) {
|
|
27
|
+
return this.context.getState(reload)
|
|
24
28
|
}
|
|
25
29
|
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type {Name, UInt32, UInt64} from '@wharfkit/antelope'
|
|
2
|
+
import type {ServerContract} from '../contracts'
|
|
3
|
+
import type {Item} from '../types'
|
|
4
|
+
import type {Recipe} from '../data/recipes-runtime'
|
|
5
|
+
import type {PlotProgress} from './plot'
|
|
6
|
+
|
|
7
|
+
export type BuildState = 'initializing' | 'accepting' | 'ready' | 'scheduled' | 'finalizing'
|
|
8
|
+
|
|
9
|
+
export type FinalizerCapability = 'crafter'
|
|
10
|
+
|
|
11
|
+
export interface BuildableTarget {
|
|
12
|
+
entityId: UInt64
|
|
13
|
+
ownerName: Name
|
|
14
|
+
coordinates: ServerContract.Types.coordinates
|
|
15
|
+
targetItemId: number
|
|
16
|
+
targetItem: Item
|
|
17
|
+
state: BuildState
|
|
18
|
+
recipe: Recipe
|
|
19
|
+
progress: PlotProgress
|
|
20
|
+
finalizeAction: Name
|
|
21
|
+
finalizerCapability: FinalizerCapability
|
|
22
|
+
activeTask?: ServerContract.Types.task
|
|
23
|
+
scheduledBuild?: ScheduledBuild
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface SourceEntityRef {
|
|
27
|
+
entityId: UInt64
|
|
28
|
+
name: string
|
|
29
|
+
hasLoaders: boolean
|
|
30
|
+
loaderCount: number
|
|
31
|
+
loaderTotalMass: number
|
|
32
|
+
relevantCargo: SourceCargoStack[]
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface SourceCargoStack {
|
|
36
|
+
key: string
|
|
37
|
+
rowId: UInt64
|
|
38
|
+
itemId: number
|
|
39
|
+
item: Item
|
|
40
|
+
stats: UInt64
|
|
41
|
+
modules: ServerContract.Types.module_entry[]
|
|
42
|
+
available: number
|
|
43
|
+
plotNeeds: number
|
|
44
|
+
reserved: number
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface FinalizerEntityRef {
|
|
48
|
+
entityId: UInt64
|
|
49
|
+
name: string
|
|
50
|
+
capability: FinalizerCapability
|
|
51
|
+
crafterSpeed: number
|
|
52
|
+
estimatedDuration: UInt32
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface InboundTransfer {
|
|
56
|
+
sourceEntityId: UInt64
|
|
57
|
+
sourceEntityType: Name
|
|
58
|
+
sourceName: string
|
|
59
|
+
itemId: number
|
|
60
|
+
quantity: number
|
|
61
|
+
etaSeconds: number
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface ScheduledBuild {
|
|
65
|
+
shipId: UInt64
|
|
66
|
+
shipName: string
|
|
67
|
+
hasStarted: boolean
|
|
68
|
+
startsAt: number
|
|
69
|
+
completesAt: number
|
|
70
|
+
cancelable: boolean
|
|
71
|
+
blockingTaskCount: number
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface Reservation {
|
|
75
|
+
targetEntityId: UInt64
|
|
76
|
+
targetEntityType: Name
|
|
77
|
+
itemId: number
|
|
78
|
+
quantity: number
|
|
79
|
+
}
|