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