@shipload/sdk 0.0.1 → 0.1.0
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 +331 -1
- package/lib/shipload.js +489 -1
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +484 -1
- package/lib/shipload.m.js.map +1 -1
- package/package.json +54 -14
- package/src/contracts/platform.ts +106 -0
- package/src/contracts/server.ts +323 -0
- package/src/hash.ts +6 -0
- package/src/index-bundle.ts +7 -0
- package/src/index-module.ts +4 -0
- package/src/index.ts +6 -1
- package/src/locations.ts +0 -0
- package/src/ship.ts +1 -0
- package/src/shipload.ts +1 -0
- package/.editorconfig +0 -12
- package/.eslintrc +0 -28
- package/.prettierrc +0 -8
- package/Makefile +0 -74
- package/rollup.config.js +0 -36
- package/tsconfig.json +0 -17
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type {Action, NameType, UInt64Type} from '@wharfkit/antelope'
|
|
2
|
+
import {ABI, Blob, Name, Struct, UInt64} from '@wharfkit/antelope'
|
|
3
|
+
import type {ActionOptions, ContractArgs, PartialBy, Table} from '@wharfkit/contract'
|
|
4
|
+
import {Contract as BaseContract} from '@wharfkit/contract'
|
|
5
|
+
export const abiBlob = Blob.from(
|
|
6
|
+
'DmVvc2lvOjphYmkvMS4yAAcKY2xlYXJ0YWJsZQADCnRhYmxlX25hbWUEbmFtZQVzY29wZQVuYW1lPwhtYXhfcm93cwd1aW50NjQ/C2NvbXBhbnlfcm93AAIHYWNjb3VudARuYW1lBG5hbWUGc3RyaW5nBmVuYWJsZQABB2VuYWJsZWQEYm9vbAxmb3VuZGNvbXBhbnkAAgdhY2NvdW50BG5hbWUEbmFtZQZzdHJpbmcJc3RhdGVfcm93AAEHZW5hYmxlZARib29sBHRlc3QAAQRkYXRhBnN0cmluZwR3aXBlAAAFAICKx+RrVEQKY2xlYXJ0YWJsZQAAAAAAqHjMVAZlbmFibGXzAS0tLQoKc3BlY192ZXJzaW9uOiAiMC4yLjAiCnRpdGxlOiBlbmFibGUKc3VtbWFyeTogJ0VuYWJsZS9kaXNhYmxlIHBsYXRmb3JtJwppY29uOiBodHRwczovL2F2YXRhcnMuZ2l0aHVidXNlcmNvbnRlbnQuY29tL3UvMTU4MTEzNzgyI2QzYmYyOTBmZGRlZGRiYjdkMzJhYTg5N2U5ZjdlOWUxM2EyYWU0NDk1NjE0MmUyM2ViNDdiNzcwOTZhMmVhOGQKCi0tLQoKRW5hYmxlIG9yIGRpc2FibGUgdGhlIHBsYXRmb3JtIGNvbnRyYWN0LuCnqZKiNDVdDGZvdW5kY29tcGFueYMCLS0tCgpzcGVjX3ZlcnNpb246ICIwLjIuMCIKdGl0bGU6IGZvdW5kY29tcGFueQpzdW1tYXJ5OiAnRm91bmQgYSBuZXcgY29tcGFueScKaWNvbjogaHR0cHM6Ly9hdmF0YXJzLmdpdGh1YnVzZXJjb250ZW50LmNvbS91LzE1ODExMzc4MiNkM2JmMjkwZmRkZWRkYmI3ZDMyYWE4OTdlOWY3ZTllMTNhMmFlNDQ5NTYxNDJlMjNlYjQ3Yjc3MDk2YTJlYThkCgotLS0KCkZvdW5kIGEgbmV3IGNvbXBhbnkgaW4gdGhlIFNoaXBsb2FkIHBsYXRmb3JtIGNvbnRyYWN0LgAAAAAAkLHKBHRlc3QAAAAAAACgquMEd2lwZQACAAAAwE9TJUUDaTY0AAALY29tcGFueV9yb3cAAAAAAJVNxgNpNjQAAAlzdGF0ZV9yb3cBE1NoaXBsb2FkIChQbGF0Zm9ybSkTU2hpcGxvYWQgKFBsYXRmb3JtKQAAAAA='
|
|
7
|
+
)
|
|
8
|
+
export const abi = ABI.from(abiBlob)
|
|
9
|
+
export namespace Types {
|
|
10
|
+
@Struct.type('cleartable')
|
|
11
|
+
export class cleartable extends Struct {
|
|
12
|
+
@Struct.field(Name)
|
|
13
|
+
table_name!: Name
|
|
14
|
+
@Struct.field(Name, {optional: true})
|
|
15
|
+
scope?: Name
|
|
16
|
+
@Struct.field(UInt64, {optional: true})
|
|
17
|
+
max_rows?: UInt64
|
|
18
|
+
}
|
|
19
|
+
@Struct.type('company_row')
|
|
20
|
+
export class company_row extends Struct {
|
|
21
|
+
@Struct.field(Name)
|
|
22
|
+
account!: Name
|
|
23
|
+
@Struct.field('string')
|
|
24
|
+
name!: string
|
|
25
|
+
}
|
|
26
|
+
@Struct.type('enable')
|
|
27
|
+
export class enable extends Struct {
|
|
28
|
+
@Struct.field('bool')
|
|
29
|
+
enabled!: boolean
|
|
30
|
+
}
|
|
31
|
+
@Struct.type('foundcompany')
|
|
32
|
+
export class foundcompany extends Struct {
|
|
33
|
+
@Struct.field(Name)
|
|
34
|
+
account!: Name
|
|
35
|
+
@Struct.field('string')
|
|
36
|
+
name!: string
|
|
37
|
+
}
|
|
38
|
+
@Struct.type('state_row')
|
|
39
|
+
export class state_row extends Struct {
|
|
40
|
+
@Struct.field('bool')
|
|
41
|
+
enabled!: boolean
|
|
42
|
+
}
|
|
43
|
+
@Struct.type('test')
|
|
44
|
+
export class test extends Struct {
|
|
45
|
+
@Struct.field('string')
|
|
46
|
+
data!: string
|
|
47
|
+
}
|
|
48
|
+
@Struct.type('wipe')
|
|
49
|
+
export class wipe extends Struct {}
|
|
50
|
+
}
|
|
51
|
+
export const TableMap = {
|
|
52
|
+
company: Types.company_row,
|
|
53
|
+
state: Types.state_row,
|
|
54
|
+
}
|
|
55
|
+
export interface TableTypes {
|
|
56
|
+
company: Types.company_row
|
|
57
|
+
state: Types.state_row
|
|
58
|
+
}
|
|
59
|
+
export type RowType<T> = T extends keyof TableTypes ? TableTypes[T] : any
|
|
60
|
+
export type TableNames = keyof TableTypes
|
|
61
|
+
export namespace ActionParams {
|
|
62
|
+
export namespace Type {}
|
|
63
|
+
export interface cleartable {
|
|
64
|
+
table_name: NameType
|
|
65
|
+
scope?: NameType
|
|
66
|
+
max_rows?: UInt64Type
|
|
67
|
+
}
|
|
68
|
+
export interface enable {
|
|
69
|
+
enabled: boolean
|
|
70
|
+
}
|
|
71
|
+
export interface foundcompany {
|
|
72
|
+
account: NameType
|
|
73
|
+
name: string
|
|
74
|
+
}
|
|
75
|
+
export interface test {
|
|
76
|
+
data: string
|
|
77
|
+
}
|
|
78
|
+
export interface wipe {}
|
|
79
|
+
}
|
|
80
|
+
export interface ActionNameParams {
|
|
81
|
+
cleartable: ActionParams.cleartable
|
|
82
|
+
enable: ActionParams.enable
|
|
83
|
+
foundcompany: ActionParams.foundcompany
|
|
84
|
+
test: ActionParams.test
|
|
85
|
+
wipe: ActionParams.wipe
|
|
86
|
+
}
|
|
87
|
+
export type ActionNames = keyof ActionNameParams
|
|
88
|
+
export class Contract extends BaseContract {
|
|
89
|
+
constructor(args: PartialBy<ContractArgs, 'abi' | 'account'>) {
|
|
90
|
+
super({
|
|
91
|
+
client: args.client,
|
|
92
|
+
abi: abi,
|
|
93
|
+
account: args.account || Name.from('platform.gm'),
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
action<T extends ActionNames>(
|
|
97
|
+
name: T,
|
|
98
|
+
data: ActionNameParams[T],
|
|
99
|
+
options?: ActionOptions
|
|
100
|
+
): Action {
|
|
101
|
+
return super.action(name, data, options)
|
|
102
|
+
}
|
|
103
|
+
table<T extends TableNames>(name: T, scope?: NameType): Table<RowType<T>> {
|
|
104
|
+
return super.table(name, scope, TableMap[name])
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import type {Action, Checksum256Type, Int64Type, NameType, UInt64Type} from '@wharfkit/antelope'
|
|
2
|
+
import {
|
|
3
|
+
ABI,
|
|
4
|
+
Blob,
|
|
5
|
+
BlockTimestamp,
|
|
6
|
+
Checksum256,
|
|
7
|
+
Checksum512,
|
|
8
|
+
Int64,
|
|
9
|
+
Name,
|
|
10
|
+
Struct,
|
|
11
|
+
UInt16,
|
|
12
|
+
UInt32,
|
|
13
|
+
UInt64,
|
|
14
|
+
UInt8,
|
|
15
|
+
} from '@wharfkit/antelope'
|
|
16
|
+
import type {ActionOptions, ContractArgs, PartialBy, Table} from '@wharfkit/contract'
|
|
17
|
+
import {Contract as BaseContract} from '@wharfkit/contract'
|
|
18
|
+
export const abiBlob = Blob.from(
|
|
19
|
+
'DmVvc2lvOjphYmkvMS4yABUHYWR2YW5jZQAABmFycml2ZQACBW93bmVyBG5hbWUCaWQGdWludDY0CmNsZWFydGFibGUAAwp0YWJsZV9uYW1lBG5hbWUFc2NvcGUFbmFtZT8IbWF4X3Jvd3MHdWludDY0Pwtjb29yZGluYXRlcwACAXgFaW50NjQBeQVpbnQ2NAZlbmFibGUAAQdlbmFibGVkBGJvb2wJZXN0dHJhdmVsAAICaWQGdWludDY0C2Rlc3RpbmF0aW9uC2Nvb3JkaW5hdGVzBGhhc2gAAQV2YWx1ZQZzdHJpbmcEaW5pdAACBHNlZWQLY2hlY2tzdW0yNTYJZXBvY2hzZWVkC2NoZWNrc3VtMjU2BGpvaW4AAQdhY2NvdW50BG5hbWUMbG9hZGVyX3N0YXRzAAQIY2FwYWNpdHkGdWludDE2BG1hc3MGdWludDMyCHF1YW50aXR5BnVpbnQxNgZ0aHJ1c3QGdWludDMyCnBsYXllcl9yb3cAAwVvd25lcgRuYW1lB2JhbGFuY2UGdWludDY0BGRlYnQGdWludDY0DHNlcXVlbmNlX3JvdwACA2tleQRuYW1lBXZhbHVlBnVpbnQ2NAhzaGlwX3JvdwAIAmlkBnVpbnQ2NAVvd25lcgRuYW1lBG5hbWUGc3RyaW5nCGxvY2F0aW9uC2Nvb3JkaW5hdGVzBHNraW4FdWludDgEdGllcgV1aW50OAVzdGF0cwpzaGlwX3N0YXRzB2xvYWRlcnMMbG9hZGVyX3N0YXRzCnNoaXBfc3RhdHMABwhjYXBhY2l0eQZ1aW50MzIFZHJhaW4GdWludDMyBmVuZXJneQZ1aW50MzIEbWFzcwZ1aW50NjQFb3JiaXQGdWludDE2CHJlY2hhcmdlBnVpbnQzMgZ0aHJ1c3QGdWludDY0CXN0YXR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0NzI5Mjg2MT9zPTQwMCZ1PTNiMWFmNjZlOTBkZDg1MWY0ZDdjMDk2ZWQ2YTJmYmI0YjllMTkwZGEKCi0tLQoKSW5pdGlhdGUgdHJhdmVsIG9mIGEgc2hpcCBmcm9tIGl0cyBjdXJyZW50IGxvY2F0aW9uIHRvIGEgbmV3IGRlc3RpbmF0aW9uLgAAAAAAoKrjBHdpcGWyAS0tLQoKc3BlY192ZXJzaW9uOiAiMC4yLjAiCnRpdGxlOiB3aXBlCnN1bW1hcnk6ICdERUJVRzogd2lwZSBhY3Rpb24nCmljb246IGh0dHBzOi8vYXZhdGFycy5naXRodWJ1c2VyY29udGVudC5jb20vdS8xNDcyOTI4NjE/cz00MDAmdT0zYjFhZjY2ZTkwZGQ4NTFmNGQ3YzA5NmVkNmEyZmJiNGI5ZTE5MGRhCgotLS0GAAAAAFzlTawDaTY0AAAKcGxheWVyX3JvdwAAAApNpa3CA2k2NAAADHNlcXVlbmNlX3JvdwAAAAAAUF3DA2k2NAAACHNoaXBfcm93AAAAAACVTcYDaTY0AAAJc3RhdGVfcm93AAAAwF8jpcYDaTY0AAALc3VtbWFyeV9yb3cAwDSxRrXNzQNpNjQAAA50cmF2ZWxwbGFuX3JvdwERU2hpcGxvYWQgKFNlcnZlcikRU2hpcGxvYWQgKFNlcnZlcikAAAACAACIapubM1YOdHJhdmVsX3N1bW1hcnkAAAAAANCwaQtjaGVja3N1bTUxMg=='
|
|
20
|
+
)
|
|
21
|
+
export const abi = ABI.from(abiBlob)
|
|
22
|
+
export namespace Types {
|
|
23
|
+
@Struct.type('advance')
|
|
24
|
+
export class advance extends Struct {}
|
|
25
|
+
@Struct.type('arrive')
|
|
26
|
+
export class arrive extends Struct {
|
|
27
|
+
@Struct.field(Name)
|
|
28
|
+
owner!: Name
|
|
29
|
+
@Struct.field(UInt64)
|
|
30
|
+
id!: UInt64
|
|
31
|
+
}
|
|
32
|
+
@Struct.type('cleartable')
|
|
33
|
+
export class cleartable extends Struct {
|
|
34
|
+
@Struct.field(Name)
|
|
35
|
+
table_name!: Name
|
|
36
|
+
@Struct.field(Name, {optional: true})
|
|
37
|
+
scope?: Name
|
|
38
|
+
@Struct.field(UInt64, {optional: true})
|
|
39
|
+
max_rows?: UInt64
|
|
40
|
+
}
|
|
41
|
+
@Struct.type('coordinates')
|
|
42
|
+
export class coordinates extends Struct {
|
|
43
|
+
@Struct.field(Int64)
|
|
44
|
+
x!: Int64
|
|
45
|
+
@Struct.field(Int64)
|
|
46
|
+
y!: Int64
|
|
47
|
+
}
|
|
48
|
+
@Struct.type('enable')
|
|
49
|
+
export class enable extends Struct {
|
|
50
|
+
@Struct.field('bool')
|
|
51
|
+
enabled!: boolean
|
|
52
|
+
}
|
|
53
|
+
@Struct.type('esttravel')
|
|
54
|
+
export class esttravel extends Struct {
|
|
55
|
+
@Struct.field(UInt64)
|
|
56
|
+
id!: UInt64
|
|
57
|
+
@Struct.field(coordinates)
|
|
58
|
+
destination!: coordinates
|
|
59
|
+
}
|
|
60
|
+
@Struct.type('hash')
|
|
61
|
+
export class hash extends Struct {
|
|
62
|
+
@Struct.field('string')
|
|
63
|
+
value!: string
|
|
64
|
+
}
|
|
65
|
+
@Struct.type('init')
|
|
66
|
+
export class init extends Struct {
|
|
67
|
+
@Struct.field(Checksum256)
|
|
68
|
+
seed!: Checksum256
|
|
69
|
+
@Struct.field(Checksum256)
|
|
70
|
+
epochseed!: Checksum256
|
|
71
|
+
}
|
|
72
|
+
@Struct.type('join')
|
|
73
|
+
export class join extends Struct {
|
|
74
|
+
@Struct.field(Name)
|
|
75
|
+
account!: Name
|
|
76
|
+
}
|
|
77
|
+
@Struct.type('loader_stats')
|
|
78
|
+
export class loader_stats extends Struct {
|
|
79
|
+
@Struct.field(UInt16)
|
|
80
|
+
capacity!: UInt16
|
|
81
|
+
@Struct.field(UInt32)
|
|
82
|
+
mass!: UInt32
|
|
83
|
+
@Struct.field(UInt16)
|
|
84
|
+
quantity!: UInt16
|
|
85
|
+
@Struct.field(UInt32)
|
|
86
|
+
thrust!: UInt32
|
|
87
|
+
}
|
|
88
|
+
@Struct.type('player_row')
|
|
89
|
+
export class player_row extends Struct {
|
|
90
|
+
@Struct.field(Name)
|
|
91
|
+
owner!: Name
|
|
92
|
+
@Struct.field(UInt64)
|
|
93
|
+
balance!: UInt64
|
|
94
|
+
@Struct.field(UInt64)
|
|
95
|
+
debt!: UInt64
|
|
96
|
+
}
|
|
97
|
+
@Struct.type('sequence_row')
|
|
98
|
+
export class sequence_row extends Struct {
|
|
99
|
+
@Struct.field(Name)
|
|
100
|
+
key!: Name
|
|
101
|
+
@Struct.field(UInt64)
|
|
102
|
+
value!: UInt64
|
|
103
|
+
}
|
|
104
|
+
@Struct.type('ship_stats')
|
|
105
|
+
export class ship_stats extends Struct {
|
|
106
|
+
@Struct.field(UInt32)
|
|
107
|
+
capacity!: UInt32
|
|
108
|
+
@Struct.field(UInt32)
|
|
109
|
+
drain!: UInt32
|
|
110
|
+
@Struct.field(UInt32)
|
|
111
|
+
energy!: UInt32
|
|
112
|
+
@Struct.field(UInt64)
|
|
113
|
+
mass!: UInt64
|
|
114
|
+
@Struct.field(UInt16)
|
|
115
|
+
orbit!: UInt16
|
|
116
|
+
@Struct.field(UInt32)
|
|
117
|
+
recharge!: UInt32
|
|
118
|
+
@Struct.field(UInt64)
|
|
119
|
+
thrust!: UInt64
|
|
120
|
+
}
|
|
121
|
+
@Struct.type('ship_row')
|
|
122
|
+
export class ship_row extends Struct {
|
|
123
|
+
@Struct.field(UInt64)
|
|
124
|
+
id!: UInt64
|
|
125
|
+
@Struct.field(Name)
|
|
126
|
+
owner!: Name
|
|
127
|
+
@Struct.field('string')
|
|
128
|
+
name!: string
|
|
129
|
+
@Struct.field(coordinates)
|
|
130
|
+
location!: coordinates
|
|
131
|
+
@Struct.field(UInt8)
|
|
132
|
+
skin!: UInt8
|
|
133
|
+
@Struct.field(UInt8)
|
|
134
|
+
tier!: UInt8
|
|
135
|
+
@Struct.field(ship_stats)
|
|
136
|
+
stats!: ship_stats
|
|
137
|
+
@Struct.field(loader_stats)
|
|
138
|
+
loaders!: loader_stats
|
|
139
|
+
}
|
|
140
|
+
@Struct.type('state_row')
|
|
141
|
+
export class state_row extends Struct {
|
|
142
|
+
@Struct.field('bool')
|
|
143
|
+
enabled!: boolean
|
|
144
|
+
@Struct.field(UInt64)
|
|
145
|
+
epoch!: UInt64
|
|
146
|
+
@Struct.field(Checksum256)
|
|
147
|
+
epochseed!: Checksum256
|
|
148
|
+
@Struct.field(BlockTimestamp)
|
|
149
|
+
genesis!: BlockTimestamp
|
|
150
|
+
@Struct.field(Checksum256)
|
|
151
|
+
seed!: Checksum256
|
|
152
|
+
}
|
|
153
|
+
@Struct.type('travel_summary')
|
|
154
|
+
export class travel_summary extends Struct {
|
|
155
|
+
@Struct.field(ship_stats)
|
|
156
|
+
stats!: ship_stats
|
|
157
|
+
@Struct.field(loader_stats)
|
|
158
|
+
loaders!: loader_stats
|
|
159
|
+
@Struct.field(coordinates)
|
|
160
|
+
origin!: coordinates
|
|
161
|
+
@Struct.field(coordinates)
|
|
162
|
+
destination!: coordinates
|
|
163
|
+
@Struct.field(UInt64)
|
|
164
|
+
distance!: UInt64
|
|
165
|
+
@Struct.field(UInt64)
|
|
166
|
+
totalmass!: UInt64
|
|
167
|
+
@Struct.field(UInt64)
|
|
168
|
+
acceleration!: UInt64
|
|
169
|
+
@Struct.field(UInt64)
|
|
170
|
+
flighttime!: UInt64
|
|
171
|
+
@Struct.field(UInt64)
|
|
172
|
+
energyusage!: UInt64
|
|
173
|
+
@Struct.field(UInt64)
|
|
174
|
+
rechargetime!: UInt64
|
|
175
|
+
@Struct.field(UInt64)
|
|
176
|
+
loadtime!: UInt64
|
|
177
|
+
@Struct.field(UInt64)
|
|
178
|
+
time!: UInt64
|
|
179
|
+
}
|
|
180
|
+
@Struct.type('summary_row')
|
|
181
|
+
export class summary_row extends Struct {
|
|
182
|
+
@Struct.field(Name)
|
|
183
|
+
key!: Name
|
|
184
|
+
@Struct.field(travel_summary)
|
|
185
|
+
value!: travel_summary
|
|
186
|
+
}
|
|
187
|
+
@Struct.type('test')
|
|
188
|
+
export class test extends Struct {
|
|
189
|
+
@Struct.field('string')
|
|
190
|
+
data!: string
|
|
191
|
+
}
|
|
192
|
+
@Struct.type('travel')
|
|
193
|
+
export class travel extends Struct {
|
|
194
|
+
@Struct.field(Name)
|
|
195
|
+
owner!: Name
|
|
196
|
+
@Struct.field(UInt64)
|
|
197
|
+
id!: UInt64
|
|
198
|
+
@Struct.field(coordinates)
|
|
199
|
+
destination!: coordinates
|
|
200
|
+
@Struct.field('bool')
|
|
201
|
+
recharge!: boolean
|
|
202
|
+
}
|
|
203
|
+
@Struct.type('travelplan_row')
|
|
204
|
+
export class travelplan_row extends Struct {
|
|
205
|
+
@Struct.field(UInt64)
|
|
206
|
+
id!: UInt64
|
|
207
|
+
@Struct.field(BlockTimestamp)
|
|
208
|
+
departure!: BlockTimestamp
|
|
209
|
+
@Struct.field(coordinates)
|
|
210
|
+
destination!: coordinates
|
|
211
|
+
@Struct.field(UInt32)
|
|
212
|
+
duration!: UInt32
|
|
213
|
+
}
|
|
214
|
+
@Struct.type('wipe')
|
|
215
|
+
export class wipe extends Struct {}
|
|
216
|
+
}
|
|
217
|
+
export const TableMap = {
|
|
218
|
+
player: Types.player_row,
|
|
219
|
+
sequence: Types.sequence_row,
|
|
220
|
+
ship: Types.ship_row,
|
|
221
|
+
state: Types.state_row,
|
|
222
|
+
summary: Types.summary_row,
|
|
223
|
+
travelplan: Types.travelplan_row,
|
|
224
|
+
}
|
|
225
|
+
export interface TableTypes {
|
|
226
|
+
player: Types.player_row
|
|
227
|
+
sequence: Types.sequence_row
|
|
228
|
+
ship: Types.ship_row
|
|
229
|
+
state: Types.state_row
|
|
230
|
+
summary: Types.summary_row
|
|
231
|
+
travelplan: Types.travelplan_row
|
|
232
|
+
}
|
|
233
|
+
export type RowType<T> = T extends keyof TableTypes ? TableTypes[T] : any
|
|
234
|
+
export type TableNames = keyof TableTypes
|
|
235
|
+
export namespace ActionParams {
|
|
236
|
+
export namespace Type {
|
|
237
|
+
export interface coordinates {
|
|
238
|
+
x: Int64Type
|
|
239
|
+
y: Int64Type
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
export interface advance {}
|
|
243
|
+
export interface arrive {
|
|
244
|
+
owner: NameType
|
|
245
|
+
id: UInt64Type
|
|
246
|
+
}
|
|
247
|
+
export interface cleartable {
|
|
248
|
+
table_name: NameType
|
|
249
|
+
scope?: NameType
|
|
250
|
+
max_rows?: UInt64Type
|
|
251
|
+
}
|
|
252
|
+
export interface enable {
|
|
253
|
+
enabled: boolean
|
|
254
|
+
}
|
|
255
|
+
export interface esttravel {
|
|
256
|
+
id: UInt64Type
|
|
257
|
+
destination: Type.coordinates
|
|
258
|
+
}
|
|
259
|
+
export interface hash {
|
|
260
|
+
value: string
|
|
261
|
+
}
|
|
262
|
+
export interface init {
|
|
263
|
+
seed: Checksum256Type
|
|
264
|
+
epochseed: Checksum256Type
|
|
265
|
+
}
|
|
266
|
+
export interface join {
|
|
267
|
+
account: NameType
|
|
268
|
+
}
|
|
269
|
+
export interface test {
|
|
270
|
+
data: string
|
|
271
|
+
}
|
|
272
|
+
export interface travel {
|
|
273
|
+
owner: NameType
|
|
274
|
+
id: UInt64Type
|
|
275
|
+
destination: Type.coordinates
|
|
276
|
+
recharge: boolean
|
|
277
|
+
}
|
|
278
|
+
export interface wipe {}
|
|
279
|
+
}
|
|
280
|
+
export interface ActionNameParams {
|
|
281
|
+
advance: ActionParams.advance
|
|
282
|
+
arrive: ActionParams.arrive
|
|
283
|
+
cleartable: ActionParams.cleartable
|
|
284
|
+
enable: ActionParams.enable
|
|
285
|
+
esttravel: ActionParams.esttravel
|
|
286
|
+
hash: ActionParams.hash
|
|
287
|
+
init: ActionParams.init
|
|
288
|
+
join: ActionParams.join
|
|
289
|
+
test: ActionParams.test
|
|
290
|
+
travel: ActionParams.travel
|
|
291
|
+
wipe: ActionParams.wipe
|
|
292
|
+
}
|
|
293
|
+
export type ActionNames = keyof ActionNameParams
|
|
294
|
+
export interface ActionReturnValues {
|
|
295
|
+
esttravel: Types.travel_summary
|
|
296
|
+
hash: Checksum512
|
|
297
|
+
}
|
|
298
|
+
export type ActionReturnNames = keyof ActionReturnValues
|
|
299
|
+
export class Contract extends BaseContract {
|
|
300
|
+
constructor(args: PartialBy<ContractArgs, 'abi' | 'account'>) {
|
|
301
|
+
super({
|
|
302
|
+
client: args.client,
|
|
303
|
+
abi: abi,
|
|
304
|
+
account: args.account || Name.from('shipload.gm'),
|
|
305
|
+
})
|
|
306
|
+
}
|
|
307
|
+
action<T extends ActionNames>(
|
|
308
|
+
name: T,
|
|
309
|
+
data: ActionNameParams[T],
|
|
310
|
+
options?: ActionOptions
|
|
311
|
+
): Action {
|
|
312
|
+
return super.action(name, data, options)
|
|
313
|
+
}
|
|
314
|
+
readonly<T extends ActionReturnNames>(
|
|
315
|
+
name: T,
|
|
316
|
+
data?: ActionNameParams[T]
|
|
317
|
+
): ActionReturnValues[T] {
|
|
318
|
+
return super.readonly(name, data) as unknown as ActionReturnValues[T]
|
|
319
|
+
}
|
|
320
|
+
table<T extends TableNames>(name: T, scope?: NameType): Table<RowType<T>> {
|
|
321
|
+
return super.table(name, scope, TableMap[name])
|
|
322
|
+
}
|
|
323
|
+
}
|
package/src/hash.ts
ADDED
package/src/index.ts
CHANGED
package/src/locations.ts
ADDED
|
File without changes
|
package/src/ship.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export class Ship {}
|
package/src/shipload.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export class Shipload {}
|
package/.editorconfig
DELETED
package/.eslintrc
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"root": true,
|
|
3
|
-
"ignorePatterns": ["lib/*", "tests/*", "node_modules/**"],
|
|
4
|
-
"extends": [
|
|
5
|
-
"eslint:recommended",
|
|
6
|
-
"plugin:@typescript-eslint/eslint-recommended",
|
|
7
|
-
"plugin:@typescript-eslint/recommended",
|
|
8
|
-
"plugin:prettier/recommended"
|
|
9
|
-
],
|
|
10
|
-
"rules": {
|
|
11
|
-
"prettier/prettier": "warn",
|
|
12
|
-
"no-console": "warn",
|
|
13
|
-
"sort-imports": [
|
|
14
|
-
"warn",
|
|
15
|
-
{
|
|
16
|
-
"ignoreCase": true,
|
|
17
|
-
"ignoreDeclarationSort": true
|
|
18
|
-
}
|
|
19
|
-
],
|
|
20
|
-
"@typescript-eslint/no-empty-interface": "off", // TODO: This should be removed before PR #1
|
|
21
|
-
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
22
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
23
|
-
"@typescript-eslint/no-namespace": "off",
|
|
24
|
-
"@typescript-eslint/no-non-null-assertion": "off",
|
|
25
|
-
"@typescript-eslint/no-empty-function": "warn",
|
|
26
|
-
"no-inner-declarations": "off"
|
|
27
|
-
}
|
|
28
|
-
}
|
package/.prettierrc
DELETED
package/Makefile
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
SHELL := /bin/bash
|
|
2
|
-
SRC_FILES := $(shell find src -name '*.ts')
|
|
3
|
-
TEST_FILES := $(shell find test/tests -name '*.ts')
|
|
4
|
-
BIN := ./node_modules/.bin
|
|
5
|
-
MOCHA_OPTS := -u tdd -r ts-node/register -r tsconfig-paths/register --extension ts
|
|
6
|
-
NYC_OPTS := --temp-dir build/nyc_output --report-dir build/coverage
|
|
7
|
-
|
|
8
|
-
lib: ${SRC_FILES} package.json tsconfig.json node_modules rollup.config.js
|
|
9
|
-
@${BIN}/rollup -c && touch lib
|
|
10
|
-
|
|
11
|
-
.PHONY: test
|
|
12
|
-
test: node_modules
|
|
13
|
-
@TS_NODE_PROJECT='./test/tsconfig.json' MOCK_DIR='./test/data' \
|
|
14
|
-
${BIN}/mocha ${MOCHA_OPTS} ${TEST_FILES} --no-timeout --grep '$(grep)'
|
|
15
|
-
|
|
16
|
-
test/watch: node_modules
|
|
17
|
-
@TS_NODE_PROJECT='./test/tsconfig.json' \
|
|
18
|
-
${BIN}/mocha --watch ${MOCHA_OPTS} ${TEST_FILES} --no-timeout --grep '$(grep)'
|
|
19
|
-
|
|
20
|
-
build/coverage: ${SRC_FILES} ${TEST_FILES} node_modules
|
|
21
|
-
@TS_NODE_PROJECT='./test/tsconfig.json' MOCK_DIR='./test/data' \
|
|
22
|
-
${BIN}/nyc ${NYC_OPTS} --reporter=html \
|
|
23
|
-
${BIN}/mocha ${MOCHA_OPTS} -R nyan ${TEST_FILES}
|
|
24
|
-
|
|
25
|
-
.PHONY: coverage
|
|
26
|
-
coverage: build/coverage
|
|
27
|
-
@open build/coverage/index.html
|
|
28
|
-
|
|
29
|
-
.PHONY: ci-test
|
|
30
|
-
ci-test: node_modules
|
|
31
|
-
@TS_NODE_PROJECT='./test/tsconfig.json' MOCK_DIR='./test/data' \
|
|
32
|
-
${BIN}/nyc ${NYC_OPTS} --reporter=text \
|
|
33
|
-
${BIN}/mocha ${MOCHA_OPTS} -R list ${TEST_FILES}
|
|
34
|
-
|
|
35
|
-
.PHONY: check
|
|
36
|
-
check: node_modules
|
|
37
|
-
@${BIN}/eslint src test --ext .ts --max-warnings 0 --format unix && echo "Ok"
|
|
38
|
-
|
|
39
|
-
.PHONY: format
|
|
40
|
-
format: node_modules
|
|
41
|
-
@${BIN}/eslint src --ext .ts --fix
|
|
42
|
-
|
|
43
|
-
.PHONY: docs
|
|
44
|
-
docs: build/docs
|
|
45
|
-
@open build/docs/index.html
|
|
46
|
-
|
|
47
|
-
build/docs: $(SRC_FILES) node_modules
|
|
48
|
-
@${BIN}/typedoc --out build/docs \
|
|
49
|
-
--excludeInternal --excludePrivate --excludeProtected \
|
|
50
|
-
--includeVersion --hideGenerator --readme none \
|
|
51
|
-
src/index.ts
|
|
52
|
-
|
|
53
|
-
build/pages: build/coverage build/docs
|
|
54
|
-
@mkdir -p build/pages
|
|
55
|
-
@cp -r build/docs/* build/pages/
|
|
56
|
-
@cp -r build/coverage build/pages/coverage
|
|
57
|
-
|
|
58
|
-
.PHONY: deploy-pages
|
|
59
|
-
deploy-pages: | clean lib build/pages node_modules
|
|
60
|
-
@${BIN}/gh-pages -d build/pages
|
|
61
|
-
|
|
62
|
-
build/browser.html: $(SRC_FILES) $(TEST_FILES) test/rollup.config.js node_modules
|
|
63
|
-
@${BIN}/rollup -c test/rollup.config.js
|
|
64
|
-
|
|
65
|
-
node_modules:
|
|
66
|
-
yarn install --non-interactive --frozen-lockfile --ignore-scripts
|
|
67
|
-
|
|
68
|
-
.PHONY: clean
|
|
69
|
-
clean:
|
|
70
|
-
rm -rf lib/ build/ build/browser.html
|
|
71
|
-
|
|
72
|
-
.PHONY: distclean
|
|
73
|
-
distclean: clean
|
|
74
|
-
rm -rf node_modules/
|
package/rollup.config.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import dts from 'rollup-plugin-dts'
|
|
2
|
-
import typescript from '@rollup/plugin-typescript'
|
|
3
|
-
import cleanup from 'rollup-plugin-cleanup'
|
|
4
|
-
import pkg from './package.json' assert {type: 'json'}
|
|
5
|
-
|
|
6
|
-
const external = Object.keys(pkg.dependencies)
|
|
7
|
-
|
|
8
|
-
/** @type {import('rollup').RollupOptions} */
|
|
9
|
-
export default [
|
|
10
|
-
{
|
|
11
|
-
input: 'src/index.ts',
|
|
12
|
-
output: {
|
|
13
|
-
file: pkg.main,
|
|
14
|
-
format: 'cjs',
|
|
15
|
-
sourcemap: true,
|
|
16
|
-
exports: 'named',
|
|
17
|
-
},
|
|
18
|
-
plugins: [typescript({target: 'es6'}), cleanup({extensions: ['js', 'ts']})],
|
|
19
|
-
external,
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
input: 'src/index.ts',
|
|
23
|
-
output: {
|
|
24
|
-
file: pkg.module,
|
|
25
|
-
format: 'esm',
|
|
26
|
-
sourcemap: true,
|
|
27
|
-
},
|
|
28
|
-
plugins: [typescript({target: 'es2020'}), cleanup({extensions: ['js', 'ts']})],
|
|
29
|
-
external,
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
input: 'src/index.ts',
|
|
33
|
-
output: {file: pkg.types, format: 'esm'},
|
|
34
|
-
plugins: [dts(), cleanup({extensions: ['d.ts']})],
|
|
35
|
-
},
|
|
36
|
-
]
|
package/tsconfig.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"downlevelIteration": true,
|
|
4
|
-
"esModuleInterop": true,
|
|
5
|
-
"experimentalDecorators": true,
|
|
6
|
-
"importHelpers": true,
|
|
7
|
-
"isolatedModules": true,
|
|
8
|
-
"lib": ["dom", "es2020"],
|
|
9
|
-
"module": "es2020",
|
|
10
|
-
"moduleResolution": "node",
|
|
11
|
-
"noImplicitAny": false,
|
|
12
|
-
"sourceMap": true,
|
|
13
|
-
"strict": true,
|
|
14
|
-
"target": "es2019"
|
|
15
|
-
},
|
|
16
|
-
"include": ["src/**/*"]
|
|
17
|
-
}
|