@shipload/sdk 1.0.0-next.7 → 1.0.0-next.71
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 +5822 -1484
- package/lib/shipload.js +20838 -5419
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +20674 -5669
- package/lib/shipload.m.js.map +1 -1
- package/lib/testing.d.ts +1691 -0
- package/lib/testing.js +7109 -0
- package/lib/testing.js.map +1 -0
- package/lib/testing.m.js +7103 -0
- package/lib/testing.m.js.map +1 -0
- package/package.json +20 -2
- package/src/capabilities/craftable.test.ts +82 -0
- package/src/capabilities/craftable.ts +82 -0
- package/src/capabilities/crafting.test.ts +80 -0
- package/src/capabilities/crafting.ts +50 -8
- package/src/capabilities/gathering.test.ts +29 -0
- package/src/capabilities/gathering.ts +38 -20
- package/src/capabilities/hauling.ts +0 -5
- package/src/capabilities/index.ts +0 -1
- package/src/capabilities/modules.ts +27 -30
- package/src/capabilities/movement.ts +1 -1
- package/src/capabilities/storage.test.ts +26 -0
- package/src/capabilities/storage.ts +22 -7
- package/src/contracts/fund.ts +306 -0
- package/src/contracts/platform.ts +312 -3
- package/src/contracts/server.ts +2793 -478
- package/src/contracts/token.ts +170 -0
- package/src/contracts.ts +2 -0
- 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 +49 -18
- package/src/data/capability-formulas.ts +26 -14
- package/src/data/catalog.test.ts +19 -0
- package/src/data/catalog.ts +13 -3
- package/src/data/charters.json +396 -0
- package/src/data/citizenry-adjectives.json +42 -0
- package/src/data/citizenry-nouns.json +50 -0
- package/src/data/colors.ts +14 -32
- package/src/data/entities.json +421 -15
- package/src/data/item-ids.ts +53 -13
- package/src/data/items.json +330 -77
- package/src/data/kind-registry.json +212 -0
- package/src/data/kind-registry.ts +192 -0
- package/src/data/metadata.ts +312 -51
- package/src/data/recipes-runtime.ts +6 -23
- package/src/data/recipes.json +2173 -173
- package/src/data/tiers.ts +9 -6
- package/src/derivation/build-methods.test.ts +71 -0
- package/src/derivation/build-methods.ts +50 -0
- package/src/derivation/capabilities.test.ts +348 -0
- package/src/derivation/capabilities.ts +707 -0
- package/src/derivation/capability-mappings.ts +60 -16
- package/src/derivation/crafting.test.ts +17 -0
- package/src/derivation/crafting.ts +57 -34
- package/src/derivation/index.ts +27 -2
- package/src/derivation/recipe-usage.test.ts +88 -0
- package/src/derivation/recipe-usage.ts +141 -0
- package/src/derivation/reserve-regen.ts +34 -0
- package/src/derivation/resources.ts +9 -1
- package/src/derivation/rollups.test.ts +55 -0
- package/src/derivation/rollups.ts +72 -0
- package/src/derivation/stars.test.ts +67 -0
- package/src/derivation/stars.ts +25 -0
- package/src/derivation/stat-scaling.ts +12 -0
- package/src/derivation/stats.ts +6 -6
- package/src/derivation/strata.ts +5 -3
- 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 +154 -0
- package/src/entities/entity.ts +102 -0
- package/src/entities/gamestate.ts +3 -28
- package/src/entities/makers.ts +144 -136
- package/src/entities/slot-multiplier.ts +43 -0
- package/src/entity/hydrate.test.ts +156 -0
- package/src/entity/hydrate.ts +86 -0
- package/src/errors.ts +21 -16
- package/src/format.ts +42 -9
- package/src/index-module.ts +425 -32
- package/src/influence/ballot.test.ts +103 -0
- package/src/influence/ballot.ts +98 -0
- package/src/influence/categories.ts +32 -0
- package/src/influence/charter-metadata.test.ts +136 -0
- package/src/influence/charter-metadata.ts +236 -0
- package/src/influence/charters.test.ts +112 -0
- package/src/influence/charters.ts +150 -0
- package/src/influence/citizenry.ts +38 -0
- package/src/influence/civic-shuttle.test.ts +202 -0
- package/src/influence/civic-shuttle.ts +142 -0
- package/src/influence/civic.test.ts +287 -0
- package/src/influence/civic.ts +269 -0
- package/src/influence/constants.ts +84 -0
- package/src/influence/decay.ts +20 -0
- package/src/influence/decomp.ts +95 -0
- package/src/influence/demand.ts +106 -0
- package/src/influence/duration.ts +101 -0
- package/src/influence/index.ts +118 -0
- package/src/influence/influence.test.ts +450 -0
- package/src/influence/quality.ts +25 -0
- package/src/influence/valuation.ts +154 -0
- package/src/managers/actions.ts +950 -93
- package/src/managers/balances.test.ts +161 -0
- package/src/managers/balances.ts +93 -0
- package/src/managers/base.ts +10 -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 +453 -0
- package/src/managers/context.ts +58 -1
- package/src/managers/coordinates.ts +14 -0
- package/src/managers/entities.ts +35 -63
- package/src/managers/epochs.ts +72 -1
- package/src/managers/index.ts +38 -1
- package/src/managers/influence.test.ts +56 -0
- package/src/managers/influence.ts +425 -0
- package/src/managers/jobs.test.ts +96 -0
- package/src/managers/jobs.ts +58 -0
- package/src/managers/locations.ts +25 -29
- package/src/managers/nft.test.ts +21 -0
- package/src/managers/nft.ts +110 -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 +388 -0
- package/src/nft/description.ts +222 -100
- package/src/nft/index.ts +3 -0
- package/src/planner/index.ts +296 -0
- package/src/planner/planner.test.ts +459 -0
- package/src/receipts.ts +22 -0
- package/src/resolution/describe-module.ts +43 -25
- package/src/resolution/display-name.ts +39 -11
- package/src/resolution/resolve-item.test.ts +48 -0
- package/src/resolution/resolve-item.ts +112 -58
- 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.test.ts +320 -0
- package/src/scheduling/availability.ts +251 -0
- package/src/scheduling/cancel.test.ts +550 -0
- package/src/scheduling/cancel.ts +254 -0
- package/src/scheduling/cluster-stock.test.ts +31 -0
- package/src/scheduling/cluster-stock.ts +15 -0
- package/src/scheduling/energy.ts +47 -0
- package/src/scheduling/epoch.ts +1 -0
- package/src/scheduling/idle-resolve.ts +45 -0
- package/src/scheduling/jobs.test.ts +448 -0
- package/src/scheduling/jobs.ts +343 -0
- package/src/scheduling/lane-core.ts +128 -0
- package/src/scheduling/lanes.test.ts +250 -0
- package/src/scheduling/lanes.ts +279 -0
- package/src/scheduling/projection.ts +265 -149
- package/src/scheduling/schedule.test.ts +163 -0
- package/src/scheduling/schedule.ts +282 -116
- package/src/scheduling/task-cargo.test.ts +110 -0
- package/src/scheduling/task-cargo.ts +62 -0
- package/src/scheduling/task-effects.test.ts +35 -0
- package/src/scheduling/task-effects.ts +34 -0
- package/src/scheduling/unwrap.test.ts +86 -0
- package/src/scheduling/unwrap.ts +190 -0
- package/src/shipload.ts +63 -4
- 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.test.ts +86 -0
- package/src/travel/reach.ts +34 -0
- package/src/travel/route-build.test.ts +63 -0
- package/src/travel/route-build.ts +60 -0
- package/src/travel/route-planner.ts +288 -0
- package/src/travel/route-simulator.ts +170 -0
- package/src/travel/travel.ts +190 -123
- package/src/types/capabilities.ts +37 -8
- package/src/types/entity.ts +3 -3
- package/src/types/index.ts +0 -1
- package/src/types.ts +81 -23
- package/src/utils/cargo.test.ts +14 -0
- package/src/utils/cargo.ts +2 -0
- package/src/utils/display-name.ts +70 -0
- package/src/utils/hash.ts +22 -2
- package/src/utils/system.ts +24 -5
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {UInt16, UInt32, UInt64, type UInt64Type} from '@wharfkit/antelope'
|
|
1
|
+
import {UInt16, UInt32, UInt64, type UInt32Type, type UInt64Type} from '@wharfkit/antelope'
|
|
2
2
|
import {ServerContract} from '../contracts'
|
|
3
3
|
import type {StorageCapability} from '../types/capabilities'
|
|
4
4
|
import {getItem} from '../data/catalog'
|
|
@@ -9,11 +9,11 @@ export interface HasCargo {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export interface HasCapacity {
|
|
12
|
-
capacity:
|
|
12
|
+
capacity: UInt32Type
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export interface HasCargomass {
|
|
16
|
-
cargomass:
|
|
16
|
+
cargomass: UInt32Type
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
interface MassInput {
|
|
@@ -75,15 +75,15 @@ export function hasSpaceForMass(
|
|
|
75
75
|
currentMass: UInt64Type,
|
|
76
76
|
additionalMass: UInt64Type
|
|
77
77
|
): boolean {
|
|
78
|
-
return UInt64.from(currentMass).adding(additionalMass).lte(capacity)
|
|
78
|
+
return UInt64.from(currentMass).adding(additionalMass).lte(UInt64.from(capacity))
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
export function isFull(entity: HasCapacity & HasCargomass): boolean {
|
|
82
|
-
return UInt64.from(entity.cargomass).gte(entity.capacity)
|
|
82
|
+
return UInt64.from(entity.cargomass).gte(UInt64.from(entity.capacity))
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
export function isFullFromMass(capacity: UInt64Type, cargoMass: UInt64Type): boolean {
|
|
86
|
-
return UInt64.from(cargoMass).gte(capacity)
|
|
86
|
+
return UInt64.from(cargoMass).gte(UInt64.from(capacity))
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
export interface CargoStack {
|
|
@@ -97,7 +97,7 @@ export function cargoItemToStack(item: ServerContract.Types.cargo_item): CargoSt
|
|
|
97
97
|
return {
|
|
98
98
|
item_id: UInt16.from(item.item_id),
|
|
99
99
|
quantity: UInt32.from(item.quantity),
|
|
100
|
-
stats: item.stats,
|
|
100
|
+
stats: UInt64.from(item.stats),
|
|
101
101
|
modules: item.modules ?? [],
|
|
102
102
|
}
|
|
103
103
|
}
|
|
@@ -157,3 +157,18 @@ export function removeFromStacks(stacks: CargoStack[], remove: CargoStack): Carg
|
|
|
157
157
|
result[idx] = {...target, quantity: remaining}
|
|
158
158
|
return result
|
|
159
159
|
}
|
|
160
|
+
|
|
161
|
+
// Tolerant subtraction mirroring the contract's subtract_cargo (projection replay): missing or oversized removal clamps to zero, never throws.
|
|
162
|
+
export function subtractFromStacks(stacks: CargoStack[], remove: CargoStack): CargoStack[] {
|
|
163
|
+
const idx = stacks.findIndex((s) => stackIdentityEqual(s, remove))
|
|
164
|
+
if (idx === -1) {
|
|
165
|
+
return stacks
|
|
166
|
+
}
|
|
167
|
+
const target = stacks[idx]
|
|
168
|
+
if (target.quantity.lte(remove.quantity)) {
|
|
169
|
+
return [...stacks.slice(0, idx), ...stacks.slice(idx + 1)]
|
|
170
|
+
}
|
|
171
|
+
const result = stacks.slice()
|
|
172
|
+
result[idx] = {...target, quantity: UInt32.from(target.quantity.subtracting(remove.quantity))}
|
|
173
|
+
return result
|
|
174
|
+
}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Action,
|
|
3
|
+
AssetType,
|
|
4
|
+
NameType,
|
|
5
|
+
UInt16Type,
|
|
6
|
+
UInt32Type,
|
|
7
|
+
UInt64Type,
|
|
8
|
+
} from '@wharfkit/antelope'
|
|
9
|
+
import {ABI, Asset, Blob, Name, Struct, UInt16, UInt32, UInt64} from '@wharfkit/antelope'
|
|
10
|
+
import type {ActionOptions, ContractArgs, PartialBy, Table} from '@wharfkit/contract'
|
|
11
|
+
import {Contract as BaseContract} from '@wharfkit/contract'
|
|
12
|
+
export const abiBlob = Blob.from(
|
|
13
|
+
'DmVvc2lvOjphYmkvMS4yABkLYWNjcnVlZF9yb3cAAg50b2tlbl9jb250cmFjdARuYW1lB2JhbGFuY2UFYXNzZXQIYWRkdG9rZW4AAg50b2tlbl9jb250cmFjdARuYW1lDHRva2VuX3N5bWJvbAZzeW1ib2wJYmVuZWZfcm93AAIHYWNjb3VudARuYW1lA2JwcwZ1aW50MTYLYmVuZWZpY2lhcnkAAgdhY2NvdW50BG5hbWUDYnBzBnVpbnQxNgVjbGFpbQABE2JlbmVmaWNpYXJ5X2FjY291bnQEbmFtZQdjb2xsZWN0AAALY29sbGVjdGZlZXMAAApjdXJzb3Jfcm93AAENbmV4dF9hc3NldF9pZAZ1aW50NjQIZGVsdG9rZW4AAQ50b2tlbl9jb250cmFjdARuYW1lB2dldGxvdHMAAgtsb3dlcl9ib3VuZAZ1aW50NjQIbWF4X2xvdHMGdWludDMyC2dldHRlbmRhYmxlAAEIbWF4X2xvdHMGdWludDMyCGxvdF9pbmZvAAYIYXNzZXRfaWQGdWludDY0BWdyYWRlBG5hbWUKYXVjdGlvbl9pZAZ1aW50NjQHaXRlbV9pZAZ1aW50MTYIcXVhbnRpdHkGdWludDMyBXN0YXRzBnVpbnQ2NAtsb3RzX3Jlc3VsdAACBGxvdHMKbG90X2luZm9bXQRuZXh0BnVpbnQ2NAhsb3RzX3JvdwADCGFzc2V0X2lkBnVpbnQ2NAVncmFkZQRuYW1lCmF1Y3Rpb25faWQGdWludDY0CXJlc2N1ZW5mdAADCWFzc2V0X2lkcwh1aW50NjRbXQJ0bwRuYW1lBG1lbW8Gc3RyaW5nCHNldGJlbmVmAAEIcmVnaXN0cnkNYmVuZWZpY2lhcnlbXQlzZXRtYXJrZXQAAgZtYXJrZXQEbmFtZRFtYWtlcl9tYXJrZXRwbGFjZQRuYW1lCHNldHRlcm1zAAMFZ3JhZGUEbmFtZQxzdGFydGluZ19iaWQFYXNzZXQIZHVyYXRpb24GdWludDMyDHNldHRpbmdzX3JvdwAEBm1hcmtldARuYW1lDnRva2VuX2NvbnRyYWN0BG5hbWUMdG9rZW5fc3ltYm9sBnN5bWJvbBFtYWtlcl9tYXJrZXRwbGFjZQRuYW1lCHNldHRva2VuAAIOdG9rZW5fY29udHJhY3QEbmFtZQx0b2tlbl9zeW1ib2wGc3ltYm9sBXN3ZWVwAAEIbWF4X2xvdHMGdWludDMyBHRlbmQAAQlhc3NldF9pZHMIdWludDY0W10JdGVybXNfcm93AAMFZ3JhZGUEbmFtZQxzdGFydGluZ19iaWQFYXNzZXQIZHVyYXRpb24GdWludDMyCXRva2VuX3JvdwACDnRva2VuX2NvbnRyYWN0BG5hbWUMdG9rZW5fc3ltYm9sBnN5bWJvbAR3aXBlAAAPAAAAU0GaUzIIYWRkdG9rZW4AAAAAAADpTEQFY2xhaW0AAAAAICMVI0UHY29sbGVjdAAAsFIrIxUjRQtjb2xsZWN0ZmVlcwAAAABTQZqjSghkZWx0b2tlbgAAAAAAZxqzYgdnZXRsb3RzAABUPCZNlbNiC2dldHRlbmRhYmxlAAAAyGsqjbC6CXJlc2N1ZW5mdAAAAABLTXWywghzZXRiZW5lZgAAAMgKXiOzwglzZXRtYXJrZXQAAAAAWF6Vs8IIc2V0dGVybXMAAAAAU0Gas8IIc2V0dG9rZW4AAAAAAICqFMcFc3dlZXAAAAAAAACQpsoEdGVuZAAAAAAAAKCq4wR3aXBlAAcAAAAgKX0RMgNpNjQAAAthY2NydWVkX3JvdwAAAADgpaY6A2k2NAAACWJlbmVmX3JvdwAAAABciq9GA2k2NAAACmN1cnNvcl9yb3cAAAAAAIAzjQNpNjQAAAhsb3RzX3JvdwAAAJhNl7PCA2k2NAAADHNldHRpbmdzX3JvdwAAAAAALK/KA2k2NAAACXRlcm1zX3JvdwAAAADgqSDNA2k2NAAACXRva2VuX3JvdwAAAAACAAAAAGcas2ILbG90c19yZXN1bHQAVDwmTZWzYgh1aW50NjRbXQ=='
|
|
14
|
+
)
|
|
15
|
+
export const abi = ABI.from(abiBlob)
|
|
16
|
+
export namespace Types {
|
|
17
|
+
@Struct.type('accrued_row')
|
|
18
|
+
export class accrued_row extends Struct {
|
|
19
|
+
@Struct.field(Name)
|
|
20
|
+
declare token_contract: Name
|
|
21
|
+
@Struct.field(Asset)
|
|
22
|
+
declare balance: Asset
|
|
23
|
+
}
|
|
24
|
+
@Struct.type('addtoken')
|
|
25
|
+
export class addtoken extends Struct {
|
|
26
|
+
@Struct.field(Name)
|
|
27
|
+
declare token_contract: Name
|
|
28
|
+
@Struct.field(Asset.Symbol)
|
|
29
|
+
declare token_symbol: Asset.Symbol
|
|
30
|
+
}
|
|
31
|
+
@Struct.type('benef_row')
|
|
32
|
+
export class benef_row extends Struct {
|
|
33
|
+
@Struct.field(Name)
|
|
34
|
+
declare account: Name
|
|
35
|
+
@Struct.field(UInt16)
|
|
36
|
+
declare bps: UInt16
|
|
37
|
+
}
|
|
38
|
+
@Struct.type('beneficiary')
|
|
39
|
+
export class beneficiary extends Struct {
|
|
40
|
+
@Struct.field(Name)
|
|
41
|
+
declare account: Name
|
|
42
|
+
@Struct.field(UInt16)
|
|
43
|
+
declare bps: UInt16
|
|
44
|
+
}
|
|
45
|
+
@Struct.type('claim')
|
|
46
|
+
export class claim extends Struct {
|
|
47
|
+
@Struct.field(Name)
|
|
48
|
+
declare beneficiary_account: Name
|
|
49
|
+
}
|
|
50
|
+
@Struct.type('collect')
|
|
51
|
+
export class collect extends Struct {}
|
|
52
|
+
@Struct.type('collectfees')
|
|
53
|
+
export class collectfees extends Struct {}
|
|
54
|
+
@Struct.type('cursor_row')
|
|
55
|
+
export class cursor_row extends Struct {
|
|
56
|
+
@Struct.field(UInt64)
|
|
57
|
+
declare next_asset_id: UInt64
|
|
58
|
+
}
|
|
59
|
+
@Struct.type('deltoken')
|
|
60
|
+
export class deltoken extends Struct {
|
|
61
|
+
@Struct.field(Name)
|
|
62
|
+
declare token_contract: Name
|
|
63
|
+
}
|
|
64
|
+
@Struct.type('getlots')
|
|
65
|
+
export class getlots extends Struct {
|
|
66
|
+
@Struct.field(UInt64)
|
|
67
|
+
declare lower_bound: UInt64
|
|
68
|
+
@Struct.field(UInt32)
|
|
69
|
+
declare max_lots: UInt32
|
|
70
|
+
}
|
|
71
|
+
@Struct.type('gettendable')
|
|
72
|
+
export class gettendable extends Struct {
|
|
73
|
+
@Struct.field(UInt32)
|
|
74
|
+
declare max_lots: UInt32
|
|
75
|
+
}
|
|
76
|
+
@Struct.type('lot_info')
|
|
77
|
+
export class lot_info extends Struct {
|
|
78
|
+
@Struct.field(UInt64)
|
|
79
|
+
declare asset_id: UInt64
|
|
80
|
+
@Struct.field(Name)
|
|
81
|
+
declare grade: Name
|
|
82
|
+
@Struct.field(UInt64)
|
|
83
|
+
declare auction_id: UInt64
|
|
84
|
+
@Struct.field(UInt16)
|
|
85
|
+
declare item_id: UInt16
|
|
86
|
+
@Struct.field(UInt32)
|
|
87
|
+
declare quantity: UInt32
|
|
88
|
+
@Struct.field(UInt64)
|
|
89
|
+
declare stats: UInt64
|
|
90
|
+
}
|
|
91
|
+
@Struct.type('lots_result')
|
|
92
|
+
export class lots_result extends Struct {
|
|
93
|
+
@Struct.field(lot_info, {array: true})
|
|
94
|
+
declare lots: lot_info[]
|
|
95
|
+
@Struct.field(UInt64)
|
|
96
|
+
declare next: UInt64
|
|
97
|
+
}
|
|
98
|
+
@Struct.type('lots_row')
|
|
99
|
+
export class lots_row extends Struct {
|
|
100
|
+
@Struct.field(UInt64)
|
|
101
|
+
declare asset_id: UInt64
|
|
102
|
+
@Struct.field(Name)
|
|
103
|
+
declare grade: Name
|
|
104
|
+
@Struct.field(UInt64)
|
|
105
|
+
declare auction_id: UInt64
|
|
106
|
+
}
|
|
107
|
+
@Struct.type('rescuenft')
|
|
108
|
+
export class rescuenft extends Struct {
|
|
109
|
+
@Struct.field(UInt64, {array: true})
|
|
110
|
+
declare asset_ids: UInt64[]
|
|
111
|
+
@Struct.field(Name)
|
|
112
|
+
declare to: Name
|
|
113
|
+
@Struct.field('string')
|
|
114
|
+
declare memo: string
|
|
115
|
+
}
|
|
116
|
+
@Struct.type('setbenef')
|
|
117
|
+
export class setbenef extends Struct {
|
|
118
|
+
@Struct.field(beneficiary, {array: true})
|
|
119
|
+
declare registry: beneficiary[]
|
|
120
|
+
}
|
|
121
|
+
@Struct.type('setmarket')
|
|
122
|
+
export class setmarket extends Struct {
|
|
123
|
+
@Struct.field(Name)
|
|
124
|
+
declare market: Name
|
|
125
|
+
@Struct.field(Name)
|
|
126
|
+
declare maker_marketplace: Name
|
|
127
|
+
}
|
|
128
|
+
@Struct.type('setterms')
|
|
129
|
+
export class setterms extends Struct {
|
|
130
|
+
@Struct.field(Name)
|
|
131
|
+
declare grade: Name
|
|
132
|
+
@Struct.field(Asset)
|
|
133
|
+
declare starting_bid: Asset
|
|
134
|
+
@Struct.field(UInt32)
|
|
135
|
+
declare duration: UInt32
|
|
136
|
+
}
|
|
137
|
+
@Struct.type('settings_row')
|
|
138
|
+
export class settings_row extends Struct {
|
|
139
|
+
@Struct.field(Name)
|
|
140
|
+
declare market: Name
|
|
141
|
+
@Struct.field(Name)
|
|
142
|
+
declare token_contract: Name
|
|
143
|
+
@Struct.field(Asset.Symbol)
|
|
144
|
+
declare token_symbol: Asset.Symbol
|
|
145
|
+
@Struct.field(Name)
|
|
146
|
+
declare maker_marketplace: Name
|
|
147
|
+
}
|
|
148
|
+
@Struct.type('settoken')
|
|
149
|
+
export class settoken extends Struct {
|
|
150
|
+
@Struct.field(Name)
|
|
151
|
+
declare token_contract: Name
|
|
152
|
+
@Struct.field(Asset.Symbol)
|
|
153
|
+
declare token_symbol: Asset.Symbol
|
|
154
|
+
}
|
|
155
|
+
@Struct.type('sweep')
|
|
156
|
+
export class sweep extends Struct {
|
|
157
|
+
@Struct.field(UInt32)
|
|
158
|
+
declare max_lots: UInt32
|
|
159
|
+
}
|
|
160
|
+
@Struct.type('tend')
|
|
161
|
+
export class tend extends Struct {
|
|
162
|
+
@Struct.field(UInt64, {array: true})
|
|
163
|
+
declare asset_ids: UInt64[]
|
|
164
|
+
}
|
|
165
|
+
@Struct.type('terms_row')
|
|
166
|
+
export class terms_row extends Struct {
|
|
167
|
+
@Struct.field(Name)
|
|
168
|
+
declare grade: Name
|
|
169
|
+
@Struct.field(Asset)
|
|
170
|
+
declare starting_bid: Asset
|
|
171
|
+
@Struct.field(UInt32)
|
|
172
|
+
declare duration: UInt32
|
|
173
|
+
}
|
|
174
|
+
@Struct.type('token_row')
|
|
175
|
+
export class token_row extends Struct {
|
|
176
|
+
@Struct.field(Name)
|
|
177
|
+
declare token_contract: Name
|
|
178
|
+
@Struct.field(Asset.Symbol)
|
|
179
|
+
declare token_symbol: Asset.Symbol
|
|
180
|
+
}
|
|
181
|
+
@Struct.type('wipe')
|
|
182
|
+
export class wipe extends Struct {}
|
|
183
|
+
}
|
|
184
|
+
export const TableMap = {
|
|
185
|
+
accrued: Types.accrued_row,
|
|
186
|
+
benefs: Types.benef_row,
|
|
187
|
+
cursor: Types.cursor_row,
|
|
188
|
+
lots: Types.lots_row,
|
|
189
|
+
settings: Types.settings_row,
|
|
190
|
+
terms: Types.terms_row,
|
|
191
|
+
tokens: Types.token_row,
|
|
192
|
+
}
|
|
193
|
+
export interface TableTypes {
|
|
194
|
+
accrued: Types.accrued_row
|
|
195
|
+
benefs: Types.benef_row
|
|
196
|
+
cursor: Types.cursor_row
|
|
197
|
+
lots: Types.lots_row
|
|
198
|
+
settings: Types.settings_row
|
|
199
|
+
terms: Types.terms_row
|
|
200
|
+
tokens: Types.token_row
|
|
201
|
+
}
|
|
202
|
+
export type RowType<T> = T extends keyof TableTypes ? TableTypes[T] : any
|
|
203
|
+
export type TableNames = keyof TableTypes
|
|
204
|
+
export namespace ActionParams {
|
|
205
|
+
export namespace Type {
|
|
206
|
+
export interface beneficiary {
|
|
207
|
+
account: NameType
|
|
208
|
+
bps: UInt16Type
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
export interface addtoken {
|
|
212
|
+
token_contract: NameType
|
|
213
|
+
token_symbol: Asset.SymbolType
|
|
214
|
+
}
|
|
215
|
+
export interface claim {
|
|
216
|
+
beneficiary_account: NameType
|
|
217
|
+
}
|
|
218
|
+
export interface collect {}
|
|
219
|
+
export interface collectfees {}
|
|
220
|
+
export interface deltoken {
|
|
221
|
+
token_contract: NameType
|
|
222
|
+
}
|
|
223
|
+
export interface getlots {
|
|
224
|
+
lower_bound: UInt64Type
|
|
225
|
+
max_lots: UInt32Type
|
|
226
|
+
}
|
|
227
|
+
export interface gettendable {
|
|
228
|
+
max_lots: UInt32Type
|
|
229
|
+
}
|
|
230
|
+
export interface rescuenft {
|
|
231
|
+
asset_ids: UInt64Type[]
|
|
232
|
+
to: NameType
|
|
233
|
+
memo: string
|
|
234
|
+
}
|
|
235
|
+
export interface setbenef {
|
|
236
|
+
registry: Type.beneficiary[]
|
|
237
|
+
}
|
|
238
|
+
export interface setmarket {
|
|
239
|
+
market: NameType
|
|
240
|
+
maker_marketplace: NameType
|
|
241
|
+
}
|
|
242
|
+
export interface setterms {
|
|
243
|
+
grade: NameType
|
|
244
|
+
starting_bid: AssetType
|
|
245
|
+
duration: UInt32Type
|
|
246
|
+
}
|
|
247
|
+
export interface settoken {
|
|
248
|
+
token_contract: NameType
|
|
249
|
+
token_symbol: Asset.SymbolType
|
|
250
|
+
}
|
|
251
|
+
export interface sweep {
|
|
252
|
+
max_lots: UInt32Type
|
|
253
|
+
}
|
|
254
|
+
export interface tend {
|
|
255
|
+
asset_ids: UInt64Type[]
|
|
256
|
+
}
|
|
257
|
+
export interface wipe {}
|
|
258
|
+
}
|
|
259
|
+
export interface ActionNameParams {
|
|
260
|
+
addtoken: ActionParams.addtoken
|
|
261
|
+
claim: ActionParams.claim
|
|
262
|
+
collect: ActionParams.collect
|
|
263
|
+
collectfees: ActionParams.collectfees
|
|
264
|
+
deltoken: ActionParams.deltoken
|
|
265
|
+
getlots: ActionParams.getlots
|
|
266
|
+
gettendable: ActionParams.gettendable
|
|
267
|
+
rescuenft: ActionParams.rescuenft
|
|
268
|
+
setbenef: ActionParams.setbenef
|
|
269
|
+
setmarket: ActionParams.setmarket
|
|
270
|
+
setterms: ActionParams.setterms
|
|
271
|
+
settoken: ActionParams.settoken
|
|
272
|
+
sweep: ActionParams.sweep
|
|
273
|
+
tend: ActionParams.tend
|
|
274
|
+
wipe: ActionParams.wipe
|
|
275
|
+
}
|
|
276
|
+
export type ActionNames = keyof ActionNameParams
|
|
277
|
+
export interface ActionReturnValues {
|
|
278
|
+
getlots: Types.lots_result
|
|
279
|
+
gettendable: UInt64[]
|
|
280
|
+
}
|
|
281
|
+
export type ActionReturnNames = keyof ActionReturnValues
|
|
282
|
+
export class Contract extends BaseContract {
|
|
283
|
+
constructor(args: PartialBy<ContractArgs, 'abi' | 'account'>) {
|
|
284
|
+
super({
|
|
285
|
+
client: args.client,
|
|
286
|
+
abi: abi,
|
|
287
|
+
account: args.account || Name.from('fnd.shipload'),
|
|
288
|
+
})
|
|
289
|
+
}
|
|
290
|
+
action<T extends ActionNames>(
|
|
291
|
+
name: T,
|
|
292
|
+
data: ActionNameParams[T],
|
|
293
|
+
options?: ActionOptions
|
|
294
|
+
): Action {
|
|
295
|
+
return super.action(name, data, options)
|
|
296
|
+
}
|
|
297
|
+
readonly<T extends ActionReturnNames>(
|
|
298
|
+
name: T,
|
|
299
|
+
data?: ActionNameParams[T]
|
|
300
|
+
): ActionReturnValues[T] {
|
|
301
|
+
return super.readonly(name, data) as unknown as ActionReturnValues[T]
|
|
302
|
+
}
|
|
303
|
+
table<T extends TableNames>(name: T, scope?: NameType): Table<RowType<T>> {
|
|
304
|
+
return super.table(name, scope, TableMap[name])
|
|
305
|
+
}
|
|
306
|
+
}
|