@shipload/sdk 1.0.0-next.16 → 1.0.0-next.18

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.
Files changed (41) hide show
  1. package/lib/shipload.d.ts +111 -26
  2. package/lib/shipload.js +3443 -2896
  3. package/lib/shipload.js.map +1 -1
  4. package/lib/shipload.m.js +3416 -2884
  5. package/lib/shipload.m.js.map +1 -1
  6. package/lib/testing.d.ts +3 -2
  7. package/lib/testing.js +65 -50
  8. package/lib/testing.js.map +1 -1
  9. package/lib/testing.m.js +66 -51
  10. package/lib/testing.m.js.map +1 -1
  11. package/package.json +1 -1
  12. package/src/capabilities/gathering.ts +17 -7
  13. package/src/capabilities/modules.ts +6 -0
  14. package/src/contracts/server.ts +7 -4
  15. package/src/data/capabilities.ts +6 -1
  16. package/src/data/capability-formulas.ts +7 -1
  17. package/src/data/colors.ts +12 -12
  18. package/src/data/item-ids.ts +13 -12
  19. package/src/data/items.json +30 -23
  20. package/src/data/metadata.ts +36 -23
  21. package/src/data/recipes.json +111 -46
  22. package/src/derivation/capabilities.ts +18 -7
  23. package/src/derivation/capability-mappings.ts +2 -0
  24. package/src/derivation/index.ts +7 -2
  25. package/src/derivation/reserve-regen.ts +34 -0
  26. package/src/derivation/resources.ts +9 -1
  27. package/src/derivation/stratum.ts +15 -19
  28. package/src/derivation/tiers.ts +28 -7
  29. package/src/index-module.ts +25 -3
  30. package/src/managers/actions.ts +104 -12
  31. package/src/managers/context.ts +9 -0
  32. package/src/managers/index.ts +2 -0
  33. package/src/managers/nft.ts +28 -0
  34. package/src/nft/atomicassets.ts +124 -1
  35. package/src/nft/buildImmutableData.ts +316 -0
  36. package/src/nft/description.ts +1 -3
  37. package/src/nft/index.ts +1 -0
  38. package/src/resolution/describe-module.ts +3 -4
  39. package/src/resolution/resolve-item.ts +0 -1
  40. package/src/shipload.ts +5 -0
  41. package/src/types.ts +1 -0
@@ -1,7 +1,8 @@
1
1
  import {Bytes, Checksum256, type Checksum256Type} from '@wharfkit/antelope'
2
2
  import {hash512} from '../utils/hash'
3
3
  import {Coordinates, type CoordinatesType} from '../types'
4
- import {getEligibleResources, getResourceWeight, YIELD_THRESHOLD} from './resources'
4
+ import {getItem} from '../data/catalog'
5
+ import {getEligibleResources, getResourceWeight, yieldThresholdAt} from './resources'
5
6
  import {RESERVE_TIERS, rollTier, rollWithinTier} from './tiers'
6
7
 
7
8
  export interface StratumInfo {
@@ -33,15 +34,8 @@ export function deriveStratum(
33
34
 
34
35
  const rawReserve = ((bytes[0] << 24) | (bytes[1] << 16) | (bytes[2] << 8) | bytes[3]) >>> 0
35
36
 
36
- let reserve = 0
37
- if (rawReserve <= YIELD_THRESHOLD) {
38
- const tierRoll = ((bytes[18] << 8) | bytes[19]) >>> 0
39
- const withinRoll = ((bytes[20] << 8) | bytes[21]) >>> 0
40
- const tier = rollTier(tierRoll, stratum)
41
- reserve = rollWithinTier(withinRoll, RESERVE_TIERS[tier])
42
- }
43
-
44
- if (reserve === 0) return {itemId: 0, seed: 0n, richness: 0, reserve: 0}
37
+ if (rawReserve > yieldThresholdAt(stratum))
38
+ return {itemId: 0, seed: 0n, richness: 0, reserve: 0}
45
39
 
46
40
  const eligible = getEligibleResources(locationType, subtype, stratum)
47
41
  if (eligible.length === 0) return {itemId: 0, seed: 0n, richness: 0, reserve: 0}
@@ -66,6 +60,12 @@ export function deriveStratum(
66
60
  }
67
61
  }
68
62
 
63
+ const tierRoll = ((bytes[18] << 8) | bytes[19]) >>> 0
64
+ const withinRoll = ((bytes[20] << 8) | bytes[21]) >>> 0
65
+ const tier = rollTier(tierRoll, stratum)
66
+ const unitMass = getItem(selectedItemId).mass
67
+ const reserve = rollWithinTier(withinRoll, RESERVE_TIERS[tier], unitMass)
68
+
69
69
  const seedBigInt =
70
70
  (BigInt(bytes[8]) << 56n) |
71
71
  (BigInt(bytes[9]) << 48n) |
@@ -76,15 +76,11 @@ export function deriveStratum(
76
76
  (BigInt(bytes[14]) << 8n) |
77
77
  BigInt(bytes[15])
78
78
 
79
- const rawRichness = (bytes[16] << 8) | bytes[17]
80
- const normalized = rawRichness / 65535
81
- const baseRichness = Math.floor(normalized * normalized * 999) + 1
82
-
83
- let depthBonus = 0
84
- if (stratum > 1) {
85
- depthBonus = (50 * Math.log(stratum)) / Math.log(65535)
86
- }
87
- const richness = Math.min(Math.floor(baseRichness + depthBonus), 1000)
79
+ let byteSum = 0
80
+ for (let i = 22; i <= 33; i++) byteSum += bytes[i]
81
+ const z = (byteSum - 1530) / 256
82
+ const roll = 500 + 100 * z
83
+ const richness = Math.max(1, Math.min(999, Math.round(roll)))
88
84
 
89
85
  return {itemId: selectedItemId, seed: seedBigInt, richness, reserve}
90
86
  }
@@ -1,3 +1,5 @@
1
+ import {getItem} from '../data/catalog'
2
+
1
3
  export type ReserveTier = 'small' | 'medium' | 'large' | 'massive' | 'motherlode'
2
4
 
3
5
  export interface TierRange {
@@ -6,11 +8,11 @@ export interface TierRange {
6
8
  }
7
9
 
8
10
  export const RESERVE_TIERS: Record<ReserveTier, TierRange> = {
9
- small: {min: 15, max: 60},
10
- medium: {min: 100, max: 200},
11
- large: {min: 400, max: 700},
12
- massive: {min: 1000, max: 2500},
13
- motherlode: {min: 4000, max: 10000},
11
+ small: {min: 3_600_000, max: 14_400_000},
12
+ medium: {min: 24_000_000, max: 48_000_000},
13
+ large: {min: 96_000_000, max: 168_000_000},
14
+ massive: {min: 240_000_000, max: 600_000_000},
15
+ motherlode: {min: 960_000_000, max: 2_400_000_000},
14
16
  }
15
17
 
16
18
  const SHALLOW_THRESHOLDS = {
@@ -47,8 +49,27 @@ export function rollTier(tierRoll: number, stratum: number): ReserveTier {
47
49
  return 'motherlode'
48
50
  }
49
51
 
50
- export function rollWithinTier(withinRoll: number, range: TierRange): number {
52
+ export function rollWithinTier(
53
+ withinRoll: number,
54
+ range: TierRange,
55
+ resourceUnitMass: number
56
+ ): number {
51
57
  const u = withinRoll / 65535
52
58
  const skewed = u * u
53
- return Math.floor(range.min + skewed * (range.max - range.min))
59
+ const depositMass = range.min + skewed * (range.max - range.min)
60
+ return Math.max(1, Math.floor(depositMass / resourceUnitMass))
61
+ }
62
+
63
+ const RESERVE_TIER_ENTRIES = Object.entries(RESERVE_TIERS) as Array<[ReserveTier, TierRange]>
64
+
65
+ export function tierOfReserve(reserve: number, itemId: number): ReserveTier | null {
66
+ if (reserve <= 0) return null
67
+ const unitMass = getItem(itemId).mass
68
+ if (unitMass <= 0) return null
69
+ const impliedMassLow = reserve * unitMass
70
+ const impliedMassHigh = impliedMassLow + unitMass
71
+ for (const [tier, range] of RESERVE_TIER_ENTRIES) {
72
+ if (impliedMassHigh > range.min && impliedMassLow <= range.max) return tier
73
+ }
74
+ return null
54
75
  }
@@ -47,8 +47,9 @@ export {
47
47
  LocationsManager,
48
48
  EpochsManager,
49
49
  ActionsManager,
50
+ NftManager,
50
51
  } from './managers'
51
- export type {LocationStratum} from './managers'
52
+ export type {LocationStratum, NftConfigForItem} from './managers'
52
53
  export type {EntityRefInput} from './managers/actions'
53
54
 
54
55
  export {
@@ -96,6 +97,9 @@ export {
96
97
  DEPTH_THRESHOLD_T5,
97
98
  LOCATION_MIN_DEPTH,
98
99
  LOCATION_MAX_DEPTH,
100
+ yieldThresholdAt,
101
+ YIELD_FRACTION_SHALLOW,
102
+ YIELD_FRACTION_DEEP,
99
103
  PLANET_SUBTYPE_GAS_GIANT,
100
104
  PLANET_SUBTYPE_ROCKY,
101
105
  PLANET_SUBTYPE_TERRESTRIAL,
@@ -106,9 +110,12 @@ export {
106
110
 
107
111
  export type {StratumInfo, ResourceStats, DerivedStratum} from './derivation'
108
112
 
109
- export {RESERVE_TIERS, TIER_ROLL_MAX, rollTier, rollWithinTier} from './derivation'
113
+ export {RESERVE_TIERS, TIER_ROLL_MAX, tierOfReserve, rollTier, rollWithinTier} from './derivation'
110
114
  export type {ReserveTier, TierRange} from './derivation'
111
115
 
116
+ export {getEffectiveReserve} from './derivation'
117
+ export type {EffectiveReserveInput} from './derivation'
118
+
112
119
  export {getStatDefinitions, getStatName, resolveStats} from './derivation'
113
120
  export type {StatDefinition, NamedStats} from './derivation'
114
121
 
@@ -331,10 +338,25 @@ export type {
331
338
  export {deserializeAtomicData} from './nft/atomicdata'
332
339
  export type {SchemaField, RawData} from './nft/atomicdata'
333
340
 
341
+ export {
342
+ buildImmutableData,
343
+ buildResourceImmutable,
344
+ buildComponentImmutable,
345
+ buildModuleImmutable,
346
+ buildEntityImmutable,
347
+ computeNftImageUrl,
348
+ } from './nft/buildImmutableData'
349
+ export type {
350
+ AtomicAttributeType,
351
+ ImmutableEntry,
352
+ ImmutableModuleSlot,
353
+ } from './nft/buildImmutableData'
354
+
334
355
  export {
335
356
  fetchAtomicAssetsForOwner,
336
357
  fetchAtomicSchemas,
337
358
  decodeAtomicAsset,
359
+ buildMintAssetAction,
338
360
  ATOMICASSETS_ACCOUNT,
339
361
  SHIPLOAD_COLLECTION,
340
362
  } from './nft/atomicassets'
@@ -343,6 +365,7 @@ export type {
343
365
  AtomicSchemaRow,
344
366
  DecodedAtomicAsset,
345
367
  FetchAssetsOptions,
368
+ MintAssetParams,
346
369
  } from './nft/atomicassets'
347
370
 
348
371
  export {
@@ -360,7 +383,6 @@ export {
360
383
  computeGathererYield,
361
384
  computeGathererDrain,
362
385
  computeGathererDepth,
363
- computeGathererSpeed,
364
386
  computeLoaderMass,
365
387
  computeLoaderThrust,
366
388
  computeCrafterSpeed,
@@ -13,6 +13,12 @@ import {
13
13
  import {BaseManager} from './base'
14
14
  import type {CoordinatesType} from '../types'
15
15
  import {ServerContract} from '../contracts'
16
+ import {
17
+ buildImmutableData,
18
+ type ImmutableModuleSlot,
19
+ moduleSlotsForImmutable,
20
+ } from '../nft/buildImmutableData'
21
+ import {buildMintAssetAction, SHIPLOAD_COLLECTION} from '../nft/atomicassets'
16
22
 
17
23
  export type EntityRefInput = {
18
24
  entityType: NameType
@@ -183,20 +189,81 @@ export class ActionsManager extends BaseManager {
183
189
  })
184
190
  }
185
191
 
186
- wrap(
192
+ private async buildPairedMintAction(args: {
193
+ owner: NameType
194
+ itemId: number
195
+ quantity: number
196
+ stats: bigint
197
+ originX: number
198
+ originY: number
199
+ moduleSlots: ImmutableModuleSlot[]
200
+ }): Promise<Action> {
201
+ const nftCfg = await this.context.nft.getNftConfigForItem(args.itemId)
202
+ if (!nftCfg) {
203
+ throw new Error(`item ${args.itemId} has no nftconfig`)
204
+ }
205
+ const immutableData = buildImmutableData(
206
+ args.itemId,
207
+ args.quantity,
208
+ args.stats,
209
+ args.originX,
210
+ args.originY,
211
+ args.moduleSlots
212
+ )
213
+ return buildMintAssetAction({
214
+ authorizedMinter: Name.from(args.owner),
215
+ collectionName: SHIPLOAD_COLLECTION,
216
+ schemaName: nftCfg.schemaName,
217
+ templateId: nftCfg.templateId,
218
+ newAssetOwner: Name.from(args.owner),
219
+ immutableData,
220
+ })
221
+ }
222
+
223
+ async wrap(
187
224
  owner: NameType,
188
225
  entityId: UInt64Type,
189
226
  nexusId: UInt64Type,
190
227
  cargoId: UInt64Type,
191
228
  quantity: UInt64Type
192
- ): Action {
193
- return this.server.action('wrap', {
194
- owner: Name.from(owner),
195
- entity_id: UInt64.from(entityId),
196
- nexus_id: UInt64.from(nexusId),
197
- cargo_id: UInt64.from(cargoId),
198
- quantity: UInt64.from(quantity),
229
+ ): Promise<Action[]> {
230
+ const cargoIdKey = UInt64.from(cargoId)
231
+ const entityIdKey = UInt64.from(entityId)
232
+ const [cargoRow, entityRow] = (await Promise.all([
233
+ this.server.table('cargo').get(cargoIdKey),
234
+ this.server.table('entity').get(entityIdKey),
235
+ ])) as [
236
+ ServerContract.Types.cargo_row | undefined,
237
+ ServerContract.Types.entity_row | undefined,
238
+ ]
239
+ if (!cargoRow) {
240
+ throw new Error(`cargo row ${cargoIdKey} not found`)
241
+ }
242
+ if (!entityRow) {
243
+ throw new Error(`entity ${entityIdKey} not found`)
244
+ }
245
+
246
+ const quantityValue = UInt64.from(quantity)
247
+ const mintAction = await this.buildPairedMintAction({
248
+ owner,
249
+ itemId: Number(cargoRow.item_id.toString()),
250
+ quantity: Number(quantityValue.toString()),
251
+ stats: BigInt(cargoRow.stats.toString()),
252
+ originX: Number(entityRow.coordinates.x.toString()),
253
+ originY: Number(entityRow.coordinates.y.toString()),
254
+ moduleSlots: moduleSlotsForImmutable(cargoRow.modules),
199
255
  })
256
+
257
+ return [
258
+ this.server.action('wrap', {
259
+ owner: Name.from(owner),
260
+ entity_id: UInt64.from(entityId),
261
+ nexus_id: UInt64.from(nexusId),
262
+ cargo_id: cargoIdKey,
263
+ quantity: quantityValue,
264
+ }),
265
+ mintAction,
266
+ ]
200
267
  }
201
268
 
202
269
  undeploy(hostId: UInt64Type, targetId: UInt64Type): Action {
@@ -206,11 +273,36 @@ export class ActionsManager extends BaseManager {
206
273
  })
207
274
  }
208
275
 
209
- wrapEntity(entityId: UInt64Type, nexusId: UInt64Type): Action {
210
- return this.server.action('wrapentity', {
211
- entity_id: UInt64.from(entityId),
212
- nexus_id: UInt64.from(nexusId),
276
+ async wrapEntity(
277
+ owner: NameType,
278
+ entityId: UInt64Type,
279
+ nexusId: UInt64Type
280
+ ): Promise<Action[]> {
281
+ const entityIdKey = UInt64.from(entityId)
282
+ const entityRow = (await this.server.table('entity').get(entityIdKey)) as
283
+ | ServerContract.Types.entity_row
284
+ | undefined
285
+ if (!entityRow) {
286
+ throw new Error(`entity ${entityIdKey} not found`)
287
+ }
288
+
289
+ const mintAction = await this.buildPairedMintAction({
290
+ owner,
291
+ itemId: Number(entityRow.item_id.toString()),
292
+ quantity: 1,
293
+ stats: BigInt(entityRow.stats.toString()),
294
+ originX: Number(entityRow.coordinates.x.toString()),
295
+ originY: Number(entityRow.coordinates.y.toString()),
296
+ moduleSlots: moduleSlotsForImmutable(entityRow.modules),
213
297
  })
298
+
299
+ return [
300
+ this.server.action('wrapentity', {
301
+ entity_id: entityIdKey,
302
+ nexus_id: UInt64.from(nexusId),
303
+ }),
304
+ mintAction,
305
+ ]
214
306
  }
215
307
 
216
308
  deploynft(owner: NameType, assetId: UInt64Type, targetNexusId: UInt64Type): Action {
@@ -8,6 +8,7 @@ import {PlayersManager} from './players'
8
8
  import {LocationsManager} from './locations'
9
9
  import {EpochsManager} from './epochs'
10
10
  import {ActionsManager} from './actions'
11
+ import {NftManager} from './nft'
11
12
  import {SubscriptionsManager} from '../subscriptions/manager'
12
13
 
13
14
  export class GameContext {
@@ -16,6 +17,7 @@ export class GameContext {
16
17
  private _locations?: LocationsManager
17
18
  private _epochs?: EpochsManager
18
19
  private _actions?: ActionsManager
20
+ private _nft?: NftManager
19
21
  private _subscriptions?: SubscriptionsManager
20
22
  private _subscriptionsUrl?: string
21
23
 
@@ -63,6 +65,13 @@ export class GameContext {
63
65
  return this._actions
64
66
  }
65
67
 
68
+ get nft(): NftManager {
69
+ if (!this._nft) {
70
+ this._nft = new NftManager(this)
71
+ }
72
+ return this._nft
73
+ }
74
+
66
75
  setSubscriptionsUrl(url: string) {
67
76
  this._subscriptionsUrl = url
68
77
  }
@@ -7,3 +7,5 @@ export {LocationsManager} from './locations'
7
7
  export type {LocationStratum} from './locations'
8
8
  export {EpochsManager} from './epochs'
9
9
  export {ActionsManager} from './actions'
10
+ export {NftManager} from './nft'
11
+ export type {NftConfigForItem} from './nft'
@@ -0,0 +1,28 @@
1
+ import {UInt64, type UInt64Type} from '@wharfkit/antelope'
2
+ import {BaseManager} from './base'
3
+ import type {ServerContract} from '../contracts'
4
+
5
+ export interface NftConfigForItem {
6
+ templateId: number
7
+ schemaName: string
8
+ }
9
+
10
+ export class NftManager extends BaseManager {
11
+ private cache = new Map<string, NftConfigForItem | null>()
12
+
13
+ async getNftConfigForItem(itemId: UInt64Type): Promise<NftConfigForItem | undefined> {
14
+ const id = UInt64.from(itemId)
15
+ const key = id.toString()
16
+ if (this.cache.has(key)) {
17
+ return this.cache.get(key) ?? undefined
18
+ }
19
+ const row = (await this.server.table('nftconfig').get(id)) as
20
+ | ServerContract.Types.nftconfig_row
21
+ | undefined
22
+ const result: NftConfigForItem | null = row
23
+ ? {templateId: Number(row.template_id), schemaName: String(row.schema_name)}
24
+ : null
25
+ this.cache.set(key, result)
26
+ return result ?? undefined
27
+ }
28
+ }
@@ -1,10 +1,133 @@
1
- import {type APIClient, Name, type NameType, UInt64} from '@wharfkit/antelope'
1
+ import {
2
+ ABI,
3
+ type ABIDef,
4
+ Action,
5
+ type APIClient,
6
+ type NameType,
7
+ Name,
8
+ PermissionLevel,
9
+ UInt64,
10
+ } from '@wharfkit/antelope'
2
11
  import {deserializeAtomicData, type SchemaField} from './atomicdata'
3
12
  import {deserializeAsset, type NFTCargoItem, type NFTModuleSlot} from './deserializers'
13
+ import type {ImmutableEntry} from './buildImmutableData'
14
+
15
+ const PLACEHOLDER_AUTH = PermissionLevel.from({
16
+ actor: '............1',
17
+ permission: '............2',
18
+ })
4
19
 
5
20
  export const ATOMICASSETS_ACCOUNT = 'atomicassets'
6
21
  export const SHIPLOAD_COLLECTION = 'shipload'
7
22
 
23
+ const ATOMIC_ATTRIBUTE_VARIANT_NAME =
24
+ '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
+
26
+ const MINTASSET_ABI_DEF: ABIDef = {
27
+ version: 'eosio::abi/1.2',
28
+ types: [
29
+ {new_type_name: 'ATOMIC_ATTRIBUTE', type: ATOMIC_ATTRIBUTE_VARIANT_NAME},
30
+ {new_type_name: 'ATTRIBUTE_MAP', type: 'pair_string_ATOMIC_ATTRIBUTE[]'},
31
+ {new_type_name: 'INT8_VEC', type: 'bytes'},
32
+ {new_type_name: 'INT16_VEC', type: 'int16[]'},
33
+ {new_type_name: 'INT32_VEC', type: 'int32[]'},
34
+ {new_type_name: 'INT64_VEC', type: 'int64[]'},
35
+ {new_type_name: 'UINT8_VEC', type: 'bytes'},
36
+ {new_type_name: 'UINT16_VEC', type: 'uint16[]'},
37
+ {new_type_name: 'UINT32_VEC', type: 'uint32[]'},
38
+ {new_type_name: 'UINT64_VEC', type: 'uint64[]'},
39
+ {new_type_name: 'FLOAT_VEC', type: 'float32[]'},
40
+ {new_type_name: 'DOUBLE_VEC', type: 'float64[]'},
41
+ {new_type_name: 'STRING_VEC', type: 'string[]'},
42
+ ],
43
+ structs: [
44
+ {
45
+ name: 'pair_string_ATOMIC_ATTRIBUTE',
46
+ base: '',
47
+ fields: [
48
+ {name: 'first', type: 'string'},
49
+ {name: 'second', type: 'ATOMIC_ATTRIBUTE'},
50
+ ],
51
+ },
52
+ {
53
+ name: 'mintasset',
54
+ base: '',
55
+ fields: [
56
+ {name: 'authorized_minter', type: 'name'},
57
+ {name: 'collection_name', type: 'name'},
58
+ {name: 'schema_name', type: 'name'},
59
+ {name: 'template_id', type: 'int32'},
60
+ {name: 'new_asset_owner', type: 'name'},
61
+ {name: 'immutable_data', type: 'ATTRIBUTE_MAP'},
62
+ {name: 'mutable_data', type: 'ATTRIBUTE_MAP'},
63
+ {name: 'tokens_to_back', type: 'asset[]'},
64
+ ],
65
+ },
66
+ ],
67
+ actions: [{name: 'mintasset', type: 'mintasset', ricardian_contract: ''}],
68
+ variants: [
69
+ {
70
+ name: ATOMIC_ATTRIBUTE_VARIANT_NAME,
71
+ types: [
72
+ 'int8',
73
+ 'int16',
74
+ 'int32',
75
+ 'int64',
76
+ 'uint8',
77
+ 'uint16',
78
+ 'uint32',
79
+ 'uint64',
80
+ 'float32',
81
+ 'float64',
82
+ 'string',
83
+ 'INT8_VEC',
84
+ 'INT16_VEC',
85
+ 'INT32_VEC',
86
+ 'INT64_VEC',
87
+ 'UINT8_VEC',
88
+ 'UINT16_VEC',
89
+ 'UINT32_VEC',
90
+ 'UINT64_VEC',
91
+ 'FLOAT_VEC',
92
+ 'DOUBLE_VEC',
93
+ 'STRING_VEC',
94
+ ],
95
+ },
96
+ ],
97
+ }
98
+
99
+ export interface MintAssetParams {
100
+ authorizedMinter: NameType
101
+ collectionName: NameType
102
+ schemaName: NameType
103
+ templateId: number
104
+ newAssetOwner: NameType
105
+ immutableData: ImmutableEntry[]
106
+ }
107
+
108
+ const MINTASSET_ABI = ABI.from(MINTASSET_ABI_DEF)
109
+
110
+ export function buildMintAssetAction(params: MintAssetParams): Action {
111
+ return Action.from(
112
+ {
113
+ account: Name.from(ATOMICASSETS_ACCOUNT),
114
+ name: Name.from('mintasset'),
115
+ authorization: [PLACEHOLDER_AUTH],
116
+ data: {
117
+ authorized_minter: Name.from(params.authorizedMinter),
118
+ collection_name: Name.from(params.collectionName),
119
+ schema_name: Name.from(params.schemaName),
120
+ template_id: params.templateId,
121
+ new_asset_owner: Name.from(params.newAssetOwner),
122
+ immutable_data: params.immutableData,
123
+ mutable_data: [],
124
+ tokens_to_back: [],
125
+ },
126
+ },
127
+ MINTASSET_ABI
128
+ )
129
+ }
130
+
8
131
  export interface AtomicAssetRow {
9
132
  asset_id: string
10
133
  collection_name: string