@shipload/sdk 1.0.0-next.23 → 1.0.0-next.25
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 +46 -12
- package/lib/shipload.js +2128 -669
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +2130 -669
- package/lib/shipload.m.js.map +1 -1
- package/lib/testing.d.ts +5 -0
- package/lib/testing.js +29 -13
- package/lib/testing.js.map +1 -1
- package/lib/testing.m.js +29 -13
- package/lib/testing.m.js.map +1 -1
- package/package.json +1 -1
- package/src/contracts/server.ts +16 -1
- package/src/data/colors.ts +1 -19
- package/src/data/metadata.ts +13 -13
- package/src/index-module.ts +1 -3
- package/src/managers/actions.ts +65 -20
- package/src/managers/base.ts +4 -0
- package/src/managers/construction-types.ts +11 -1
- package/src/managers/construction.ts +51 -2
- package/src/managers/context.ts +2 -1
- package/src/managers/index.ts +1 -0
- package/src/managers/locations.ts +24 -10
- package/src/managers/plot.ts +9 -5
- package/src/nft/atomicassets.abi.json +1342 -0
- package/src/nft/atomicassets.ts +9 -3
- package/src/resolution/resolve-item.ts +2 -8
- package/src/shipload.ts +11 -1
- package/src/types.ts +1 -0
package/src/nft/atomicassets.ts
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
import {deserializeAtomicData, type SchemaField} from './atomicdata'
|
|
12
12
|
import {deserializeAsset, type NFTCargoItem, type NFTModuleSlot} from './deserializers'
|
|
13
13
|
import type {ImmutableEntry} from './buildImmutableData'
|
|
14
|
+
import atomicAssetsAbi from './atomicassets.abi.json'
|
|
14
15
|
|
|
15
16
|
const PLACEHOLDER_AUTH = PermissionLevel.from({
|
|
16
17
|
actor: '............1',
|
|
@@ -20,6 +21,8 @@ const PLACEHOLDER_AUTH = PermissionLevel.from({
|
|
|
20
21
|
export const ATOMICASSETS_ACCOUNT = 'atomicassets'
|
|
21
22
|
export const SHIPLOAD_COLLECTION = 'shipload'
|
|
22
23
|
|
|
24
|
+
export const ATOMICASSETS_ABI = ABI.from(atomicAssetsAbi as ABIDef)
|
|
25
|
+
|
|
23
26
|
const ATOMIC_ATTRIBUTE_VARIANT_NAME =
|
|
24
27
|
'variant_int8_int16_int32_int64_uint8_uint16_uint32_uint64_float32_float64_string_INT8_VEC_INT16_VEC_INT32_VEC_INT64_VEC_UINT8_VEC_UINT16_VEC_UINT32_VEC_UINT64_VEC_FLOAT_VEC_DOUBLE_VEC_STRING_VEC'
|
|
25
28
|
|
|
@@ -147,6 +150,7 @@ export interface AtomicSchemaRow {
|
|
|
147
150
|
export interface FetchAssetsOptions {
|
|
148
151
|
collection?: NameType
|
|
149
152
|
pageSize?: number
|
|
153
|
+
account?: NameType
|
|
150
154
|
}
|
|
151
155
|
|
|
152
156
|
export async function fetchAtomicAssetsForOwner(
|
|
@@ -156,11 +160,12 @@ export async function fetchAtomicAssetsForOwner(
|
|
|
156
160
|
): Promise<AtomicAssetRow[]> {
|
|
157
161
|
const collection = opts.collection ? String(Name.from(opts.collection)) : undefined
|
|
158
162
|
const pageSize = opts.pageSize ?? 1000
|
|
163
|
+
const account = Name.from(opts.account ?? ATOMICASSETS_ACCOUNT)
|
|
159
164
|
const out: AtomicAssetRow[] = []
|
|
160
165
|
let lower: UInt64 | undefined
|
|
161
166
|
while (true) {
|
|
162
167
|
const res = await client.v1.chain.get_table_rows({
|
|
163
|
-
code:
|
|
168
|
+
code: account,
|
|
164
169
|
scope: String(Name.from(owner)),
|
|
165
170
|
table: Name.from('assets'),
|
|
166
171
|
limit: pageSize,
|
|
@@ -178,13 +183,14 @@ export async function fetchAtomicAssetsForOwner(
|
|
|
178
183
|
|
|
179
184
|
export async function fetchAtomicSchemas(
|
|
180
185
|
client: APIClient,
|
|
181
|
-
collection: NameType
|
|
186
|
+
collection: NameType,
|
|
187
|
+
account: NameType = ATOMICASSETS_ACCOUNT
|
|
182
188
|
): Promise<AtomicSchemaRow[]> {
|
|
183
189
|
const out: AtomicSchemaRow[] = []
|
|
184
190
|
let lower: Name | undefined
|
|
185
191
|
while (true) {
|
|
186
192
|
const res = await client.v1.chain.get_table_rows({
|
|
187
|
-
code: Name.from(
|
|
193
|
+
code: Name.from(account),
|
|
188
194
|
scope: String(Name.from(collection)),
|
|
189
195
|
table: Name.from('schemas'),
|
|
190
196
|
limit: 100,
|
|
@@ -29,13 +29,7 @@ import {
|
|
|
29
29
|
computeContainerCapabilities,
|
|
30
30
|
computeContainerT2Capabilities,
|
|
31
31
|
} from '../derivation/capabilities'
|
|
32
|
-
import {
|
|
33
|
-
categoryColors,
|
|
34
|
-
categoryIcons,
|
|
35
|
-
componentIcon,
|
|
36
|
-
itemAbbreviations,
|
|
37
|
-
moduleIcon,
|
|
38
|
-
} from '../data/colors'
|
|
32
|
+
import {categoryColors, componentIcon, itemAbbreviations, moduleIcon} from '../data/colors'
|
|
39
33
|
import type {ServerContract} from '../contracts'
|
|
40
34
|
import {
|
|
41
35
|
ITEM_CONTAINER_T1_PACKED,
|
|
@@ -111,7 +105,7 @@ function resolveResource(id: number, stats?: UInt64Type): ResolvedItem {
|
|
|
111
105
|
return {
|
|
112
106
|
itemId: id,
|
|
113
107
|
name: item.name,
|
|
114
|
-
icon:
|
|
108
|
+
icon: '',
|
|
115
109
|
abbreviation: null,
|
|
116
110
|
category: cat,
|
|
117
111
|
tier: item.tier,
|
package/src/shipload.ts
CHANGED
|
@@ -18,6 +18,7 @@ interface ShiploadOptions {
|
|
|
18
18
|
serverContractName?: string
|
|
19
19
|
client?: APIClient
|
|
20
20
|
subscriptionsUrl?: string
|
|
21
|
+
atomicAssetsAccount?: string
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
interface ShiploadConstructorOptions extends ShiploadOptions {
|
|
@@ -40,7 +41,12 @@ export class Shipload {
|
|
|
40
41
|
? serverContract
|
|
41
42
|
: new ServerContract.Contract({client: apiClient})
|
|
42
43
|
|
|
43
|
-
this._context = new GameContext(
|
|
44
|
+
this._context = new GameContext(
|
|
45
|
+
apiClient,
|
|
46
|
+
server,
|
|
47
|
+
platform,
|
|
48
|
+
constructorOptions?.atomicAssetsAccount ?? 'atomicassets'
|
|
49
|
+
)
|
|
44
50
|
|
|
45
51
|
if (constructorOptions?.subscriptionsUrl) {
|
|
46
52
|
this._context.setSubscriptionsUrl(constructorOptions.subscriptionsUrl)
|
|
@@ -80,6 +86,10 @@ export class Shipload {
|
|
|
80
86
|
return this._context.client
|
|
81
87
|
}
|
|
82
88
|
|
|
89
|
+
get atomicAssetsAccount(): string {
|
|
90
|
+
return this._context.atomicAssetsAccount
|
|
91
|
+
}
|
|
92
|
+
|
|
83
93
|
get server(): Contract {
|
|
84
94
|
return this._context.server
|
|
85
95
|
}
|