anchor-sdk 0.1.36

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 (44) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +735 -0
  3. package/dist/AnchorApiClient.d.ts +203 -0
  4. package/dist/AnchorApiClient.js +279 -0
  5. package/dist/AnchorApiClientV2.d.ts +270 -0
  6. package/dist/AnchorApiClientV2.js +424 -0
  7. package/dist/AnchorERC1155Client.d.ts +85 -0
  8. package/dist/AnchorERC1155Client.js +280 -0
  9. package/dist/AnchorPayClient.d.ts +79 -0
  10. package/dist/AnchorPayClient.js +217 -0
  11. package/dist/abi/AnchorERC1155.d.ts +1359 -0
  12. package/dist/abi/AnchorERC1155.js +1122 -0
  13. package/dist/abi/AnchorPay.json +452 -0
  14. package/dist/api/AnchorApiHttpClient.d.ts +210 -0
  15. package/dist/api/AnchorApiHttpClient.js +411 -0
  16. package/dist/api/types.d.ts +764 -0
  17. package/dist/api/types.js +2 -0
  18. package/dist/constants.d.ts +49 -0
  19. package/dist/constants.js +221 -0
  20. package/dist/generated/Api.d.ts +1083 -0
  21. package/dist/generated/Api.js +571 -0
  22. package/dist/index.d.ts +341 -0
  23. package/dist/index.js +1377 -0
  24. package/dist/react/AnchorReactSDK.d.ts +59 -0
  25. package/dist/react/AnchorReactSDK.js +181 -0
  26. package/dist/react/index.d.ts +1 -0
  27. package/dist/react/index.js +8 -0
  28. package/dist/typechain/AnchorERC1155.d.ts +999 -0
  29. package/dist/typechain/AnchorERC1155.js +2 -0
  30. package/dist/typechain/AnchorPay.d.ts +242 -0
  31. package/dist/typechain/AnchorPay.js +2 -0
  32. package/dist/typechain/common.d.ts +50 -0
  33. package/dist/typechain/common.js +2 -0
  34. package/dist/typechain/factories/AnchorERC1155__factory.d.ts +1365 -0
  35. package/dist/typechain/factories/AnchorERC1155__factory.js +1766 -0
  36. package/dist/typechain/factories/AnchorPay__factory.d.ts +358 -0
  37. package/dist/typechain/factories/AnchorPay__factory.js +469 -0
  38. package/dist/typechain/factories/index.d.ts +2 -0
  39. package/dist/typechain/factories/index.js +10 -0
  40. package/dist/typechain/index.d.ts +5 -0
  41. package/dist/typechain/index.js +41 -0
  42. package/dist/types.d.ts +109 -0
  43. package/dist/types.js +2 -0
  44. package/package.json +87 -0
@@ -0,0 +1,270 @@
1
+ import { BadgeCheckRequest, BadgeClaimSignatureRequest, BadgeSingleCheckRequest, BadgesCheckRequest, BatchMintRequestVO, CheckEventRequest, MintResponse, NFTMintRequestVO, PurchaseRequest, QueryAssetsRequest, UserOpHashProcessRequest, WebResultAssetsBadgeResponse, WebResultBadgeAssetsResponse, WebResultBadgeCheckResponse, WebResultBadgeClaimSignatureResponse, WebResultBadgeClaimableListResponse, WebResultBadgeDetailResponse, WebResultBadgeResponse, WebResultBadgeSeriesDetailResponse, WebResultBadgeSeriesResponse, WebResultBadgeVerifiersResponse, WebResultBadgesCheckResponse, WebResultCheckEventResponse, WebResultCheckResponse, WebResultCheckResultResponse, WebResultGrantBadgeRequestVO, WebResultGrantBadgeResponseVO, WebResultListSeasonConfigVO, WebResultNftSeriesDetailResponse, WebResultNftSeriesResponse, WebResultPurchaseResponse, WebResultTransactionHashProcess, WebResultUserOpHashProcess } from "./generated/Api";
2
+ import { Chain } from "viem";
3
+ /**
4
+ * Anchor API V2 客户端配置
5
+ */
6
+ export interface AnchorApiClientV2Config {
7
+ /** API 基础 URL */
8
+ apiBaseUrl: string;
9
+ /** 认证令牌 */
10
+ authToken?: string;
11
+ /** 项目 ID */
12
+ projectId?: string;
13
+ /** 网络配置 */
14
+ network: Chain;
15
+ /** Token 过期回调函数 */
16
+ onTokenExpired?: (error: Error) => void;
17
+ }
18
+ /**
19
+ * Anchor API V2 客户端
20
+ * 基于生成的 API 类型和端点,提供完整的 Anchor API 功能
21
+ *
22
+ * 这个客户端使用生成的 API 类型和端点,同时提供
23
+ * 自动 header 注入和配置管理功能。
24
+ */
25
+ export declare class AnchorApiClientV2 {
26
+ private generatedApi;
27
+ private network;
28
+ private authToken?;
29
+ private projectId?;
30
+ private chainId;
31
+ private onTokenExpired?;
32
+ /**
33
+ * 创建 Anchor API V2 客户端
34
+ * @param config 客户端配置
35
+ */
36
+ constructor(config: AnchorApiClientV2Config);
37
+ /**
38
+ * 设置认证令牌
39
+ * @param token 认证令牌
40
+ */
41
+ setAuthToken(token: string): void;
42
+ /**
43
+ * 设置 Token 过期回调
44
+ * @param callback Token 过期回调函数
45
+ */
46
+ setTokenExpiredCallback(callback: (error: Error) => void): void;
47
+ /**
48
+ * 设置项目 ID
49
+ * @param projectId 项目 ID
50
+ */
51
+ setProjectId(projectId: string): void;
52
+ /**
53
+ * 设置链 ID
54
+ * @param chainId 链 ID
55
+ */
56
+ setChainId(chainId: string): void;
57
+ /**
58
+ * 创建请求头
59
+ * @returns 请求头对象
60
+ */
61
+ private createHeaders;
62
+ /**
63
+ * 获取请求参数(包含 headers)
64
+ * @returns 请求参数对象
65
+ */
66
+ private getRequestParams;
67
+ /**
68
+ * 处理 API 调用的错误和 token 过期
69
+ * @param apiCall API 调用函数
70
+ * @returns API 调用结果
71
+ */
72
+ private handleApiCall;
73
+ /**
74
+ * 获取徽章验证器
75
+ * @param platform 平台标识符
76
+ * @param type 条件类型
77
+ * @returns 徽章验证器响应
78
+ */
79
+ getBadgeVerifiers(platform: string, type: string): Promise<WebResultBadgeVerifiersResponse>;
80
+ /**
81
+ * 获取用户可领取徽章
82
+ * @param params 查询参数
83
+ * @param params.series 徽章系列过滤器
84
+ * @param params.limit 每页项目数
85
+ * @param params.nextToken 分页令牌
86
+ * @returns 徽章可领取列表响应
87
+ */
88
+ getUserClaimableBadges(params?: {
89
+ series?: string;
90
+ limit?: number;
91
+ nextToken?: string;
92
+ }): Promise<WebResultBadgeClaimableListResponse>;
93
+ /**
94
+ * 获取用户徽章资产
95
+ * @param params 查询参数
96
+ * @param params.status 徽章状态过滤器 pending/claimable/claimed
97
+ * @param params.strategy 返回策略 BADGE_ALL/BADGE_MAX/BADGE_REWARD
98
+ * @param params.series 徽章系列过滤器
99
+ * @param params.limit 每页项目数
100
+ * @param params.nextToken 分页令牌
101
+ * @returns 徽章资产响应
102
+ */
103
+ getUserBadgeAssets(params?: {
104
+ status?: string;
105
+ strategy?: string;
106
+ series?: string;
107
+ limit?: number;
108
+ nextToken?: string;
109
+ }): Promise<WebResultBadgeAssetsResponse>;
110
+ /**
111
+ * 获取徽章系列详情
112
+ * @param seriesId 系列标识符
113
+ * @param params 查询参数
114
+ * @param params.status 状态过滤器
115
+ * @param params.businessType 业务类型过滤器
116
+ * @returns 徽章系列详情响应
117
+ */
118
+ getBadgeSeriesDetail(seriesId: string, params?: {
119
+ status?: string;
120
+ businessType?: string;
121
+ }): Promise<WebResultBadgeSeriesDetailResponse>;
122
+ /**
123
+ * 获取徽章详情
124
+ * @param badgeId 徽章标识符
125
+ * @returns 徽章详情响应
126
+ */
127
+ getBadgeDetail(badgeId: string): Promise<WebResultBadgeDetailResponse>;
128
+ /**
129
+ * 检查单个徽章可领取状态
130
+ * @param badgeId 徽章标识符
131
+ * @param data 徽章检查请求数据
132
+ * @returns 徽章可领取响应
133
+ */
134
+ checkSingleBadgeClaimable(badgeId: string, data: BadgeSingleCheckRequest): Promise<WebResultBadgeClaimSignatureResponse>;
135
+ /**
136
+ * 检查用户可领取徽章
137
+ * @param data 徽章检查请求
138
+ * @returns 徽章检查响应
139
+ */
140
+ checkUserClaimableBadges(data: BadgeCheckRequest): Promise<WebResultBadgeCheckResponse>;
141
+ /**
142
+ * 获取徽章领取签名
143
+ * @param data 徽章领取签名请求
144
+ * @returns 徽章领取签名响应
145
+ */
146
+ getBadgeClaimSignatures(data: BadgeClaimSignatureRequest): Promise<WebResultBadgeClaimSignatureResponse>;
147
+ /**
148
+ * 获取徽章系列列表
149
+ * @param params 查询参数
150
+ * @param params.includeBadges 是否包含徽章
151
+ * @param params.status 状态过滤器
152
+ * @param params.businessType 业务类型过滤器
153
+ * @param params.limit 每页数量
154
+ * @returns 徽章系列响应
155
+ */
156
+ getBadgeSeries(params?: {
157
+ includeBadges?: boolean;
158
+ status?: string;
159
+ businessType?: string;
160
+ limit?: number;
161
+ }): Promise<WebResultBadgeSeriesResponse>;
162
+ /**
163
+ * Anchor 铸造
164
+ * @param type 铸造类型
165
+ * @param data 铸造请求数据
166
+ * @returns 铸造响应
167
+ */
168
+ mint(type: string, data: NFTMintRequestVO): Promise<MintResponse>;
169
+ /**
170
+ * Anchor 批量铸造
171
+ * @param type 铸造类型
172
+ * @param data 批量铸造请求数据
173
+ * @returns 批量铸造响应
174
+ */
175
+ batchMint(type: string, data: BatchMintRequestVO): Promise<MintResponse>;
176
+ /**
177
+ * 根据 ID 获取 NFT 系列
178
+ * @param type NFT 类型
179
+ * @param series 系列标识符
180
+ * @param customerId 客户 ID
181
+ * @returns NFT 系列详情响应
182
+ */
183
+ getNftSeriesById(type: string, series: string, customerId?: string): Promise<WebResultNftSeriesDetailResponse>;
184
+ /**
185
+ * 获取 NFT 系列
186
+ * @param type NFT 类型
187
+ * @returns NFT 系列响应
188
+ */
189
+ nftSeries(type: string): Promise<WebResultNftSeriesResponse>;
190
+ /**
191
+ * Anchor 检查
192
+ * @param type 检查类型
193
+ * @returns 检查响应
194
+ */
195
+ check(type: string): Promise<WebResultCheckResponse>;
196
+ /**
197
+ * 获取检查结果
198
+ * @param type 检查类型
199
+ * @returns 检查结果响应
200
+ */
201
+ getCheckResult(type: string): Promise<WebResultCheckResultResponse>;
202
+ /**
203
+ * 获取赛季配置列表
204
+ * @returns 赛季配置列表响应
205
+ */
206
+ listSeasonConfig(): Promise<WebResultListSeasonConfigVO>;
207
+ /**
208
+ * 查询用户可领取或已领取的徽章
209
+ * @param customerId 客户 ID
210
+ * @param status 徽章状态
211
+ * @param strategy 返回策略
212
+ * @param series 徽章系列
213
+ * @param limit 每页条数
214
+ * @param nextToken 分页参数
215
+ * @returns 徽章响应
216
+ */
217
+ badgeAssets(customerId?: string, status?: string, strategy?: string, series?: string, limit?: number, nextToken?: string): Promise<WebResultBadgeResponse>;
218
+ /**
219
+ * 处理用户操作哈希
220
+ * @param data 用户操作哈希处理请求
221
+ * @returns 用户操作哈希处理响应
222
+ */
223
+ userOpHashProcess(data: UserOpHashProcessRequest): Promise<WebResultUserOpHashProcess>;
224
+ /**
225
+ * 处理交易哈希(加速交易处理)
226
+ * @param txHash 交易哈希
227
+ * @returns 交易哈希处理响应
228
+ */
229
+ transactionHashProcess(txHash: string): Promise<WebResultTransactionHashProcess>;
230
+ /**
231
+ * 授予徽章
232
+ * @param data 授予徽章请求
233
+ * @returns 授予徽章响应
234
+ */
235
+ grantBadge(data: WebResultGrantBadgeRequestVO): Promise<WebResultGrantBadgeResponseVO>;
236
+ /**
237
+ * 购买铸造(带签名)
238
+ * @param type 购买类型
239
+ * @param data 购买请求数据
240
+ * @returns 购买响应
241
+ */
242
+ purchaseMint(type: string, data: PurchaseRequest): Promise<WebResultPurchaseResponse>;
243
+ /**
244
+ * 查询资产
245
+ * @param type 资产类型
246
+ * @param data 查询请求数据
247
+ * @returns 资产响应
248
+ */
249
+ queryAssets(type: string, data: QueryAssetsRequest): Promise<WebResultAssetsBadgeResponse>;
250
+ /**
251
+ * 根据 ID 获取 NFT 系列详情
252
+ * @param type NFT 类型
253
+ * @param series 系列标识符
254
+ * @param customerId 客户 ID
255
+ * @returns NFT 系列详情响应
256
+ */
257
+ getNftSeriesDetail(type: string, series: string, customerId?: string): Promise<WebResultNftSeriesDetailResponse>;
258
+ /**
259
+ * 根据事件检查
260
+ * @param data 检查事件请求
261
+ * @returns 检查事件响应
262
+ */
263
+ checkByEvent(data: CheckEventRequest): Promise<WebResultCheckEventResponse>;
264
+ /**
265
+ * 徽章检查
266
+ * @param data 徽章检查请求
267
+ * @returns 徽章检查响应
268
+ */
269
+ badgesCheck(data: BadgesCheckRequest): Promise<WebResultBadgesCheckResponse>;
270
+ }
@@ -0,0 +1,424 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AnchorApiClientV2 = void 0;
4
+ const Api_1 = require("./generated/Api");
5
+ /**
6
+ * Anchor API V2 客户端
7
+ * 基于生成的 API 类型和端点,提供完整的 Anchor API 功能
8
+ *
9
+ * 这个客户端使用生成的 API 类型和端点,同时提供
10
+ * 自动 header 注入和配置管理功能。
11
+ */
12
+ class AnchorApiClientV2 {
13
+ /**
14
+ * 创建 Anchor API V2 客户端
15
+ * @param config 客户端配置
16
+ */
17
+ constructor(config) {
18
+ this.network = config.network;
19
+ this.authToken = config.authToken;
20
+ this.projectId = config.projectId;
21
+ this.chainId = config.network.id.toString();
22
+ this.onTokenExpired = config.onTokenExpired;
23
+ // 初始化生成的 API
24
+ this.generatedApi = new Api_1.Api({
25
+ baseUrl: config.apiBaseUrl.endsWith("/")
26
+ ? config.apiBaseUrl.slice(0, -1)
27
+ : config.apiBaseUrl,
28
+ });
29
+ }
30
+ /**
31
+ * 设置认证令牌
32
+ * @param token 认证令牌
33
+ */
34
+ setAuthToken(token) {
35
+ this.authToken = token;
36
+ }
37
+ /**
38
+ * 设置 Token 过期回调
39
+ * @param callback Token 过期回调函数
40
+ */
41
+ setTokenExpiredCallback(callback) {
42
+ this.onTokenExpired = callback;
43
+ }
44
+ /**
45
+ * 设置项目 ID
46
+ * @param projectId 项目 ID
47
+ */
48
+ setProjectId(projectId) {
49
+ this.projectId = projectId;
50
+ }
51
+ /**
52
+ * 设置链 ID
53
+ * @param chainId 链 ID
54
+ */
55
+ setChainId(chainId) {
56
+ this.chainId = chainId;
57
+ }
58
+ /**
59
+ * 创建请求头
60
+ * @returns 请求头对象
61
+ */
62
+ createHeaders() {
63
+ const headers = {
64
+ "Content-Type": "application/json",
65
+ };
66
+ // 添加标准化的请求头
67
+ if (this.authToken) {
68
+ headers["Authorization"] = `Bearer ${this.authToken}`;
69
+ headers["jwt_token"] = `${this.authToken}`;
70
+ }
71
+ if (this.projectId) {
72
+ headers["X-Project-Id"] = this.projectId;
73
+ headers["saas_id"] = this.projectId;
74
+ }
75
+ if (this.chainId) {
76
+ headers["X-Chain-Id"] = this.chainId;
77
+ headers["chain_id"] = this.chainId;
78
+ }
79
+ return headers;
80
+ }
81
+ /**
82
+ * 获取请求参数(包含 headers)
83
+ * @returns 请求参数对象
84
+ */
85
+ getRequestParams() {
86
+ return {
87
+ headers: this.createHeaders(),
88
+ };
89
+ }
90
+ /**
91
+ * 处理 API 调用的错误和 token 过期
92
+ * @param apiCall API 调用函数
93
+ * @returns API 调用结果
94
+ */
95
+ async handleApiCall(apiCall) {
96
+ try {
97
+ return await apiCall();
98
+ }
99
+ catch (error) {
100
+ // 检查 token 过期
101
+ if (error instanceof Error &&
102
+ (error.message.includes("JWT") ||
103
+ error.message.includes("401") ||
104
+ error.message.includes("unauthorized"))) {
105
+ if (this.onTokenExpired) {
106
+ this.onTokenExpired(error);
107
+ }
108
+ }
109
+ throw error;
110
+ }
111
+ }
112
+ // ==================== V2 API Methods ====================
113
+ /**
114
+ * 获取徽章验证器
115
+ * @param platform 平台标识符
116
+ * @param type 条件类型
117
+ * @returns 徽章验证器响应
118
+ */
119
+ async getBadgeVerifiers(platform, type) {
120
+ return this.handleApiCall(async () => {
121
+ const query = { platform, type };
122
+ const response = await this.generatedApi.v2.getBadgeVerifiers(query, this.getRequestParams());
123
+ return response.data;
124
+ });
125
+ }
126
+ /**
127
+ * 获取用户可领取徽章
128
+ * @param params 查询参数
129
+ * @param params.series 徽章系列过滤器
130
+ * @param params.limit 每页项目数
131
+ * @param params.nextToken 分页令牌
132
+ * @returns 徽章可领取列表响应
133
+ */
134
+ async getUserClaimableBadges(params) {
135
+ return this.handleApiCall(async () => {
136
+ const response = await this.generatedApi.v2.getUserClaimableBadges(params, this.getRequestParams());
137
+ return response.data;
138
+ });
139
+ }
140
+ /**
141
+ * 获取用户徽章资产
142
+ * @param params 查询参数
143
+ * @param params.status 徽章状态过滤器 pending/claimable/claimed
144
+ * @param params.strategy 返回策略 BADGE_ALL/BADGE_MAX/BADGE_REWARD
145
+ * @param params.series 徽章系列过滤器
146
+ * @param params.limit 每页项目数
147
+ * @param params.nextToken 分页令牌
148
+ * @returns 徽章资产响应
149
+ */
150
+ async getUserBadgeAssets(params) {
151
+ return this.handleApiCall(async () => {
152
+ const response = await this.generatedApi.v2.getUserBadgeAssets(params, this.getRequestParams());
153
+ return response.data;
154
+ });
155
+ }
156
+ /**
157
+ * 获取徽章系列详情
158
+ * @param seriesId 系列标识符
159
+ * @param params 查询参数
160
+ * @param params.status 状态过滤器
161
+ * @param params.businessType 业务类型过滤器
162
+ * @returns 徽章系列详情响应
163
+ */
164
+ async getBadgeSeriesDetail(seriesId, params) {
165
+ return this.handleApiCall(async () => {
166
+ const response = await this.generatedApi.v2.getBadgeSeriesDetail(seriesId, params, this.getRequestParams());
167
+ return response.data;
168
+ });
169
+ }
170
+ /**
171
+ * 获取徽章详情
172
+ * @param badgeId 徽章标识符
173
+ * @returns 徽章详情响应
174
+ */
175
+ async getBadgeDetail(badgeId) {
176
+ return this.handleApiCall(async () => {
177
+ const response = await this.generatedApi.v2.getBadgeDetail(badgeId, this.getRequestParams());
178
+ return response.data;
179
+ });
180
+ }
181
+ /**
182
+ * 检查单个徽章可领取状态
183
+ * @param badgeId 徽章标识符
184
+ * @param data 徽章检查请求数据
185
+ * @returns 徽章可领取响应
186
+ */
187
+ async checkSingleBadgeClaimable(badgeId, data) {
188
+ return this.handleApiCall(async () => {
189
+ const response = await this.generatedApi.v2.checkSingleBadgeClaimable(badgeId, data, this.getRequestParams());
190
+ return response.data;
191
+ });
192
+ }
193
+ /**
194
+ * 检查用户可领取徽章
195
+ * @param data 徽章检查请求
196
+ * @returns 徽章检查响应
197
+ */
198
+ async checkUserClaimableBadges(data) {
199
+ return this.handleApiCall(async () => {
200
+ const response = await this.generatedApi.v2.checkUserClaimableBadges(data, this.getRequestParams());
201
+ return response.data;
202
+ });
203
+ }
204
+ /**
205
+ * 获取徽章领取签名
206
+ * @param data 徽章领取签名请求
207
+ * @returns 徽章领取签名响应
208
+ */
209
+ async getBadgeClaimSignatures(data) {
210
+ return this.handleApiCall(async () => {
211
+ const response = await this.generatedApi.v2.getBadgeClaimSignatures(data, this.getRequestParams());
212
+ return response.data;
213
+ });
214
+ }
215
+ /**
216
+ * 获取徽章系列列表
217
+ * @param params 查询参数
218
+ * @param params.includeBadges 是否包含徽章
219
+ * @param params.status 状态过滤器
220
+ * @param params.businessType 业务类型过滤器
221
+ * @param params.limit 每页数量
222
+ * @returns 徽章系列响应
223
+ */
224
+ async getBadgeSeries(params) {
225
+ return this.handleApiCall(async () => {
226
+ const response = await this.generatedApi.v2.getBadgeSeries(params, this.getRequestParams());
227
+ return response.data;
228
+ });
229
+ }
230
+ /**
231
+ * Anchor 铸造
232
+ * @param type 铸造类型
233
+ * @param data 铸造请求数据
234
+ * @returns 铸造响应
235
+ */
236
+ async mint(type, data) {
237
+ return this.handleApiCall(async () => {
238
+ const response = await this.generatedApi.v2.mint(type, data, this.getRequestParams());
239
+ return response.data;
240
+ });
241
+ }
242
+ /**
243
+ * Anchor 批量铸造
244
+ * @param type 铸造类型
245
+ * @param data 批量铸造请求数据
246
+ * @returns 批量铸造响应
247
+ */
248
+ async batchMint(type, data) {
249
+ return this.handleApiCall(async () => {
250
+ const response = await this.generatedApi.v2.batchMint(type, data, this.getRequestParams());
251
+ return response.data;
252
+ });
253
+ }
254
+ // ==================== V1 API Methods ====================
255
+ /**
256
+ * 根据 ID 获取 NFT 系列
257
+ * @param type NFT 类型
258
+ * @param series 系列标识符
259
+ * @param customerId 客户 ID
260
+ * @returns NFT 系列详情响应
261
+ */
262
+ async getNftSeriesById(type, series, customerId) {
263
+ return this.handleApiCall(async () => {
264
+ const query = customerId ? { customerId } : undefined;
265
+ const response = await this.generatedApi.v1.getNftSeriesById(type, series, query, this.getRequestParams());
266
+ return response.data;
267
+ });
268
+ }
269
+ /**
270
+ * 获取 NFT 系列
271
+ * @param type NFT 类型
272
+ * @returns NFT 系列响应
273
+ */
274
+ async nftSeries(type) {
275
+ return this.handleApiCall(async () => {
276
+ const response = await this.generatedApi.v1.nftSeries(type, this.getRequestParams());
277
+ return response.data;
278
+ });
279
+ }
280
+ /**
281
+ * Anchor 检查
282
+ * @param type 检查类型
283
+ * @returns 检查响应
284
+ */
285
+ async check(type) {
286
+ return this.handleApiCall(async () => {
287
+ const response = await this.generatedApi.v1.check(type, this.getRequestParams());
288
+ return response.data;
289
+ });
290
+ }
291
+ /**
292
+ * 获取检查结果
293
+ * @param type 检查类型
294
+ * @returns 检查结果响应
295
+ */
296
+ async getCheckResult(type) {
297
+ return this.handleApiCall(async () => {
298
+ const response = await this.generatedApi.v1.getCheckResult(type, this.getRequestParams());
299
+ return response.data;
300
+ });
301
+ }
302
+ /**
303
+ * 获取赛季配置列表
304
+ * @returns 赛季配置列表响应
305
+ */
306
+ async listSeasonConfig() {
307
+ return this.handleApiCall(async () => {
308
+ const response = await this.generatedApi.v1.listSeasonConfig(this.getRequestParams());
309
+ return response.data;
310
+ });
311
+ }
312
+ /**
313
+ * 查询用户可领取或已领取的徽章
314
+ * @param customerId 客户 ID
315
+ * @param status 徽章状态
316
+ * @param strategy 返回策略
317
+ * @param series 徽章系列
318
+ * @param limit 每页条数
319
+ * @param nextToken 分页参数
320
+ * @returns 徽章响应
321
+ */
322
+ async badgeAssets(customerId, status, strategy, series, limit, nextToken) {
323
+ return this.handleApiCall(async () => {
324
+ const query = { customerId, status, strategy, series, limit, nextToken };
325
+ const response = await this.generatedApi.v1.badgeAssets(query, this.getRequestParams());
326
+ return response.data;
327
+ });
328
+ }
329
+ /**
330
+ * 处理用户操作哈希
331
+ * @param data 用户操作哈希处理请求
332
+ * @returns 用户操作哈希处理响应
333
+ */
334
+ async userOpHashProcess(data) {
335
+ return this.handleApiCall(async () => {
336
+ const response = await this.generatedApi.v1.userOpHashProcess(data, this.getRequestParams());
337
+ return response.data;
338
+ });
339
+ }
340
+ /**
341
+ * 处理交易哈希(加速交易处理)
342
+ * @param txHash 交易哈希
343
+ * @returns 交易哈希处理响应
344
+ */
345
+ async transactionHashProcess(txHash) {
346
+ return this.handleApiCall(async () => {
347
+ const response = await this.generatedApi.v1.transactionHashProcess(txHash, this.getRequestParams());
348
+ return response.data;
349
+ });
350
+ }
351
+ // ==================== S1 API Methods ====================
352
+ /**
353
+ * 授予徽章
354
+ * @param data 授予徽章请求
355
+ * @returns 授予徽章响应
356
+ */
357
+ async grantBadge(data) {
358
+ return this.handleApiCall(async () => {
359
+ const response = await this.generatedApi.s1.grantBadge(data, this.getRequestParams());
360
+ return response.data;
361
+ });
362
+ }
363
+ /**
364
+ * 购买铸造(带签名)
365
+ * @param type 购买类型
366
+ * @param data 购买请求数据
367
+ * @returns 购买响应
368
+ */
369
+ async purchaseMint(type, data) {
370
+ return this.handleApiCall(async () => {
371
+ const response = await this.generatedApi.s1.purchaseMint(type, data, this.getRequestParams());
372
+ return response.data;
373
+ });
374
+ }
375
+ /**
376
+ * 查询资产
377
+ * @param type 资产类型
378
+ * @param data 查询请求数据
379
+ * @returns 资产响应
380
+ */
381
+ async queryAssets(type, data) {
382
+ return this.handleApiCall(async () => {
383
+ const response = await this.generatedApi.s1.queryAssets(type, data, this.getRequestParams());
384
+ return response.data;
385
+ });
386
+ }
387
+ /**
388
+ * 根据 ID 获取 NFT 系列详情
389
+ * @param type NFT 类型
390
+ * @param series 系列标识符
391
+ * @param customerId 客户 ID
392
+ * @returns NFT 系列详情响应
393
+ */
394
+ async getNftSeriesDetail(type, series, customerId) {
395
+ return this.handleApiCall(async () => {
396
+ const query = customerId ? { customerId } : undefined;
397
+ const response = await this.generatedApi.s1.getNftSeriesDetail(type, series, query, this.getRequestParams());
398
+ return response.data;
399
+ });
400
+ }
401
+ /**
402
+ * 根据事件检查
403
+ * @param data 检查事件请求
404
+ * @returns 检查事件响应
405
+ */
406
+ async checkByEvent(data) {
407
+ return this.handleApiCall(async () => {
408
+ const response = await this.generatedApi.s1.checkByEvent(data, this.getRequestParams());
409
+ return response.data;
410
+ });
411
+ }
412
+ /**
413
+ * 徽章检查
414
+ * @param data 徽章检查请求
415
+ * @returns 徽章检查响应
416
+ */
417
+ async badgesCheck(data) {
418
+ return this.handleApiCall(async () => {
419
+ const response = await this.generatedApi.s1.badgesCheck(data, this.getRequestParams());
420
+ return response.data;
421
+ });
422
+ }
423
+ }
424
+ exports.AnchorApiClientV2 = AnchorApiClientV2;