Skip to content

Commit 1c8204f

Browse files
authored
Refactor to properly export types. (#9)
* Refactor to properly export types. Fix: Asset owner can be null if asset is burned. Fix: search is optional on endpoints. Fix: before and after need to be strings when POST too. Fix: Add optional images field on CollectionObject. * Fix some Market response types * Fix check * Update packages * Add missing images to CollectionObject * Fix CollectionObject
1 parent cd462d3 commit 1c8204f

122 files changed

Lines changed: 38837 additions & 32052 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.idea/
2+
.vscode/
13
node_modules/
24
lib/
35
coverage/

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# @wharfkit/atomicassets
22

3-
AtomicAsset library for Wharf
3+
AtomicAssets library for Wharf
4+
5+
## Installing
6+
7+
```
8+
yarn add @wharfkit/atomicassets
9+
```
410

511
## Running Tests
612

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@wharfkit/atomicassets",
33
"description": "AtomicAsset library for Wharf",
4-
"version": "1.2.2",
4+
"version": "1.2.3",
55
"homepage": "https://github.com/wharfkit/atomicassets",
66
"main": "lib/atomicassets.js",
77
"module": "lib/atomicassets.m.js",
@@ -19,14 +19,14 @@
1919
"prepare": "make"
2020
},
2121
"dependencies": {
22-
"@wharfkit/antelope": "^1.0.8-rc1",
22+
"@wharfkit/antelope": "^1.0.8",
2323
"@wharfkit/common": "^1.2.0",
2424
"@wharfkit/contract": "^1.1.1",
2525
"@wharfkit/signing-request": "^3.0.0",
2626
"tslib": "^2.0.3"
2727
},
2828
"resolutions": {
29-
"@wharfkit/antelope": "^1.0.8-rc1"
29+
"@wharfkit/antelope": "^1.0.8"
3030
},
3131
"devDependencies": {
3232
"@rollup/plugin-alias": "^4.0.2",
@@ -38,6 +38,7 @@
3838
"@rollup/plugin-typescript": "^9.0.2",
3939
"@rollup/plugin-virtual": "^3.0.1",
4040
"@types/bn.js": "^5.1.0",
41+
"@types/chai": "^5.2.2",
4142
"@types/elliptic": "^6.4.12",
4243
"@types/mocha": "^10.0.0",
4344
"@types/node": "^18.6.5",
@@ -58,6 +59,7 @@
5859
"rollup-plugin-dts": "^5.0.0",
5960
"ts-node": "^10.1.0",
6061
"tsconfig-paths": "^4.0.0",
62+
"typedoc": "^0.23.14",
6163
"typescript": "^4.4"
6264
}
6365
}

src/endpoints/assets/types.ts

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
import {Int32, Name, Struct, UInt64} from '@wharfkit/antelope'
2+
3+
import {
4+
AccountBurns,
5+
AccountInfo,
6+
ActionLog,
7+
AssetObject,
8+
AssetStats,
9+
AtomicAssetsConfig,
10+
CollectionObject,
11+
CollectionStats,
12+
OfferObject,
13+
ResponseStruct,
14+
SchemaObject,
15+
SchemaStats,
16+
TemplateObject,
17+
TemplateStats,
18+
TransferObject,
19+
} from '../types'
20+
21+
@Struct.type('account_assets')
22+
export class AccountAssets extends Struct {
23+
@Struct.field(Name) declare account: Name
24+
@Struct.field(UInt64) declare assets: UInt64
25+
}
26+
27+
@Struct.type('action_logs_resp')
28+
export class ActionLogsResponse extends ResponseStruct {
29+
@Struct.field(ActionLog, {array: true}) declare data: ActionLog[]
30+
}
31+
32+
@Struct.type('get_config_resp')
33+
export class GetConfigResponse extends ResponseStruct {
34+
@Struct.field(AtomicAssetsConfig) declare data: AtomicAssetsConfig
35+
}
36+
37+
@Struct.type('get_accounts_resp')
38+
export class GetAccountsResponse extends ResponseStruct {
39+
@Struct.field(AccountAssets, {array: true}) declare data: AccountAssets[]
40+
}
41+
42+
@Struct.type('get_account_resp')
43+
export class GetAccountResponse extends ResponseStruct {
44+
@Struct.field(AccountInfo) declare data: AccountInfo
45+
}
46+
47+
@Struct.type('schema_count')
48+
export class SchemaCount extends Struct {
49+
@Struct.field(Name) declare schema_name: Name
50+
@Struct.field(UInt64) declare assets: UInt64
51+
}
52+
53+
@Struct.type('template_count')
54+
export class TemplateCount extends Struct {
55+
@Struct.field(Int32) declare template_id: Int32
56+
@Struct.field(UInt64) declare assets: UInt64
57+
}
58+
59+
@Struct.type('template_schema_count')
60+
export class TemplateSchemaCount extends Struct {
61+
@Struct.field(SchemaCount, {array: true}) declare schemas: SchemaCount[]
62+
@Struct.field(TemplateCount, {array: true}) declare templates: TemplateCount[]
63+
}
64+
65+
@Struct.type('get_account_template_schema_count_resp')
66+
export class GetAccountTemplateSchemaCountResponse extends ResponseStruct {
67+
@Struct.field(TemplateSchemaCount) declare data: TemplateSchemaCount
68+
}
69+
70+
@Struct.type('get_collections_resp')
71+
export class GetCollectionsResponse extends ResponseStruct {
72+
@Struct.field(CollectionObject, {array: true}) declare data: CollectionObject[]
73+
}
74+
75+
@Struct.type('get_collection_resp')
76+
export class GetCollectionResponse extends ResponseStruct {
77+
@Struct.field(CollectionObject) declare data: CollectionObject
78+
}
79+
80+
@Struct.type('get_collection_stats_resp')
81+
export class GetCollectionStatsResponse extends ResponseStruct {
82+
@Struct.field(CollectionStats) declare data: CollectionStats
83+
}
84+
85+
@Struct.type('get_schemas_resp')
86+
export class GetSchemasResponse extends ResponseStruct {
87+
@Struct.field(SchemaObject, {array: true}) declare data: SchemaObject[]
88+
}
89+
90+
@Struct.type('get_schema_resp')
91+
export class GetSchemaResponse extends ResponseStruct {
92+
@Struct.field(SchemaObject) declare data: SchemaObject
93+
}
94+
95+
@Struct.type('get_schema_stats_resp')
96+
export class GetSchemaStatsResponse extends ResponseStruct {
97+
@Struct.field(SchemaStats) declare data: SchemaStats
98+
}
99+
100+
@Struct.type('get_templates_resp')
101+
export class GetTemplatesResponse extends ResponseStruct {
102+
@Struct.field(TemplateObject, {array: true}) declare data: TemplateObject[]
103+
}
104+
105+
@Struct.type('get_template_resp')
106+
export class GetTemplateResponse extends ResponseStruct {
107+
@Struct.field(TemplateObject) declare data: TemplateObject
108+
}
109+
110+
@Struct.type('get_template_stats_resp')
111+
export class GetTemplateStatsResponse extends ResponseStruct {
112+
@Struct.field(TemplateStats) declare data: TemplateStats
113+
}
114+
115+
@Struct.type('get_assets_resp')
116+
export class GetAssetsResponse extends ResponseStruct {
117+
@Struct.field(AssetObject, {array: true}) declare data: AssetObject[]
118+
}
119+
120+
@Struct.type('get_asset_resp')
121+
export class GetAssetResponse extends ResponseStruct {
122+
@Struct.field(AssetObject) declare data: AssetObject
123+
}
124+
125+
@Struct.type('get_asset_stats_resp')
126+
export class GetAssetStatsResponse extends ResponseStruct {
127+
@Struct.field(AssetStats) declare data: AssetStats
128+
}
129+
130+
@Struct.type('get_offers_resp')
131+
export class GetOffersResponse extends ResponseStruct {
132+
@Struct.field(OfferObject, {array: true}) declare data: OfferObject[]
133+
}
134+
135+
@Struct.type('get_offer_resp')
136+
export class GetOfferResponse extends ResponseStruct {
137+
@Struct.field(OfferObject) declare data: OfferObject
138+
}
139+
140+
@Struct.type('get_transfers_resp')
141+
export class GetTransfersResponse extends ResponseStruct {
142+
@Struct.field(TransferObject, {array: true}) declare data: TransferObject[]
143+
}
144+
145+
@Struct.type('get_account_burns_resp')
146+
export class GetAccountBurnsResponse extends ResponseStruct {
147+
@Struct.field(AccountBurns) declare data: AccountBurns
148+
}

src/endpoints/assets/v1.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import type {APIClient} from '@wharfkit/antelope'
22
import type {Int32Type, NameType, UInt32Type, UInt64Type} from '@wharfkit/antelope'
33
import type {ActionNames as ActionType} from '../../contracts/atomicassets'
4-
import {Assets, CountResponseStruct} from '../../types'
4+
import {CountResponseStruct} from '../../types'
5+
import * as Assets from './types'
56
import type {OfferState} from '../../types'
67
import {buildBodyParams} from '../utils'
78

0 commit comments

Comments
 (0)