@shipload/sdk 0.3.1 → 0.3.3

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 CHANGED
@@ -1,4 +1,4 @@
1
- import { Blob, ABI, Struct, Name, UInt64, NameType, UInt64Type, Action, Int64, UInt16, Checksum256, UInt32, TimePoint, UInt8, BlockTimestamp, Int64Type, Checksum256Type, UInt16Type, Checksum512, APIClient } from '@wharfkit/antelope';
1
+ import { Blob, ABI, Struct, Name, UInt64, Checksum256, UInt32, TimePointSec, Checksum256Type, UInt32Type, NameType, UInt64Type, Action, UInt16, Int64, TimePoint, UInt8, Int64Type, UInt16Type, Checksum512, APIClient } from '@wharfkit/antelope';
2
2
  import { Contract as Contract$2, PartialBy, ContractArgs, ActionOptions, Table } from '@wharfkit/contract';
3
3
  import { ChainDefinition } from '@wharfkit/session';
4
4
 
@@ -17,31 +17,81 @@ declare namespace Types$1 {
17
17
  class enable extends Struct {
18
18
  enabled: boolean;
19
19
  }
20
+ class enablegame extends Struct {
21
+ contract: Name;
22
+ enabled: boolean;
23
+ }
20
24
  class foundcompany extends Struct {
21
25
  account: Name;
22
26
  name: string;
23
27
  }
28
+ class game_config extends Struct {
29
+ seed: Checksum256;
30
+ epochtime: UInt32;
31
+ start: TimePointSec;
32
+ end: TimePointSec;
33
+ }
34
+ class game_meta extends Struct {
35
+ name: string;
36
+ description: string;
37
+ url: string;
38
+ version: string;
39
+ }
40
+ class game_state extends Struct {
41
+ enabled: boolean;
42
+ }
43
+ class game_row extends Struct {
44
+ contract: Name;
45
+ config: game_config;
46
+ meta: game_meta;
47
+ state: game_state;
48
+ }
49
+ class startgame extends Struct {
50
+ contract: Name;
51
+ config: game_config;
52
+ meta: game_meta;
53
+ state: game_state;
54
+ }
24
55
  class state_row extends Struct {
25
56
  enabled: boolean;
26
57
  }
27
- class test extends Struct {
28
- data: string;
58
+ class updategame extends Struct {
59
+ contract: Name;
60
+ meta: game_meta;
29
61
  }
30
62
  class wipe extends Struct {
31
63
  }
32
64
  }
33
65
  declare const TableMap$1: {
34
66
  company: typeof Types$1.company_row;
67
+ games: typeof Types$1.game_row;
35
68
  state: typeof Types$1.state_row;
36
69
  };
37
70
  interface TableTypes$1 {
38
71
  company: Types$1.company_row;
72
+ games: Types$1.game_row;
39
73
  state: Types$1.state_row;
40
74
  }
41
75
  type RowType$1<T> = T extends keyof TableTypes$1 ? TableTypes$1[T] : any;
42
76
  type TableNames$1 = keyof TableTypes$1;
43
77
  declare namespace ActionParams$1 {
44
- namespace Type { }
78
+ namespace Type {
79
+ interface game_config {
80
+ seed: Checksum256Type;
81
+ epochtime: UInt32Type;
82
+ start: TimePointSec;
83
+ end: TimePointSec;
84
+ }
85
+ interface game_meta {
86
+ name: string;
87
+ description: string;
88
+ url: string;
89
+ version: string;
90
+ }
91
+ interface game_state {
92
+ enabled: boolean;
93
+ }
94
+ }
45
95
  interface cleartable {
46
96
  table_name: NameType;
47
97
  scope?: NameType;
@@ -50,12 +100,23 @@ declare namespace ActionParams$1 {
50
100
  interface enable {
51
101
  enabled: boolean;
52
102
  }
103
+ interface enablegame {
104
+ contract: NameType;
105
+ enabled: boolean;
106
+ }
53
107
  interface foundcompany {
54
108
  account: NameType;
55
109
  name: string;
56
110
  }
57
- interface test {
58
- data: string;
111
+ interface startgame {
112
+ contract: NameType;
113
+ config: Type.game_config;
114
+ meta: Type.game_meta;
115
+ state: Type.game_state;
116
+ }
117
+ interface updategame {
118
+ contract: NameType;
119
+ meta: Type.game_meta;
59
120
  }
60
121
  interface wipe {
61
122
  }
@@ -63,8 +124,10 @@ declare namespace ActionParams$1 {
63
124
  interface ActionNameParams$1 {
64
125
  cleartable: ActionParams$1.cleartable;
65
126
  enable: ActionParams$1.enable;
127
+ enablegame: ActionParams$1.enablegame;
66
128
  foundcompany: ActionParams$1.foundcompany;
67
- test: ActionParams$1.test;
129
+ startgame: ActionParams$1.startgame;
130
+ updategame: ActionParams$1.updategame;
68
131
  wipe: ActionParams$1.wipe;
69
132
  }
70
133
  type ActionNames$1 = keyof ActionNameParams$1;
@@ -94,6 +157,8 @@ declare const abiBlob: Blob;
94
157
  declare const abi: ABI;
95
158
  declare namespace Types {
96
159
  class advance extends Struct {
160
+ reveal: string;
161
+ commit: Checksum256;
97
162
  }
98
163
  class arrive extends Struct {
99
164
  owner: Name;
@@ -108,14 +173,17 @@ declare namespace Types {
108
173
  id: UInt64;
109
174
  ship_id: UInt64;
110
175
  good_id: UInt64;
111
- quantity: UInt64;
112
- loaded: UInt64;
176
+ quantity: UInt16;
177
+ loaded: UInt16;
113
178
  }
114
179
  class cleartable extends Struct {
115
180
  table_name: Name;
116
181
  scope?: Name;
117
182
  max_rows?: UInt64;
118
183
  }
184
+ class commit extends Struct {
185
+ commit: Checksum256;
186
+ }
119
187
  class coordinates extends Struct {
120
188
  x: Int64;
121
189
  y: Int64;
@@ -123,10 +191,6 @@ declare namespace Types {
123
191
  class enable extends Struct {
124
192
  enabled: boolean;
125
193
  }
126
- class esttravel extends Struct {
127
- id: UInt64;
128
- destination: coordinates;
129
- }
130
194
  class good_price extends Struct {
131
195
  id: UInt16;
132
196
  price: UInt64;
@@ -134,15 +198,16 @@ declare namespace Types {
134
198
  class hash extends Struct {
135
199
  value: string;
136
200
  }
201
+ class hash512 extends Struct {
202
+ value: string;
203
+ }
137
204
  class init extends Struct {
138
205
  seed: Checksum256;
139
- epochseed: Checksum256;
140
206
  }
141
207
  class join extends Struct {
142
208
  account: Name;
143
209
  }
144
210
  class loader_stats extends Struct {
145
- capacity: UInt16;
146
211
  mass: UInt32;
147
212
  quantity: UInt16;
148
213
  thrust: UInt32;
@@ -159,6 +224,9 @@ declare namespace Types {
159
224
  balance: UInt64;
160
225
  debt: UInt64;
161
226
  }
227
+ class salt extends Struct {
228
+ salt: UInt64;
229
+ }
162
230
  class sellgoods extends Struct {
163
231
  ship_id: UInt64;
164
232
  good_id: UInt64;
@@ -199,9 +267,15 @@ declare namespace Types {
199
267
  class state_row extends Struct {
200
268
  enabled: boolean;
201
269
  epoch: UInt64;
202
- epochseed: Checksum256;
203
- genesis: BlockTimestamp;
270
+ salt: UInt64;
204
271
  seed: Checksum256;
272
+ commit: Checksum256;
273
+ }
274
+ class travel extends Struct {
275
+ owner: Name;
276
+ id: UInt64;
277
+ destination: coordinates;
278
+ recharge: boolean;
205
279
  }
206
280
  class travel_summary extends Struct {
207
281
  stats: ship_stats;
@@ -217,18 +291,9 @@ declare namespace Types {
217
291
  loadtime: UInt64;
218
292
  time: UInt64;
219
293
  }
220
- class summary_row extends Struct {
221
- key: Name;
222
- value: travel_summary;
223
- }
224
- class test extends Struct {
225
- data: string;
226
- }
227
- class travel extends Struct {
228
- owner: Name;
294
+ class traveltime extends Struct {
229
295
  id: UInt64;
230
296
  destination: coordinates;
231
- recharge: boolean;
232
297
  }
233
298
  class wipe extends Struct {
234
299
  }
@@ -239,7 +304,6 @@ declare const TableMap: {
239
304
  sequence: typeof Types.sequence_row;
240
305
  ship: typeof Types.ship_row;
241
306
  state: typeof Types.state_row;
242
- summary: typeof Types.summary_row;
243
307
  };
244
308
  interface TableTypes {
245
309
  cargo: Types.cargo_row;
@@ -247,7 +311,6 @@ interface TableTypes {
247
311
  sequence: Types.sequence_row;
248
312
  ship: Types.ship_row;
249
313
  state: Types.state_row;
250
- summary: Types.summary_row;
251
314
  }
252
315
  type RowType<T> = T extends keyof TableTypes ? TableTypes[T] : any;
253
316
  type TableNames = keyof TableTypes;
@@ -259,6 +322,8 @@ declare namespace ActionParams {
259
322
  }
260
323
  }
261
324
  interface advance {
325
+ reveal: string;
326
+ commit: Checksum256Type;
262
327
  }
263
328
  interface arrive {
264
329
  owner: NameType;
@@ -274,19 +339,20 @@ declare namespace ActionParams {
274
339
  scope?: NameType;
275
340
  max_rows?: UInt64Type;
276
341
  }
342
+ interface commit {
343
+ commit: Checksum256Type;
344
+ }
277
345
  interface enable {
278
346
  enabled: boolean;
279
347
  }
280
- interface esttravel {
281
- id: UInt64Type;
282
- destination: Type.coordinates;
283
- }
284
348
  interface hash {
285
349
  value: string;
286
350
  }
351
+ interface hash512 {
352
+ value: string;
353
+ }
287
354
  interface init {
288
355
  seed: Checksum256Type;
289
- epochseed: Checksum256Type;
290
356
  }
291
357
  interface join {
292
358
  account: NameType;
@@ -298,20 +364,24 @@ declare namespace ActionParams {
298
364
  interface marketprices {
299
365
  location: Type.coordinates;
300
366
  }
367
+ interface salt {
368
+ salt: UInt64Type;
369
+ }
301
370
  interface sellgoods {
302
371
  ship_id: UInt64Type;
303
372
  good_id: UInt64Type;
304
373
  quantity: UInt64Type;
305
374
  }
306
- interface test {
307
- data: string;
308
- }
309
375
  interface travel {
310
376
  owner: NameType;
311
377
  id: UInt64Type;
312
378
  destination: Type.coordinates;
313
379
  recharge: boolean;
314
380
  }
381
+ interface traveltime {
382
+ id: UInt64Type;
383
+ destination: Type.coordinates;
384
+ }
315
385
  interface wipe {
316
386
  }
317
387
  }
@@ -320,24 +390,27 @@ interface ActionNameParams {
320
390
  arrive: ActionParams.arrive;
321
391
  buygoods: ActionParams.buygoods;
322
392
  cleartable: ActionParams.cleartable;
393
+ commit: ActionParams.commit;
323
394
  enable: ActionParams.enable;
324
- esttravel: ActionParams.esttravel;
325
395
  hash: ActionParams.hash;
396
+ hash512: ActionParams.hash512;
326
397
  init: ActionParams.init;
327
398
  join: ActionParams.join;
328
399
  marketprice: ActionParams.marketprice;
329
400
  marketprices: ActionParams.marketprices;
401
+ salt: ActionParams.salt;
330
402
  sellgoods: ActionParams.sellgoods;
331
- test: ActionParams.test;
332
403
  travel: ActionParams.travel;
404
+ traveltime: ActionParams.traveltime;
333
405
  wipe: ActionParams.wipe;
334
406
  }
335
407
  type ActionNames = keyof ActionNameParams;
336
408
  interface ActionReturnValues {
337
- esttravel: Types.travel_summary;
338
- hash: Checksum512;
409
+ hash: Checksum256;
410
+ hash512: Checksum512;
339
411
  marketprice: Types.good_price;
340
412
  marketprices: Types.good_price[];
413
+ traveltime: Types.travel_summary;
341
414
  }
342
415
  type ActionReturnNames = keyof ActionReturnValues;
343
416
  declare class Contract extends Contract$2 {
@@ -379,8 +452,10 @@ declare namespace server {
379
452
  };
380
453
  }
381
454
 
455
+ declare function getCurrentEpoch(game: Types$1.game_row): Promise<number>;
456
+
382
457
  declare function hash(seed: Checksum256Type, string: string): Checksum512;
383
- declare function hashBytes(seed: Checksum256Type, string: string): Uint8Array;
458
+ declare function hash512(seed: Checksum256Type, string: string): Checksum512;
384
459
 
385
460
  interface Coordinates {
386
461
  x: number;
@@ -436,20 +511,24 @@ declare const INSUFFICIENT_GOOD_QUANTITY = "Insufficient good quantity";
436
511
  declare const REQUIRES_MORE_THAN_ONE = "Requires more than one";
437
512
 
438
513
  interface ShiploadOptions {
439
- contractName?: string;
514
+ platformContractName?: string;
515
+ serverContractName?: string;
440
516
  client?: APIClient;
441
517
  }
442
518
  interface ShiploadConstructorOptions extends ShiploadOptions {
519
+ platformContract: Contract$2;
443
520
  serverContract: Contract$2;
444
521
  }
445
522
  declare class Shipload {
446
- private client;
447
- private server;
448
- constructor(chain: ChainDefinition, { client, serverContract }: ShiploadConstructorOptions);
523
+ client: APIClient;
524
+ server: Contract$2;
525
+ platform: Contract$2;
526
+ constructor(chain: ChainDefinition, { client, platformContract, serverContract }: ShiploadConstructorOptions);
449
527
  static load(chain: ChainDefinition, shiploadOptions: ShiploadOptions): Promise<Shipload>;
528
+ getGame(): Promise<Types$1.game_row>;
450
529
  getState(): Promise<Types.state_row>;
451
530
  marketprice(location: Coordinates, good_id: number): Promise<UInt64>;
452
531
  marketprices(location: Coordinates): Promise<GoodPrice[]>;
453
532
  }
454
533
 
455
- export { CameraPosition, Coordinates, Dimensions, Distance, ERROR_SYSTEM_NOT_INITIALIZED, GOOD_DOES_NOT_EXIST, GOOD_NOT_AVAILABLE_AT_LOCATION, Good, GoodPrice, INSUFFICIENT_BALANCE, INSUFFICIENT_GOOD_QUANTITY, PLAYER_NOT_FOUND, platform as PlatformContract, REQUIRES_MORE_THAN_ONE, SHIP_CANNOT_BUY_TRAVELING, SHIP_NOT_FOUND, server as ServerContract, Shipload as default, distanceBetweenCoordinates, distanceBetweenPoints, distanceTraveled, findNearbyPlanets, getGood, goods, hasPlanet, hash, hashBytes, lerp, marketprice, marketprices, priceFromRoll, rotation };
534
+ export { CameraPosition, Coordinates, Dimensions, Distance, ERROR_SYSTEM_NOT_INITIALIZED, GOOD_DOES_NOT_EXIST, GOOD_NOT_AVAILABLE_AT_LOCATION, Good, GoodPrice, INSUFFICIENT_BALANCE, INSUFFICIENT_GOOD_QUANTITY, PLAYER_NOT_FOUND, platform as PlatformContract, REQUIRES_MORE_THAN_ONE, SHIP_CANNOT_BUY_TRAVELING, SHIP_NOT_FOUND, server as ServerContract, Shipload as default, distanceBetweenCoordinates, distanceBetweenPoints, distanceTraveled, findNearbyPlanets, getCurrentEpoch, getGood, goods, hasPlanet, hash, hash512, lerp, marketprice, marketprices, priceFromRoll, rotation };