@shipload/sdk 1.0.0-next.5 → 1.0.0-next.51
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/scan.d.ts +52 -0
- package/lib/scan.js +162 -0
- package/lib/scan.js.map +1 -0
- package/lib/scan.m.js +152 -0
- package/lib/scan.m.js.map +1 -0
- package/lib/shipload.d.ts +3167 -1353
- package/lib/shipload.js +13319 -5640
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +13091 -5589
- package/lib/shipload.m.js.map +1 -1
- package/lib/testing.d.ts +1037 -0
- package/lib/testing.js +4363 -0
- package/lib/testing.js.map +1 -0
- package/lib/testing.m.js +4357 -0
- package/lib/testing.m.js.map +1 -0
- package/package.json +20 -2
- package/src/capabilities/craftable.ts +51 -0
- package/src/capabilities/crafting.test.ts +7 -0
- package/src/capabilities/crafting.ts +6 -7
- package/src/capabilities/gathering.test.ts +29 -0
- package/src/capabilities/gathering.ts +37 -19
- package/src/capabilities/index.ts +0 -1
- package/src/capabilities/modules.ts +22 -0
- package/src/capabilities/storage.ts +16 -1
- package/src/contracts/platform.ts +231 -3
- package/src/contracts/server.ts +1178 -511
- package/src/coordinates/address.ts +88 -0
- package/src/coordinates/constants.test.ts +15 -0
- package/src/coordinates/constants.ts +23 -0
- package/src/coordinates/index.ts +15 -0
- package/src/coordinates/memo.test.ts +47 -0
- package/src/coordinates/memo.ts +20 -0
- package/src/coordinates/permutation.ts +77 -0
- package/src/coordinates/regions.ts +48 -0
- package/src/coordinates/sectors.ts +115 -0
- package/src/data/capabilities.ts +31 -16
- package/src/data/capability-formulas.ts +21 -14
- package/src/data/catalog.ts +0 -5
- package/src/data/colors.ts +13 -47
- package/src/data/entities.json +154 -10
- package/src/data/item-ids.ts +31 -12
- package/src/data/items.json +192 -74
- package/src/data/kind-registry.json +131 -0
- package/src/data/kind-registry.ts +172 -0
- package/src/data/metadata.ts +166 -48
- package/src/data/recipes-runtime.ts +5 -23
- package/src/data/recipes.json +1003 -163
- package/src/derivation/build-methods.test.ts +13 -0
- package/src/derivation/build-methods.ts +48 -0
- package/src/derivation/capabilities.test.ts +151 -0
- package/src/derivation/capabilities.ts +527 -0
- package/src/derivation/capability-mappings.ts +58 -16
- package/src/derivation/crafting.ts +36 -33
- package/src/derivation/index.ts +28 -2
- package/src/derivation/recipe-usage.test.ts +81 -0
- package/src/derivation/recipe-usage.ts +141 -0
- package/src/derivation/reserve-regen.ts +34 -0
- package/src/derivation/resources.ts +98 -19
- package/src/derivation/rollups.test.ts +55 -0
- package/src/derivation/rollups.ts +56 -0
- package/src/derivation/stars.test.ts +67 -0
- package/src/derivation/stars.ts +25 -0
- package/src/derivation/stats.ts +6 -6
- package/src/derivation/stratum.ts +26 -22
- package/src/derivation/tiers.ts +40 -7
- package/src/derivation/upgrades.ts +14 -0
- package/src/derivation/wormhole.ts +141 -0
- package/src/entities/entity.ts +98 -0
- package/src/entities/gamestate.ts +3 -28
- package/src/entities/makers.ts +131 -134
- package/src/entities/slot-multiplier.ts +43 -0
- package/src/errors.ts +12 -16
- package/src/format.ts +26 -4
- package/src/index-module.ts +294 -34
- package/src/managers/actions.ts +616 -105
- package/src/managers/base.ts +6 -2
- package/src/managers/cluster.test.ts +39 -0
- package/src/managers/cluster.ts +53 -0
- package/src/managers/construction-types.ts +80 -0
- package/src/managers/construction.ts +412 -0
- package/src/managers/context.ts +29 -1
- package/src/managers/coordinates.ts +14 -0
- package/src/managers/entities.ts +27 -66
- package/src/managers/epochs.ts +40 -0
- package/src/managers/flatten-gather-plan.test.ts +80 -0
- package/src/managers/index.ts +20 -1
- package/src/managers/locations.ts +25 -29
- package/src/managers/nft.test.ts +14 -0
- package/src/managers/nft.ts +70 -0
- package/src/managers/players.ts +25 -0
- package/src/managers/plot.ts +122 -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 +336 -0
- package/src/nft/description.ts +104 -36
- package/src/nft/index.ts +3 -0
- package/src/planner/index.ts +242 -0
- package/src/planner/planner.test.ts +325 -0
- package/src/resolution/describe-module.ts +43 -25
- package/src/resolution/display-name.ts +38 -10
- package/src/resolution/resolve-item.test.ts +48 -0
- package/src/resolution/resolve-item.ts +74 -47
- package/src/scan/index.ts +244 -0
- package/src/scan/scan-wasm.base64.ts +2 -0
- package/src/scheduling/accessor.ts +65 -23
- package/src/scheduling/availability.ts +108 -0
- package/src/scheduling/cancel.test.ts +348 -0
- package/src/scheduling/cancel.ts +209 -0
- package/src/scheduling/energy.ts +47 -0
- package/src/scheduling/idle-resolve.ts +45 -0
- package/src/scheduling/lane-core.ts +128 -0
- package/src/scheduling/lanes.test.ts +249 -0
- package/src/scheduling/lanes.ts +198 -0
- package/src/scheduling/projection.ts +210 -107
- package/src/scheduling/schedule.ts +240 -117
- package/src/scheduling/task-cargo.ts +46 -0
- package/src/scheduling/unwrap.test.ts +86 -0
- package/src/scheduling/unwrap.ts +190 -0
- package/src/shipload.ts +26 -1
- package/src/subscriptions/manager.cluster.test.ts +51 -0
- package/src/subscriptions/manager.ts +245 -172
- package/src/subscriptions/mappers.ts +5 -8
- package/src/subscriptions/types.ts +28 -3
- package/src/testing/catalog-hash.ts +19 -0
- package/src/testing/index.ts +2 -0
- package/src/testing/projection-parity.ts +167 -0
- package/src/travel/reach.ts +23 -0
- package/src/travel/route-planner.ts +277 -0
- package/src/travel/route-simulator.ts +174 -0
- package/src/travel/travel.ts +175 -118
- package/src/types/capabilities.ts +29 -6
- package/src/types/entity.ts +3 -3
- package/src/types/index.ts +0 -1
- package/src/types.ts +39 -14
- package/src/utils/cargo.test.ts +14 -0
- package/src/utils/cargo.ts +29 -0
- package/src/utils/display-name.ts +70 -0
- package/src/utils/system.ts +36 -24
- package/src/capabilities/loading.ts +0 -8
- package/src/entities/container.ts +0 -123
- package/src/entities/ship-deploy.ts +0 -295
- package/src/entities/ship.ts +0 -221
- package/src/entities/warehouse.ts +0 -127
- package/src/types/entity-traits.ts +0 -69
package/src/managers/actions.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
Action,
|
|
3
|
+
Checksum256,
|
|
4
|
+
type Checksum256Type,
|
|
3
5
|
Int64,
|
|
6
|
+
type Int64Type,
|
|
4
7
|
Name,
|
|
5
8
|
type NameType,
|
|
9
|
+
Transaction,
|
|
10
|
+
UInt8,
|
|
11
|
+
type UInt8Type,
|
|
6
12
|
UInt16,
|
|
7
13
|
type UInt16Type,
|
|
8
14
|
UInt32,
|
|
@@ -11,21 +17,159 @@ import {
|
|
|
11
17
|
type UInt64Type,
|
|
12
18
|
} from '@wharfkit/antelope'
|
|
13
19
|
import {BaseManager} from './base'
|
|
14
|
-
import {
|
|
20
|
+
import {Coordinates, PRECISION, type ClusterSlotType, type CoordinatesType} from '../types'
|
|
15
21
|
import {ServerContract} from '../contracts'
|
|
22
|
+
import {ATOMICASSETS_ABI, SHIPLOAD_COLLECTION} from '../nft/atomicassets'
|
|
23
|
+
import {getItem} from '../data/catalog'
|
|
24
|
+
import type {GatherPlan} from '../planner'
|
|
25
|
+
|
|
26
|
+
const CHARGE_K = 1n
|
|
27
|
+
const ENERGY_DIVISOR = 1_000_000n
|
|
28
|
+
const UINT32_MAX = 4_294_967_295
|
|
29
|
+
const UINT32_MAX_BIGINT = 4_294_967_295n
|
|
30
|
+
const UINT32_MOD = 4_294_967_296n
|
|
31
|
+
const UINT64_MAX = 18_446_744_073_709_551_615n
|
|
32
|
+
const PRECISION_BIGINT = BigInt(PRECISION)
|
|
33
|
+
|
|
34
|
+
export type LaunchNumericInput =
|
|
35
|
+
| number
|
|
36
|
+
| bigint
|
|
37
|
+
| string
|
|
38
|
+
| {toNumber(): number}
|
|
39
|
+
| {toString(): string}
|
|
40
|
+
|
|
41
|
+
export interface LaunchStatsInput {
|
|
42
|
+
charge_rate?: LaunchNumericInput
|
|
43
|
+
chargeRate?: LaunchNumericInput
|
|
44
|
+
velocity: LaunchNumericInput
|
|
45
|
+
drain: LaunchNumericInput
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface LaunchQuoteLauncher {
|
|
49
|
+
coordinates: CoordinatesType
|
|
50
|
+
launcher: LaunchStatsInput
|
|
51
|
+
generator?: {capacity: LaunchNumericInput}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface LaunchQuoteCatcher {
|
|
55
|
+
coordinates: CoordinatesType
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface LaunchQuote {
|
|
59
|
+
chargeTime: number
|
|
60
|
+
flightTime: number
|
|
61
|
+
arrival: Date
|
|
62
|
+
energyCost: number
|
|
63
|
+
maxReach: bigint
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function toNumber(value: LaunchNumericInput): number {
|
|
67
|
+
if (typeof value === 'number') return Math.trunc(value)
|
|
68
|
+
if (typeof value === 'bigint') return Number(value)
|
|
69
|
+
if (typeof value === 'string') return Number(value)
|
|
70
|
+
if ('toNumber' in value && typeof value.toNumber === 'function') return value.toNumber()
|
|
71
|
+
return Number(value.toString())
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function requiredNumber(value: LaunchNumericInput | undefined, label: string): number {
|
|
75
|
+
if (value === undefined) throw new Error(`launch quote requires ${label}`)
|
|
76
|
+
return toNumber(value)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function toBigInt(value: LaunchNumericInput | undefined): bigint {
|
|
80
|
+
if (value === undefined) return 0n
|
|
81
|
+
if (typeof value === 'bigint') return value
|
|
82
|
+
if (typeof value === 'number') return BigInt(Math.trunc(value))
|
|
83
|
+
if (typeof value === 'string') return BigInt(value)
|
|
84
|
+
return BigInt(value.toString())
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function saturatingMul(lhs: bigint, rhs: bigint): bigint {
|
|
88
|
+
if (lhs !== 0n && rhs > UINT64_MAX / lhs) {
|
|
89
|
+
return UINT64_MAX
|
|
90
|
+
}
|
|
91
|
+
return lhs * rhs
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function clampLaunchResult(value: bigint): number {
|
|
95
|
+
if (value < 1n) return 1
|
|
96
|
+
if (value > UINT32_MAX_BIGINT) return UINT32_MAX
|
|
97
|
+
return Number(value)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function toUint32(value: bigint): bigint {
|
|
101
|
+
return value % UINT32_MOD
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function calcDistance(origin: CoordinatesType, destination: CoordinatesType): bigint {
|
|
105
|
+
const a = Coordinates.from(origin)
|
|
106
|
+
const b = Coordinates.from(destination)
|
|
107
|
+
const dx = toNumber(a.x) - toNumber(b.x)
|
|
108
|
+
const dy = toNumber(a.y) - toNumber(b.y)
|
|
109
|
+
return BigInt(Math.trunc(Math.sqrt(dx * dx + dy * dy) * PRECISION))
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function calcCargoItemMassUint32(item: ServerContract.ActionParams.Type.cargo_item): bigint {
|
|
113
|
+
let mass = toUint32(BigInt(getItem(item.item_id).mass) * toUint32(toBigInt(item.quantity)))
|
|
114
|
+
|
|
115
|
+
for (const mod of item.modules) {
|
|
116
|
+
if (mod.installed) {
|
|
117
|
+
mass = toUint32(mass + BigInt(getItem(mod.installed.item_id).mass))
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return mass
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function calcPayloadMass(items: ServerContract.ActionParams.Type.cargo_item[]): bigint {
|
|
125
|
+
let mass = 0n
|
|
126
|
+
for (const item of items) {
|
|
127
|
+
mass = toUint32(mass + calcCargoItemMassUint32(item))
|
|
128
|
+
}
|
|
129
|
+
return mass
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function calcChargeTime(chargeRate: number, mass: bigint): number {
|
|
133
|
+
const rate = BigInt(chargeRate || 1)
|
|
134
|
+
return clampLaunchResult((mass * CHARGE_K) / rate)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function calcFlightTime(velocity: number, distance: bigint): number {
|
|
138
|
+
const v = BigInt(velocity || 1)
|
|
139
|
+
return clampLaunchResult(distance / (v * PRECISION_BIGINT))
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function calcLaunchEnergy(drain: number, mass: bigint, distance: bigint): number {
|
|
143
|
+
const e =
|
|
144
|
+
saturatingMul(saturatingMul(mass, distance / PRECISION_BIGINT), BigInt(drain)) /
|
|
145
|
+
ENERGY_DIVISOR
|
|
146
|
+
return clampLaunchResult(e)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function calcMaxReach(energyBudget: bigint, mass: bigint, drain: number): bigint {
|
|
150
|
+
if (energyBudget < 1n) return 0n
|
|
151
|
+
if (energyBudget >= UINT32_MAX_BIGINT || mass === 0n || drain === 0) return UINT64_MAX
|
|
152
|
+
|
|
153
|
+
const numerator = (energyBudget + 1n) * ENERGY_DIVISOR - 1n
|
|
154
|
+
const denominator = mass * BigInt(drain)
|
|
155
|
+
const distanceUnits = numerator / denominator
|
|
156
|
+
const maxDistance = distanceUnits * PRECISION_BIGINT + (PRECISION_BIGINT - 1n)
|
|
157
|
+
return maxDistance > UINT64_MAX ? UINT64_MAX : maxDistance
|
|
158
|
+
}
|
|
16
159
|
|
|
17
160
|
export type EntityRefInput = {
|
|
18
161
|
entityType: NameType
|
|
19
162
|
entityId: UInt64Type
|
|
20
163
|
}
|
|
21
164
|
|
|
165
|
+
export type WaypointInput = {x: Int64Type; y: Int64Type}
|
|
166
|
+
|
|
22
167
|
export class ActionsManager extends BaseManager {
|
|
23
168
|
travel(shipId: UInt64Type, destination: CoordinatesType, recharge = true): Action {
|
|
24
169
|
const x = Int64.from(destination.x)
|
|
25
170
|
const y = Int64.from(destination.y)
|
|
26
171
|
|
|
27
172
|
return this.server.action('travel', {
|
|
28
|
-
entity_type: EntityType.SHIP,
|
|
29
173
|
id: UInt64.from(shipId),
|
|
30
174
|
x,
|
|
31
175
|
y,
|
|
@@ -33,13 +177,17 @@ export class ActionsManager extends BaseManager {
|
|
|
33
177
|
})
|
|
34
178
|
}
|
|
35
179
|
|
|
36
|
-
|
|
37
|
-
|
|
180
|
+
private entityRefs(entities: EntityRefInput[]) {
|
|
181
|
+
return entities.map((e) =>
|
|
38
182
|
ServerContract.Types.entity_ref.from({
|
|
39
183
|
entity_type: e.entityType,
|
|
40
184
|
entity_id: UInt64.from(e.entityId),
|
|
41
185
|
})
|
|
42
186
|
)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
grouptravel(entities: EntityRefInput[], destination: CoordinatesType, recharge = true): Action {
|
|
190
|
+
const entityRefs = this.entityRefs(entities)
|
|
43
191
|
const x = Int64.from(destination.x)
|
|
44
192
|
const y = Int64.from(destination.y)
|
|
45
193
|
|
|
@@ -51,13 +199,58 @@ export class ActionsManager extends BaseManager {
|
|
|
51
199
|
})
|
|
52
200
|
}
|
|
53
201
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
202
|
+
travelroute(entities: EntityRefInput[], waypoints: WaypointInput[], recharge = true): Action {
|
|
203
|
+
const entityRefs = this.entityRefs(entities)
|
|
204
|
+
const wps = waypoints.map((w) =>
|
|
205
|
+
ServerContract.Types.route_waypoint.from({x: Int64.from(w.x), y: Int64.from(w.y)})
|
|
206
|
+
)
|
|
207
|
+
return this.server.action('travelroute', {
|
|
208
|
+
entities: entityRefs,
|
|
209
|
+
waypoints: wps,
|
|
210
|
+
recharge,
|
|
211
|
+
})
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
transit(shipId: UInt64Type, entrance: CoordinatesType, exit: CoordinatesType): Action {
|
|
215
|
+
return this.server.action('transit', {
|
|
216
|
+
id: UInt64.from(shipId),
|
|
217
|
+
ax: Int64.from(entrance.x),
|
|
218
|
+
ay: Int64.from(entrance.y),
|
|
219
|
+
bx: Int64.from(exit.x),
|
|
220
|
+
by: Int64.from(exit.y),
|
|
221
|
+
})
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
grouptransit(
|
|
225
|
+
entities: EntityRefInput[],
|
|
226
|
+
entrance: CoordinatesType,
|
|
227
|
+
exit: CoordinatesType
|
|
58
228
|
): Action {
|
|
229
|
+
const entityRefs = this.entityRefs(entities)
|
|
230
|
+
return this.server.action('grouptransit', {
|
|
231
|
+
entities: entityRefs,
|
|
232
|
+
ax: Int64.from(entrance.x),
|
|
233
|
+
ay: Int64.from(entrance.y),
|
|
234
|
+
bx: Int64.from(exit.x),
|
|
235
|
+
by: Int64.from(exit.y),
|
|
236
|
+
})
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
getwormhole(x: Int64Type, y: Int64Type): Action {
|
|
240
|
+
return this.server.action('getwormhole', {x: Int64.from(x), y: Int64.from(y)})
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
getdistance(origin: CoordinatesType, destination: CoordinatesType): Action {
|
|
244
|
+
return this.server.action('getdistance', {
|
|
245
|
+
ax: Int64.from(origin.x),
|
|
246
|
+
ay: Int64.from(origin.y),
|
|
247
|
+
bx: Int64.from(destination.x),
|
|
248
|
+
by: Int64.from(destination.y),
|
|
249
|
+
})
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
resolve(entityId: UInt64Type, count?: UInt64Type): Action {
|
|
59
253
|
const params: ServerContract.ActionParams.resolve = {
|
|
60
|
-
entity_type: entityType,
|
|
61
254
|
id: UInt64.from(entityId),
|
|
62
255
|
}
|
|
63
256
|
if (count !== undefined) {
|
|
@@ -66,45 +259,103 @@ export class ActionsManager extends BaseManager {
|
|
|
66
259
|
return this.server.action('resolve', params)
|
|
67
260
|
}
|
|
68
261
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
262
|
+
resolveall(owner: NameType): Action {
|
|
263
|
+
return this.server.action('resolveall', {
|
|
264
|
+
owner: Name.from(owner),
|
|
265
|
+
})
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
cancel(entityId: UInt64Type, laneKey: number, count: UInt64Type): Action {
|
|
74
269
|
return this.server.action('cancel', {
|
|
75
|
-
entity_type: entityType,
|
|
76
270
|
id: UInt64.from(entityId),
|
|
271
|
+
lane_key: UInt8.from(laneKey),
|
|
77
272
|
count: UInt64.from(count),
|
|
78
273
|
})
|
|
79
274
|
}
|
|
80
275
|
|
|
81
|
-
recharge(entityId: UInt64Type
|
|
276
|
+
recharge(entityId: UInt64Type): Action {
|
|
82
277
|
return this.server.action('recharge', {
|
|
83
|
-
entity_type: entityType,
|
|
84
278
|
id: UInt64.from(entityId),
|
|
85
279
|
})
|
|
86
280
|
}
|
|
87
281
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
282
|
+
rename(entityId: UInt64Type, name: string): Action {
|
|
283
|
+
return this.server.action('rename', {
|
|
284
|
+
id: UInt64.from(entityId),
|
|
285
|
+
name,
|
|
286
|
+
})
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
refrshentity(entityId: UInt64Type): Action {
|
|
290
|
+
return this.server.action('refrshentity', {
|
|
291
|
+
entity_id: UInt64.from(entityId),
|
|
292
|
+
})
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
load(
|
|
296
|
+
id: UInt64Type,
|
|
297
|
+
fromId: UInt64Type,
|
|
298
|
+
items: ServerContract.ActionParams.Type.cargo_item[]
|
|
96
299
|
): Action {
|
|
97
|
-
return this.server.action('
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
dest_id: UInt64.from(destId),
|
|
102
|
-
item_id: UInt16.from(itemId),
|
|
103
|
-
stats: UInt64.from(stats),
|
|
104
|
-
quantity: UInt32.from(quantity),
|
|
300
|
+
return this.server.action('load', {
|
|
301
|
+
id: UInt64.from(id),
|
|
302
|
+
from_id: UInt64.from(fromId),
|
|
303
|
+
items,
|
|
105
304
|
})
|
|
106
305
|
}
|
|
107
306
|
|
|
307
|
+
unload(
|
|
308
|
+
id: UInt64Type,
|
|
309
|
+
toId: UInt64Type,
|
|
310
|
+
items: ServerContract.ActionParams.Type.cargo_item[]
|
|
311
|
+
): Action {
|
|
312
|
+
return this.server.action('unload', {
|
|
313
|
+
id: UInt64.from(id),
|
|
314
|
+
to_id: UInt64.from(toId),
|
|
315
|
+
items,
|
|
316
|
+
})
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
launch(
|
|
320
|
+
launcherId: UInt64Type,
|
|
321
|
+
catcherId: UInt64Type,
|
|
322
|
+
items: ServerContract.ActionParams.Type.cargo_item[]
|
|
323
|
+
): Action {
|
|
324
|
+
return this.server.action('launch', {
|
|
325
|
+
launcher_id: UInt64.from(launcherId),
|
|
326
|
+
catcher_id: UInt64.from(catcherId),
|
|
327
|
+
items,
|
|
328
|
+
})
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
getLaunchQuote(
|
|
332
|
+
launcher: LaunchQuoteLauncher,
|
|
333
|
+
catcher: LaunchQuoteCatcher,
|
|
334
|
+
items: ServerContract.ActionParams.Type.cargo_item[],
|
|
335
|
+
start = new Date()
|
|
336
|
+
): LaunchQuote {
|
|
337
|
+
const chargeRate = requiredNumber(
|
|
338
|
+
launcher.launcher.charge_rate ?? launcher.launcher.chargeRate,
|
|
339
|
+
'launcher charge rate'
|
|
340
|
+
)
|
|
341
|
+
const velocity = requiredNumber(launcher.launcher.velocity, 'launcher velocity')
|
|
342
|
+
const drain = requiredNumber(launcher.launcher.drain, 'launcher drain')
|
|
343
|
+
const mass = calcPayloadMass(items)
|
|
344
|
+
const distance = calcDistance(launcher.coordinates, catcher.coordinates)
|
|
345
|
+
const chargeTime = calcChargeTime(chargeRate, mass)
|
|
346
|
+
const flightTime = calcFlightTime(velocity, distance)
|
|
347
|
+
const energyCost = calcLaunchEnergy(drain, mass, distance)
|
|
348
|
+
const maxReach = calcMaxReach(toBigInt(launcher.generator?.capacity), mass, drain)
|
|
349
|
+
|
|
350
|
+
return {
|
|
351
|
+
chargeTime,
|
|
352
|
+
flightTime,
|
|
353
|
+
arrival: new Date(start.getTime() + (chargeTime + flightTime) * 1000),
|
|
354
|
+
energyCost,
|
|
355
|
+
maxReach,
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
108
359
|
foundCompany(account: NameType, name: string): Action {
|
|
109
360
|
return this.platform.action('foundcompany', {
|
|
110
361
|
account: Name.from(account),
|
|
@@ -119,35 +370,73 @@ export class ActionsManager extends BaseManager {
|
|
|
119
370
|
}
|
|
120
371
|
|
|
121
372
|
gather(
|
|
122
|
-
|
|
123
|
-
|
|
373
|
+
sourceId: UInt64Type,
|
|
374
|
+
destinationId: UInt64Type,
|
|
124
375
|
stratum: UInt16Type,
|
|
125
|
-
quantity: UInt32Type
|
|
376
|
+
quantity: UInt32Type,
|
|
377
|
+
slot?: UInt8Type
|
|
126
378
|
): Action {
|
|
127
|
-
|
|
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
|
-
}),
|
|
379
|
+
const params: ServerContract.ActionParams.gather = {
|
|
380
|
+
source_id: UInt64.from(sourceId),
|
|
381
|
+
destination_id: UInt64.from(destinationId),
|
|
136
382
|
stratum: UInt16.from(stratum),
|
|
137
383
|
quantity: UInt32.from(quantity),
|
|
384
|
+
}
|
|
385
|
+
if (slot !== undefined) {
|
|
386
|
+
params.slot = UInt8.from(slot)
|
|
387
|
+
}
|
|
388
|
+
return this.server.action('gather', params)
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
// Packs N gather actions into one Transaction; the wallet/session fills in TAPoS at sign time.
|
|
392
|
+
bundleGather(
|
|
393
|
+
gathers: {
|
|
394
|
+
sourceId: UInt64Type
|
|
395
|
+
destinationId: UInt64Type
|
|
396
|
+
stratum: UInt16Type
|
|
397
|
+
quantity: UInt32Type
|
|
398
|
+
slot?: UInt8Type
|
|
399
|
+
}[]
|
|
400
|
+
): Transaction {
|
|
401
|
+
const actions = gathers.map(({sourceId, destinationId, stratum, quantity, slot}) =>
|
|
402
|
+
this.gather(sourceId, destinationId, stratum, quantity, slot)
|
|
403
|
+
)
|
|
404
|
+
return Transaction.from({
|
|
405
|
+
expiration: 0,
|
|
406
|
+
ref_block_num: 0,
|
|
407
|
+
ref_block_prefix: 0,
|
|
408
|
+
actions,
|
|
138
409
|
})
|
|
139
410
|
}
|
|
140
411
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
): Action {
|
|
412
|
+
// Mirrors the contract's projected_energy walk: recharge (if due) then gathers, per cycle.
|
|
413
|
+
flattenGatherPlan(
|
|
414
|
+
plan: GatherPlan,
|
|
415
|
+
ctx: {sourceId: UInt64Type; destinationId: UInt64Type; stratum: UInt16Type}
|
|
416
|
+
): Action[] {
|
|
417
|
+
const actions: Action[] = []
|
|
418
|
+
for (const cycle of plan.cycles) {
|
|
419
|
+
if (cycle.rechargeBefore) actions.push(this.recharge(ctx.sourceId))
|
|
420
|
+
for (const limpet of cycle.limpets) {
|
|
421
|
+
actions.push(
|
|
422
|
+
this.gather(
|
|
423
|
+
ctx.sourceId,
|
|
424
|
+
ctx.destinationId,
|
|
425
|
+
ctx.stratum,
|
|
426
|
+
limpet.quantity,
|
|
427
|
+
limpet.slot
|
|
428
|
+
)
|
|
429
|
+
)
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
return actions
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
warp(entityId: UInt64Type, destination: CoordinatesType): Action {
|
|
146
436
|
const x = Int64.from(destination.x)
|
|
147
437
|
const y = Int64.from(destination.y)
|
|
148
438
|
|
|
149
439
|
return this.server.action('warp', {
|
|
150
|
-
entity_type: entityType,
|
|
151
440
|
id: UInt64.from(entityId),
|
|
152
441
|
x,
|
|
153
442
|
y,
|
|
@@ -155,119 +444,341 @@ export class ActionsManager extends BaseManager {
|
|
|
155
444
|
}
|
|
156
445
|
|
|
157
446
|
craft(
|
|
158
|
-
entityType: EntityTypeName,
|
|
159
447
|
entityId: UInt64Type,
|
|
160
448
|
recipeId: number,
|
|
161
449
|
quantity: number,
|
|
162
|
-
inputs: ServerContract.ActionParams.Type.cargo_item[]
|
|
450
|
+
inputs: ServerContract.ActionParams.Type.cargo_item[],
|
|
451
|
+
target?: UInt64Type,
|
|
452
|
+
slot?: UInt8Type
|
|
163
453
|
): Action {
|
|
164
|
-
const
|
|
165
|
-
return this.server.action('craft', {
|
|
166
|
-
entity_type: entityType,
|
|
454
|
+
const params: ServerContract.ActionParams.craft = {
|
|
167
455
|
id: UInt64.from(entityId),
|
|
168
456
|
recipe_id: UInt16.from(recipeId),
|
|
169
457
|
quantity: UInt32.from(quantity),
|
|
170
|
-
inputs
|
|
171
|
-
}
|
|
458
|
+
inputs,
|
|
459
|
+
}
|
|
460
|
+
if (target !== undefined) {
|
|
461
|
+
params.target = UInt64.from(target)
|
|
462
|
+
}
|
|
463
|
+
if (slot !== undefined) {
|
|
464
|
+
params.slot = UInt8.from(slot)
|
|
465
|
+
}
|
|
466
|
+
return this.server.action('craft', params)
|
|
172
467
|
}
|
|
173
468
|
|
|
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))
|
|
469
|
+
blend(entityId: UInt64Type, inputs: ServerContract.ActionParams.Type.cargo_item[]): Action {
|
|
180
470
|
return this.server.action('blend', {
|
|
181
|
-
entity_type: entityType,
|
|
182
471
|
id: UInt64.from(entityId),
|
|
183
|
-
inputs
|
|
472
|
+
inputs,
|
|
184
473
|
})
|
|
185
474
|
}
|
|
186
475
|
|
|
187
476
|
deploy(
|
|
188
|
-
entityType: EntityTypeName,
|
|
189
477
|
entityId: UInt64Type,
|
|
190
|
-
|
|
191
|
-
|
|
478
|
+
ref: ServerContract.ActionParams.Type.cargo_ref,
|
|
479
|
+
slot?: ClusterSlotType
|
|
192
480
|
): Action {
|
|
193
481
|
return this.server.action('deploy', {
|
|
194
|
-
entity_type: entityType,
|
|
195
482
|
id: UInt64.from(entityId),
|
|
196
|
-
|
|
197
|
-
|
|
483
|
+
ref,
|
|
484
|
+
slot: slot ? {hub: UInt64.from(slot.hub), gx: slot.gx, gy: slot.gy} : undefined,
|
|
485
|
+
})
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
upgrade(
|
|
489
|
+
builderId: UInt64Type,
|
|
490
|
+
targetId: UInt64Type,
|
|
491
|
+
targetItemId: UInt16Type,
|
|
492
|
+
inputs: ServerContract.ActionParams.Type.cargo_item[],
|
|
493
|
+
slot?: UInt8Type
|
|
494
|
+
): Action {
|
|
495
|
+
const params: ServerContract.ActionParams.upgrade = {
|
|
496
|
+
builder_id: UInt64.from(builderId),
|
|
497
|
+
target_id: UInt64.from(targetId),
|
|
498
|
+
target_item_id: UInt16.from(targetItemId),
|
|
499
|
+
inputs,
|
|
500
|
+
}
|
|
501
|
+
if (slot !== undefined) {
|
|
502
|
+
params.slot = UInt8.from(slot)
|
|
503
|
+
}
|
|
504
|
+
return this.server.action('upgrade', params)
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
claimplot(entityId: UInt64Type, targetItemId: UInt16Type, slot: ClusterSlotType): Action {
|
|
508
|
+
return this.server.action('claimplot', {
|
|
509
|
+
builder_id: UInt64.from(entityId),
|
|
510
|
+
target_item_id: UInt16.from(targetItemId),
|
|
511
|
+
slot: {hub: UInt64.from(slot.hub), gx: slot.gx, gy: slot.gy},
|
|
512
|
+
})
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
movetile(
|
|
516
|
+
hubId: UInt64Type,
|
|
517
|
+
fromGx: number,
|
|
518
|
+
fromGy: number,
|
|
519
|
+
toGx: number,
|
|
520
|
+
toGy: number
|
|
521
|
+
): Action {
|
|
522
|
+
return this.server.action('movetile', {
|
|
523
|
+
hub_id: UInt64.from(hubId),
|
|
524
|
+
from_gx: fromGx,
|
|
525
|
+
from_gy: fromGy,
|
|
526
|
+
to_gx: toGx,
|
|
527
|
+
to_gy: toGy,
|
|
528
|
+
})
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
swaptile(hubId: UInt64Type, aGx: number, aGy: number, bGx: number, bGy: number): Action {
|
|
532
|
+
return this.server.action('swaptile', {
|
|
533
|
+
hub_id: UInt64.from(hubId),
|
|
534
|
+
a_gx: aGx,
|
|
535
|
+
a_gy: aGy,
|
|
536
|
+
b_gx: bGx,
|
|
537
|
+
b_gy: bGy,
|
|
538
|
+
})
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
buildplot(entityId: UInt64Type, plotId: UInt64Type): Action {
|
|
542
|
+
return this.server.action('buildplot', {
|
|
543
|
+
builder_id: UInt64.from(entityId),
|
|
544
|
+
plot_id: UInt64.from(plotId),
|
|
198
545
|
})
|
|
199
546
|
}
|
|
200
547
|
|
|
201
548
|
addmodule(
|
|
202
|
-
entityType: EntityTypeName,
|
|
203
549
|
entityId: UInt64Type,
|
|
204
550
|
moduleIndex: number,
|
|
205
|
-
|
|
206
|
-
|
|
551
|
+
moduleRef: ServerContract.ActionParams.Type.cargo_ref,
|
|
552
|
+
targetRef: ServerContract.ActionParams.Type.cargo_ref | null = null
|
|
207
553
|
): Action {
|
|
208
554
|
return this.server.action('addmodule', {
|
|
209
|
-
entity_type: entityType,
|
|
210
555
|
entity_id: UInt64.from(entityId),
|
|
211
556
|
module_index: moduleIndex,
|
|
212
|
-
|
|
213
|
-
|
|
557
|
+
module_ref: moduleRef,
|
|
558
|
+
target_ref: targetRef ?? undefined,
|
|
214
559
|
})
|
|
215
560
|
}
|
|
216
561
|
|
|
217
562
|
rmmodule(
|
|
218
|
-
entityType: EntityTypeName,
|
|
219
563
|
entityId: UInt64Type,
|
|
220
564
|
moduleIndex: number,
|
|
221
|
-
|
|
565
|
+
targetRef: ServerContract.ActionParams.Type.cargo_ref | null = null
|
|
222
566
|
): Action {
|
|
223
567
|
return this.server.action('rmmodule', {
|
|
224
|
-
entity_type: entityType,
|
|
225
568
|
entity_id: UInt64.from(entityId),
|
|
226
569
|
module_index: moduleIndex,
|
|
227
|
-
|
|
570
|
+
target_ref: targetRef ?? undefined,
|
|
228
571
|
})
|
|
229
572
|
}
|
|
230
573
|
|
|
231
|
-
|
|
232
|
-
owner: NameType,
|
|
233
|
-
entityType: EntityTypeName,
|
|
574
|
+
swapmodule(
|
|
234
575
|
entityId: UInt64Type,
|
|
235
|
-
|
|
236
|
-
|
|
576
|
+
moduleIndex: number,
|
|
577
|
+
moduleRef: ServerContract.ActionParams.Type.cargo_ref
|
|
237
578
|
): Action {
|
|
238
|
-
return this.server.action('
|
|
239
|
-
owner: Name.from(owner),
|
|
240
|
-
entity_type: entityType,
|
|
579
|
+
return this.server.action('swapmodule', {
|
|
241
580
|
entity_id: UInt64.from(entityId),
|
|
242
|
-
|
|
243
|
-
|
|
581
|
+
module_index: moduleIndex,
|
|
582
|
+
module_ref: moduleRef,
|
|
244
583
|
})
|
|
245
584
|
}
|
|
246
585
|
|
|
247
|
-
|
|
586
|
+
async wrap(
|
|
587
|
+
owner: NameType,
|
|
588
|
+
entityId: UInt64Type,
|
|
589
|
+
nexusId: UInt64Type,
|
|
590
|
+
cargoId: UInt64Type,
|
|
591
|
+
quantity: UInt64Type,
|
|
592
|
+
opts: {claimRam?: boolean} = {}
|
|
593
|
+
): Promise<Action[]> {
|
|
594
|
+
const actions: Action[] = [
|
|
595
|
+
this.platform.action('wrapcargo', {
|
|
596
|
+
game: this.server.account,
|
|
597
|
+
owner: Name.from(owner),
|
|
598
|
+
entity_id: UInt64.from(entityId),
|
|
599
|
+
nexus_id: UInt64.from(nexusId),
|
|
600
|
+
cargo_id: UInt64.from(cargoId),
|
|
601
|
+
quantity: UInt64.from(quantity),
|
|
602
|
+
}),
|
|
603
|
+
]
|
|
604
|
+
const claimRam =
|
|
605
|
+
opts.claimRam ?? (this.atomicAssetsAccount ?? 'atomicassets') !== 'atomicassets'
|
|
606
|
+
if (claimRam) {
|
|
607
|
+
actions.push(this.setLastPayer(owner, SHIPLOAD_COLLECTION))
|
|
608
|
+
}
|
|
609
|
+
return actions
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
undeploy(hostId: UInt64Type, targetId: UInt64Type): Action {
|
|
248
613
|
return this.server.action('undeploy', {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
target_type: Name.from(target.entityType),
|
|
252
|
-
target_id: UInt64.from(target.entityId),
|
|
614
|
+
host_id: UInt64.from(hostId),
|
|
615
|
+
target_id: UInt64.from(targetId),
|
|
253
616
|
})
|
|
254
617
|
}
|
|
255
618
|
|
|
256
|
-
|
|
257
|
-
return this.server.action('
|
|
258
|
-
|
|
259
|
-
entity_id: UInt64.from(entity.entityId),
|
|
619
|
+
claimStarter(owner: NameType): Action {
|
|
620
|
+
return this.server.action('claimstarter', {
|
|
621
|
+
owner: Name.from(owner),
|
|
260
622
|
})
|
|
261
623
|
}
|
|
262
624
|
|
|
263
|
-
|
|
625
|
+
async wrapEntity(
|
|
626
|
+
owner: NameType,
|
|
627
|
+
entityId: UInt64Type,
|
|
628
|
+
nexusId: UInt64Type,
|
|
629
|
+
opts: {claimRam?: boolean} = {}
|
|
630
|
+
): Promise<Action[]> {
|
|
631
|
+
const actions: Action[] = [
|
|
632
|
+
this.platform.action('wrapentity', {
|
|
633
|
+
game: this.server.account,
|
|
634
|
+
owner: Name.from(owner),
|
|
635
|
+
entity_id: UInt64.from(entityId),
|
|
636
|
+
nexus_id: UInt64.from(nexusId),
|
|
637
|
+
}),
|
|
638
|
+
]
|
|
639
|
+
const claimRam =
|
|
640
|
+
opts.claimRam ?? (this.atomicAssetsAccount ?? 'atomicassets') !== 'atomicassets'
|
|
641
|
+
if (claimRam) {
|
|
642
|
+
actions.push(this.setLastPayer(owner, SHIPLOAD_COLLECTION))
|
|
643
|
+
}
|
|
644
|
+
return actions
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
placecargo(owner: NameType, hostId: UInt64Type, assetId: UInt64Type): Action {
|
|
648
|
+
return this.server.action('placecargo', {
|
|
649
|
+
owner: Name.from(owner),
|
|
650
|
+
host_id: UInt64.from(hostId),
|
|
651
|
+
asset_id: UInt64.from(assetId),
|
|
652
|
+
})
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
placeentity(owner: NameType, assetId: UInt64Type, targetNexusId: UInt64Type): Action {
|
|
656
|
+
return this.server.action('placeentity', {
|
|
657
|
+
owner: Name.from(owner),
|
|
658
|
+
asset_id: UInt64.from(assetId),
|
|
659
|
+
target_nexus_id: UInt64.from(targetNexusId),
|
|
660
|
+
})
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
transferForUnwrap(owner: NameType, assetId: UInt64Type): Action {
|
|
664
|
+
return Action.from(
|
|
665
|
+
{
|
|
666
|
+
account: this.atomicAssetsAccount,
|
|
667
|
+
name: 'transfer',
|
|
668
|
+
authorization: [{actor: Name.from(owner), permission: 'active'}],
|
|
669
|
+
data: {
|
|
670
|
+
from: Name.from(owner),
|
|
671
|
+
to: this.platform.account,
|
|
672
|
+
asset_ids: [UInt64.from(assetId)],
|
|
673
|
+
memo: 'unwrap',
|
|
674
|
+
},
|
|
675
|
+
},
|
|
676
|
+
ATOMICASSETS_ABI
|
|
677
|
+
)
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
sendAsset(owner: NameType, recipient: NameType, assetId: UInt64Type, memo = ''): Action {
|
|
681
|
+
return Action.from(
|
|
682
|
+
{
|
|
683
|
+
account: this.atomicAssetsAccount,
|
|
684
|
+
name: 'transfer',
|
|
685
|
+
authorization: [{actor: Name.from(owner), permission: 'active'}],
|
|
686
|
+
data: {
|
|
687
|
+
from: Name.from(owner),
|
|
688
|
+
to: Name.from(recipient),
|
|
689
|
+
asset_ids: [UInt64.from(assetId)],
|
|
690
|
+
memo,
|
|
691
|
+
},
|
|
692
|
+
},
|
|
693
|
+
ATOMICASSETS_ABI
|
|
694
|
+
)
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
// Two top-level actions the wallet signs to unwrap an NFT into a host's cargo.
|
|
698
|
+
unwrapCargoTx(owner: NameType, assetId: UInt64Type, hostId: UInt64Type): Action[] {
|
|
699
|
+
return [this.transferForUnwrap(owner, assetId), this.placecargo(owner, hostId, assetId)]
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
// Two top-level actions the wallet signs to place an entity NFT at a nexus.
|
|
703
|
+
unwrapEntityTx(owner: NameType, assetId: UInt64Type, targetNexusId: UInt64Type): Action[] {
|
|
704
|
+
return [
|
|
705
|
+
this.transferForUnwrap(owner, assetId),
|
|
706
|
+
this.placeentity(owner, assetId, targetNexusId),
|
|
707
|
+
]
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
setRamPayer(newPayer: NameType, assetId: UInt64Type): Action {
|
|
711
|
+
return Action.from(
|
|
712
|
+
{
|
|
713
|
+
account: this.atomicAssetsAccount,
|
|
714
|
+
name: 'setrampayer',
|
|
715
|
+
authorization: [{actor: Name.from(newPayer), permission: 'active'}],
|
|
716
|
+
data: {new_payer: Name.from(newPayer), asset_id: UInt64.from(assetId)},
|
|
717
|
+
},
|
|
718
|
+
ATOMICASSETS_ABI
|
|
719
|
+
)
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
setLastPayer(owner: NameType, collectionName: NameType): Action {
|
|
723
|
+
return Action.from(
|
|
724
|
+
{
|
|
725
|
+
account: this.atomicAssetsAccount,
|
|
726
|
+
name: 'setlastpayer',
|
|
727
|
+
authorization: [{actor: Name.from(owner), permission: 'active'}],
|
|
728
|
+
data: {owner: Name.from(owner), collection_name: Name.from(collectionName)},
|
|
729
|
+
},
|
|
730
|
+
ATOMICASSETS_ABI
|
|
731
|
+
)
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
demolish(entityId: UInt64Type): Action {
|
|
264
735
|
return this.server.action('demolish', {
|
|
265
|
-
|
|
266
|
-
entity_id: UInt64.from(entity.entityId),
|
|
736
|
+
entity_id: UInt64.from(entityId),
|
|
267
737
|
})
|
|
268
738
|
}
|
|
269
739
|
|
|
270
740
|
joinGame(account: NameType, companyName: string): Action[] {
|
|
271
741
|
return [this.foundCompany(account, companyName), this.join(account)]
|
|
272
742
|
}
|
|
743
|
+
|
|
744
|
+
commit(oracleId: NameType, epoch: UInt64Type, commit: Checksum256Type): Action {
|
|
745
|
+
return this.server.action('commit', {
|
|
746
|
+
oracle_id: Name.from(oracleId),
|
|
747
|
+
epoch: UInt64.from(epoch),
|
|
748
|
+
commit: Checksum256.from(commit),
|
|
749
|
+
})
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
reveal(oracleId: NameType, epoch: UInt64Type, reveal: Checksum256Type): Action {
|
|
753
|
+
return this.server.action('reveal', {
|
|
754
|
+
oracle_id: Name.from(oracleId),
|
|
755
|
+
epoch: UInt64.from(epoch),
|
|
756
|
+
reveal: Checksum256.from(reveal),
|
|
757
|
+
})
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
addoracle(oracleId: NameType): Action {
|
|
761
|
+
return this.server.action('addoracle', {
|
|
762
|
+
oracle_id: Name.from(oracleId),
|
|
763
|
+
})
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
removeoracle(oracleId: NameType): Action {
|
|
767
|
+
return this.server.action('removeoracle', {
|
|
768
|
+
oracle_id: Name.from(oracleId),
|
|
769
|
+
})
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
setthreshold(threshold: UInt8Type): Action {
|
|
773
|
+
return this.server.action('setthreshold', {
|
|
774
|
+
threshold: UInt8.from(threshold),
|
|
775
|
+
})
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
cleanrsvp(epoch: UInt64Type, maxRows: UInt64Type): Action {
|
|
779
|
+
return this.server.action('cleanrsvp', {
|
|
780
|
+
epoch: UInt64.from(epoch),
|
|
781
|
+
max_rows: UInt64.from(maxRows),
|
|
782
|
+
})
|
|
783
|
+
}
|
|
273
784
|
}
|