anchor-sdk 0.1.41-internal.6 → 0.1.42-beta.0
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/dist/AnchorApiClientV2.d.ts +6 -1
- package/dist/generated/Api.d.ts +620 -555
- package/dist/generated/Api.js +15 -0
- package/package.json +83 -85
- package/dist/AnchorApiClient.d.ts +0 -203
- package/dist/AnchorApiClient.js +0 -279
- package/dist/api/AnchorApiHttpClient.d.ts +0 -210
- package/dist/api/AnchorApiHttpClient.js +0 -411
- package/dist/api/types.d.ts +0 -764
- package/dist/api/types.js +0 -2
package/dist/generated/Api.js
CHANGED
|
@@ -586,6 +586,21 @@ class Api extends HttpClient {
|
|
|
586
586
|
}),
|
|
587
587
|
};
|
|
588
588
|
this.s1 = {
|
|
589
|
+
/**
|
|
590
|
+
* @description query badges holders
|
|
591
|
+
*
|
|
592
|
+
* @tags AnchorS2S
|
|
593
|
+
* @name QueryBadgesHolders
|
|
594
|
+
* @summary query badges holders
|
|
595
|
+
* @request GET:/s1/badges/holders
|
|
596
|
+
*/
|
|
597
|
+
queryBadgesHolders: (query, params = {}) => this.request({
|
|
598
|
+
path: `/s1/badges/holders`,
|
|
599
|
+
method: "GET",
|
|
600
|
+
query: query,
|
|
601
|
+
format: "json",
|
|
602
|
+
...params,
|
|
603
|
+
}),
|
|
589
604
|
/**
|
|
590
605
|
* @description 退出当前团队
|
|
591
606
|
*
|
package/package.json
CHANGED
|
@@ -1,87 +1,85 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"typescript": "^5.0.3"
|
|
86
|
-
}
|
|
2
|
+
"name": "anchor-sdk",
|
|
3
|
+
"version": "0.1.42-beta.0",
|
|
4
|
+
"description": "TypeScript SDK for interacting with Anchor ecosystem - badge minting, payment processing, and ERC1155 token management",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./dist/index.js",
|
|
9
|
+
"./react": "./dist/react/index.js"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc",
|
|
13
|
+
"test": "jest --passWithNoTests",
|
|
14
|
+
"lint": "eslint src --ext .ts",
|
|
15
|
+
"pre-publish-check": "./scripts/pre-publish-check.sh",
|
|
16
|
+
"publish": "./scripts/publish.sh",
|
|
17
|
+
"publish-internal": "./scripts/publish-internal.sh",
|
|
18
|
+
"typechain": "typechain --target ethers-v6 --out-dir ./src/typechain './src/abi/**/**.json'",
|
|
19
|
+
"generate-api": "npx swagger-typescript-api generate --path ./src/swagger/swagger.json --output ./src/generated",
|
|
20
|
+
"merge-api": "openapi-merge-cli --config merge-config.json"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"blockchain",
|
|
24
|
+
"ethereum",
|
|
25
|
+
"anchor",
|
|
26
|
+
"payment",
|
|
27
|
+
"badge",
|
|
28
|
+
"erc1155",
|
|
29
|
+
"nft",
|
|
30
|
+
"typescript",
|
|
31
|
+
"sdk",
|
|
32
|
+
"viem",
|
|
33
|
+
"ethers",
|
|
34
|
+
"web3",
|
|
35
|
+
"account-abstraction",
|
|
36
|
+
"eoa",
|
|
37
|
+
"multicall",
|
|
38
|
+
"react"
|
|
39
|
+
],
|
|
40
|
+
"author": "AnchorLabs",
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"homepage": "https://github.com/keccak256-evg/anchor-sdk#readme",
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "git+https://github.com/keccak256-evg/anchor-sdk.git"
|
|
46
|
+
},
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/keccak256-evg/anchor-sdk/issues"
|
|
49
|
+
},
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=16.0.0"
|
|
52
|
+
},
|
|
53
|
+
"files": [
|
|
54
|
+
"dist",
|
|
55
|
+
"README.md",
|
|
56
|
+
"LICENSE"
|
|
57
|
+
],
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"access": "public"
|
|
60
|
+
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"abitype": "^0.10.2",
|
|
63
|
+
"ethers": "^6.15.0",
|
|
64
|
+
"viem": "^2.37.6"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@typechain/ethers-v6": "^0.5.1",
|
|
68
|
+
"@types/jest": "^29.5.0",
|
|
69
|
+
"@types/node": "^18.15.11",
|
|
70
|
+
"@types/react": "^19.0.10",
|
|
71
|
+
"@types/react-dom": "^19.0.4",
|
|
72
|
+
"@typescript-eslint/eslint-plugin": "^5.57.1",
|
|
73
|
+
"@typescript-eslint/parser": "^5.57.1",
|
|
74
|
+
"dotenv": "^16.4.7",
|
|
75
|
+
"eslint": "^8.37.0",
|
|
76
|
+
"jest": "^29.5.0",
|
|
77
|
+
"openapi-merge-cli": "^1.3.2",
|
|
78
|
+
"react": "^19.0.0",
|
|
79
|
+
"react-dom": "^19.0.0",
|
|
80
|
+
"swagger-typescript-api": "^13.2.9",
|
|
81
|
+
"ts-jest": "^29.1.0",
|
|
82
|
+
"typechain": "^8.3.2",
|
|
83
|
+
"typescript": "^5.0.3"
|
|
84
|
+
}
|
|
87
85
|
}
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import { BadgeCheckRequest, WebResultAssetsBadgeResponse, WebResultBadgeAssetsResponse, WebResultBadgeCheckResponse, WebResultBadgeClaimSignatureResponse, WebResultBadgeClaimableListResponse, WebResultBadgeClaimableResponse, WebResultBadgeDetailResponse, WebResultBadgeResponse, WebResultBadgeSeriesDetailResponse, WebResultBadgeSeriesResponse, WebResultCheckResponse, WebResultCheckResultResponse, WebResultGrantBadgeRequestVO, WebResultGrantBadgeResponseVO, WebResultNftSeriesDetailResponse, WebResultNftSeriesResponse, WebResultTransactionHashProcess, WebResultUserOpHashProcess } from "./api/types";
|
|
2
|
-
import { Chain } from "viem";
|
|
3
|
-
/**
|
|
4
|
-
* Anchor API 客户端配置
|
|
5
|
-
*/
|
|
6
|
-
export interface AnchorApiClientConfig {
|
|
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 客户端
|
|
20
|
-
* 用于与 Anchor API 服务进行交互
|
|
21
|
-
*/
|
|
22
|
-
export declare class AnchorApiClient {
|
|
23
|
-
private apiHttpClient;
|
|
24
|
-
private network;
|
|
25
|
-
/**
|
|
26
|
-
* 创建 Anchor API 客户端
|
|
27
|
-
* @param config 客户端配置
|
|
28
|
-
*/
|
|
29
|
-
constructor(config: AnchorApiClientConfig);
|
|
30
|
-
/**
|
|
31
|
-
* 设置认证令牌
|
|
32
|
-
* @param token 认证令牌
|
|
33
|
-
*/
|
|
34
|
-
setAuthToken(token: string): void;
|
|
35
|
-
/**
|
|
36
|
-
* 设置 Token 过期回调
|
|
37
|
-
* @param callback Token 过期回调函数
|
|
38
|
-
*/
|
|
39
|
-
setTokenExpiredCallback(callback: (error: Error) => void): void;
|
|
40
|
-
/**
|
|
41
|
-
* 设置项目 ID
|
|
42
|
-
* @param projectId 项目 ID
|
|
43
|
-
*/
|
|
44
|
-
setProjectId(projectId: string): void;
|
|
45
|
-
/**
|
|
46
|
-
* 设置链 ID
|
|
47
|
-
* @param chainId 链 ID
|
|
48
|
-
*/
|
|
49
|
-
setChainId(chainId: string): void;
|
|
50
|
-
/**
|
|
51
|
-
* 获取徽章系列列表
|
|
52
|
-
* @param status 系列状态过滤器
|
|
53
|
-
* @param group 系列组过滤器
|
|
54
|
-
* @param limit 每页项目数
|
|
55
|
-
* @param nextToken 分页令牌
|
|
56
|
-
* @returns 徽章系列响应
|
|
57
|
-
*/
|
|
58
|
-
getBadgeSeries(status?: string, group?: string, limit?: number, nextToken?: string): Promise<WebResultBadgeSeriesResponse>;
|
|
59
|
-
/**
|
|
60
|
-
* 获取徽章系列详情
|
|
61
|
-
* @param seriesId 系列标识符
|
|
62
|
-
* @returns 徽章系列详情响应
|
|
63
|
-
*/
|
|
64
|
-
getBadgeSeriesDetail(seriesId: string): Promise<WebResultBadgeSeriesDetailResponse>;
|
|
65
|
-
/**
|
|
66
|
-
* 获取用户徽章
|
|
67
|
-
* @param status 徽章状态过滤器
|
|
68
|
-
* @param strategy 返回策略
|
|
69
|
-
* @param series 徽章系列过滤器
|
|
70
|
-
* @param limit 每页项目数
|
|
71
|
-
* @param nextToken 分页令牌
|
|
72
|
-
* @returns 徽章响应
|
|
73
|
-
*/
|
|
74
|
-
getBadges(status?: string, strategy?: string, series?: string, limit?: number, nextToken?: string): Promise<WebResultBadgeResponse>;
|
|
75
|
-
/**
|
|
76
|
-
* 获取徽章详情
|
|
77
|
-
* @param badgeId 徽章标识符
|
|
78
|
-
* @returns 徽章详情响应
|
|
79
|
-
*/
|
|
80
|
-
getBadgeDetail(badgeId: string): Promise<WebResultBadgeDetailResponse>;
|
|
81
|
-
/**
|
|
82
|
-
* 检查单个徽章可领取状态
|
|
83
|
-
* @param badgeId 徽章标识符
|
|
84
|
-
* @returns 徽章可领取响应
|
|
85
|
-
*/
|
|
86
|
-
checkSingleBadgeClaimable(badgeId: string): Promise<WebResultBadgeClaimableResponse>;
|
|
87
|
-
/**
|
|
88
|
-
* 获取用户徽章资产
|
|
89
|
-
* @param status 徽章状态过滤器
|
|
90
|
-
* @param strategy 返回策略
|
|
91
|
-
* @param series 徽章系列过滤器
|
|
92
|
-
* @param limit 每页项目数
|
|
93
|
-
* @param nextToken 分页令牌
|
|
94
|
-
* @returns 徽章资产响应
|
|
95
|
-
*/
|
|
96
|
-
getUserBadgeAssets(status?: string, strategy?: string, series?: string, limit?: number, nextToken?: string): Promise<WebResultBadgeAssetsResponse>;
|
|
97
|
-
/**
|
|
98
|
-
* 检查用户可领取徽章
|
|
99
|
-
* @param data 徽章检查请求
|
|
100
|
-
* @returns 徽章检查响应
|
|
101
|
-
*/
|
|
102
|
-
checkUserClaimableBadges(data: BadgeCheckRequest): Promise<WebResultBadgeCheckResponse>;
|
|
103
|
-
/**
|
|
104
|
-
* 获取用户可领取徽章
|
|
105
|
-
* @param series 徽章系列过滤器
|
|
106
|
-
* @param limit 每页项目数
|
|
107
|
-
* @param nextToken 分页令牌
|
|
108
|
-
* @returns 徽章可领取列表响应
|
|
109
|
-
*/
|
|
110
|
-
getUserClaimableBadges(series?: string, limit?: number, nextToken?: string): Promise<WebResultBadgeClaimableListResponse>;
|
|
111
|
-
/**
|
|
112
|
-
* 获取徽章领取签名
|
|
113
|
-
* @param customerAddress 客户钱包地址
|
|
114
|
-
* @param badgeIds 要领取的徽章 ID 列表
|
|
115
|
-
* @returns 徽章领取签名响应
|
|
116
|
-
*/
|
|
117
|
-
getBadgeClaimSignatures(customerAddress: string, badgeIds: string[]): Promise<WebResultBadgeClaimSignatureResponse>;
|
|
118
|
-
/**
|
|
119
|
-
* 查询资产
|
|
120
|
-
* @param customerIds 用户 ID 列表
|
|
121
|
-
* @param status 资产状态
|
|
122
|
-
* @param strategy 返回策略
|
|
123
|
-
* @param limit 返回数量限制
|
|
124
|
-
* @returns 资产徽章响应
|
|
125
|
-
*/
|
|
126
|
-
getUserAssets(customerIds?: string[], status?: string, strategy?: string, limit?: number): Promise<WebResultAssetsBadgeResponse>;
|
|
127
|
-
/**
|
|
128
|
-
* 授予徽章 (Legacy)
|
|
129
|
-
* @param data 授予徽章请求数据
|
|
130
|
-
* @returns 授予徽章响应
|
|
131
|
-
*/
|
|
132
|
-
grantBadge(data: WebResultGrantBadgeRequestVO): Promise<WebResultGrantBadgeResponseVO>;
|
|
133
|
-
/**
|
|
134
|
-
* 查询用户可领取或已领取的徽章 (Legacy)
|
|
135
|
-
* @param customerId 客户 ID
|
|
136
|
-
* @param status NFT 状态,值(claimable、claimed)
|
|
137
|
-
* @param strategy 返回数据的策略(all:返回所有徽章, max:仅返回同系列等级最高的徽章)
|
|
138
|
-
* @returns 徽章响应
|
|
139
|
-
*/
|
|
140
|
-
getBadgeAssets(customerId?: string, status?: "claimable" | "claimed", strategy?: "all" | "max"): Promise<WebResultBadgeResponse>;
|
|
141
|
-
/**
|
|
142
|
-
* 获取 NFT 系列 (Legacy)
|
|
143
|
-
* @returns NFT 系列响应
|
|
144
|
-
*/
|
|
145
|
-
getNftSeries(): Promise<WebResultNftSeriesResponse>;
|
|
146
|
-
/**
|
|
147
|
-
* 通过 ID 获取 NFT 系列 (Legacy)
|
|
148
|
-
* @param series NFT 系列
|
|
149
|
-
* @param customerId 用户 ID
|
|
150
|
-
* @returns NFT 系列详情响应
|
|
151
|
-
*/
|
|
152
|
-
getNftSeriesById(series: string, customerId?: string): Promise<WebResultNftSeriesDetailResponse>;
|
|
153
|
-
/**
|
|
154
|
-
* 检查徽章 (Legacy)
|
|
155
|
-
* @returns 检查响应
|
|
156
|
-
*/
|
|
157
|
-
checkBadge(): Promise<WebResultCheckResponse>;
|
|
158
|
-
/**
|
|
159
|
-
* 获取徽章检查结果 (Legacy)
|
|
160
|
-
* @returns 检查结果响应
|
|
161
|
-
*/
|
|
162
|
-
getBadgeCheckResult(): Promise<WebResultCheckResultResponse>;
|
|
163
|
-
/**
|
|
164
|
-
* 处理用户操作哈希 (Legacy)
|
|
165
|
-
* @param userOperationHash 用户操作哈希
|
|
166
|
-
* @param processType 处理类型,默认为 ERC20_TRANSFER
|
|
167
|
-
* @returns 处理响应
|
|
168
|
-
*/
|
|
169
|
-
processUserOpHash(userOperationHash: string, processType?: "ERC20_TRANSFER"): Promise<WebResultUserOpHashProcess>;
|
|
170
|
-
/**
|
|
171
|
-
* 加快交易处理 (Legacy)
|
|
172
|
-
* @param txHash 交易哈希
|
|
173
|
-
* @returns 处理响应
|
|
174
|
-
*/
|
|
175
|
-
processTransactionHash(txHash: string): Promise<WebResultTransactionHashProcess>;
|
|
176
|
-
/**
|
|
177
|
-
* @deprecated 使用 getBadgeClaimSignatures 替代
|
|
178
|
-
* 铸造徽章
|
|
179
|
-
* @param customerAddress 客户地址
|
|
180
|
-
* @param contractAddress NFT 地址
|
|
181
|
-
* @param claimableIds 可领取 ID 列表
|
|
182
|
-
* @returns NFT 铸造响应
|
|
183
|
-
*/
|
|
184
|
-
mintBadge(customerAddress: string, contractAddress: string, claimableIds: string[]): Promise<any>;
|
|
185
|
-
/**
|
|
186
|
-
* @deprecated 使用 getBadgeClaimSignatures 替代
|
|
187
|
-
* 使用 V2 API 铸造徽章
|
|
188
|
-
* @param customerAddress 客户地址
|
|
189
|
-
* @param contractAddress NFT 地址
|
|
190
|
-
* @param claimableIds 可领取 ID 列表
|
|
191
|
-
* @returns 铸造响应
|
|
192
|
-
*/
|
|
193
|
-
mintBadgeV2(customerAddress: string, contractAddress: string, claimableIds: string[]): Promise<any>;
|
|
194
|
-
/**
|
|
195
|
-
* @deprecated 使用 checkUserClaimableBadges 替代
|
|
196
|
-
* 批量铸造徽章(V2)
|
|
197
|
-
* @param customerAddress 客户地址
|
|
198
|
-
* @param contractAddress NFT 合约地址
|
|
199
|
-
* @param tokenIds 代币 ID 列表
|
|
200
|
-
* @returns 批量铸造响应
|
|
201
|
-
*/
|
|
202
|
-
batchMintBadge(customerAddress: string, contractAddress: string, tokenIds: string[]): Promise<any>;
|
|
203
|
-
}
|
package/dist/AnchorApiClient.js
DELETED
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AnchorApiClient = void 0;
|
|
4
|
-
const AnchorApiHttpClient_1 = require("./api/AnchorApiHttpClient");
|
|
5
|
-
/**
|
|
6
|
-
* Anchor API 客户端
|
|
7
|
-
* 用于与 Anchor API 服务进行交互
|
|
8
|
-
*/
|
|
9
|
-
class AnchorApiClient {
|
|
10
|
-
/**
|
|
11
|
-
* 创建 Anchor API 客户端
|
|
12
|
-
* @param config 客户端配置
|
|
13
|
-
*/
|
|
14
|
-
constructor(config) {
|
|
15
|
-
this.network = config.network;
|
|
16
|
-
this.apiHttpClient = new AnchorApiHttpClient_1.AnchorApiHttpClient({
|
|
17
|
-
baseUrl: config.apiBaseUrl,
|
|
18
|
-
authToken: config.authToken,
|
|
19
|
-
projectId: config.projectId,
|
|
20
|
-
chainId: config.network.id.toString(),
|
|
21
|
-
onTokenExpired: config.onTokenExpired,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* 设置认证令牌
|
|
26
|
-
* @param token 认证令牌
|
|
27
|
-
*/
|
|
28
|
-
setAuthToken(token) {
|
|
29
|
-
this.apiHttpClient.setAuthToken(token);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* 设置 Token 过期回调
|
|
33
|
-
* @param callback Token 过期回调函数
|
|
34
|
-
*/
|
|
35
|
-
setTokenExpiredCallback(callback) {
|
|
36
|
-
this.apiHttpClient.setTokenExpiredCallback(callback);
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* 设置项目 ID
|
|
40
|
-
* @param projectId 项目 ID
|
|
41
|
-
*/
|
|
42
|
-
setProjectId(projectId) {
|
|
43
|
-
this.apiHttpClient.setProjectId(projectId);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* 设置链 ID
|
|
47
|
-
* @param chainId 链 ID
|
|
48
|
-
*/
|
|
49
|
-
setChainId(chainId) {
|
|
50
|
-
this.apiHttpClient.setChainId(chainId);
|
|
51
|
-
}
|
|
52
|
-
// ==================== V2 API Methods ====================
|
|
53
|
-
/**
|
|
54
|
-
* 获取徽章系列列表
|
|
55
|
-
* @param status 系列状态过滤器
|
|
56
|
-
* @param group 系列组过滤器
|
|
57
|
-
* @param limit 每页项目数
|
|
58
|
-
* @param nextToken 分页令牌
|
|
59
|
-
* @returns 徽章系列响应
|
|
60
|
-
*/
|
|
61
|
-
async getBadgeSeries(status, group, limit, nextToken) {
|
|
62
|
-
return this.apiHttpClient.getBadgeSeries(status, group, limit, nextToken);
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* 获取徽章系列详情
|
|
66
|
-
* @param seriesId 系列标识符
|
|
67
|
-
* @returns 徽章系列详情响应
|
|
68
|
-
*/
|
|
69
|
-
async getBadgeSeriesDetail(seriesId) {
|
|
70
|
-
return this.apiHttpClient.getBadgeSeriesDetail(seriesId);
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* 获取用户徽章
|
|
74
|
-
* @param status 徽章状态过滤器
|
|
75
|
-
* @param strategy 返回策略
|
|
76
|
-
* @param series 徽章系列过滤器
|
|
77
|
-
* @param limit 每页项目数
|
|
78
|
-
* @param nextToken 分页令牌
|
|
79
|
-
* @returns 徽章响应
|
|
80
|
-
*/
|
|
81
|
-
async getBadges(status, strategy, series, limit, nextToken) {
|
|
82
|
-
return this.apiHttpClient.getBadges(status, strategy, series, limit, nextToken);
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* 获取徽章详情
|
|
86
|
-
* @param badgeId 徽章标识符
|
|
87
|
-
* @returns 徽章详情响应
|
|
88
|
-
*/
|
|
89
|
-
async getBadgeDetail(badgeId) {
|
|
90
|
-
return this.apiHttpClient.getBadgeDetail(badgeId);
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* 检查单个徽章可领取状态
|
|
94
|
-
* @param badgeId 徽章标识符
|
|
95
|
-
* @returns 徽章可领取响应
|
|
96
|
-
*/
|
|
97
|
-
async checkSingleBadgeClaimable(badgeId) {
|
|
98
|
-
return this.apiHttpClient.checkSingleBadgeClaimable(badgeId);
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* 获取用户徽章资产
|
|
102
|
-
* @param status 徽章状态过滤器
|
|
103
|
-
* @param strategy 返回策略
|
|
104
|
-
* @param series 徽章系列过滤器
|
|
105
|
-
* @param limit 每页项目数
|
|
106
|
-
* @param nextToken 分页令牌
|
|
107
|
-
* @returns 徽章资产响应
|
|
108
|
-
*/
|
|
109
|
-
async getUserBadgeAssets(status, strategy, series, limit, nextToken) {
|
|
110
|
-
return this.apiHttpClient.getUserBadgeAssets(status, strategy, series, limit, nextToken);
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* 检查用户可领取徽章
|
|
114
|
-
* @param data 徽章检查请求
|
|
115
|
-
* @returns 徽章检查响应
|
|
116
|
-
*/
|
|
117
|
-
async checkUserClaimableBadges(data) {
|
|
118
|
-
return this.apiHttpClient.checkUserClaimableBadges(data);
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* 获取用户可领取徽章
|
|
122
|
-
* @param series 徽章系列过滤器
|
|
123
|
-
* @param limit 每页项目数
|
|
124
|
-
* @param nextToken 分页令牌
|
|
125
|
-
* @returns 徽章可领取列表响应
|
|
126
|
-
*/
|
|
127
|
-
async getUserClaimableBadges(series, limit, nextToken) {
|
|
128
|
-
return this.apiHttpClient.getUserClaimableBadges(series, limit, nextToken);
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* 获取徽章领取签名
|
|
132
|
-
* @param customerAddress 客户钱包地址
|
|
133
|
-
* @param badgeIds 要领取的徽章 ID 列表
|
|
134
|
-
* @returns 徽章领取签名响应
|
|
135
|
-
*/
|
|
136
|
-
async getBadgeClaimSignatures(customerAddress, badgeIds) {
|
|
137
|
-
const data = {
|
|
138
|
-
customerAddress,
|
|
139
|
-
badgeIds,
|
|
140
|
-
};
|
|
141
|
-
return this.apiHttpClient.getBadgeClaimSignatures(data);
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* 查询资产
|
|
145
|
-
* @param customerIds 用户 ID 列表
|
|
146
|
-
* @param status 资产状态
|
|
147
|
-
* @param strategy 返回策略
|
|
148
|
-
* @param limit 返回数量限制
|
|
149
|
-
* @returns 资产徽章响应
|
|
150
|
-
*/
|
|
151
|
-
async getUserAssets(customerIds, status = "claimable", strategy = "all", limit = 100) {
|
|
152
|
-
return this.apiHttpClient.getUserAssets(customerIds, status, strategy, limit);
|
|
153
|
-
}
|
|
154
|
-
// ==================== Legacy V1 API Methods (Deprecated) ====================
|
|
155
|
-
/**
|
|
156
|
-
* 授予徽章 (Legacy)
|
|
157
|
-
* @param data 授予徽章请求数据
|
|
158
|
-
* @returns 授予徽章响应
|
|
159
|
-
*/
|
|
160
|
-
async grantBadge(data) {
|
|
161
|
-
return this.apiHttpClient.grantBadge(data);
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* 查询用户可领取或已领取的徽章 (Legacy)
|
|
165
|
-
* @param customerId 客户 ID
|
|
166
|
-
* @param status NFT 状态,值(claimable、claimed)
|
|
167
|
-
* @param strategy 返回数据的策略(all:返回所有徽章, max:仅返回同系列等级最高的徽章)
|
|
168
|
-
* @returns 徽章响应
|
|
169
|
-
*/
|
|
170
|
-
async getBadgeAssets(customerId, status, strategy) {
|
|
171
|
-
return this.apiHttpClient.badgeAssets(customerId, status, strategy);
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* 获取 NFT 系列 (Legacy)
|
|
175
|
-
* @returns NFT 系列响应
|
|
176
|
-
*/
|
|
177
|
-
async getNftSeries() {
|
|
178
|
-
return this.apiHttpClient.nftSeries("badge");
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* 通过 ID 获取 NFT 系列 (Legacy)
|
|
182
|
-
* @param series NFT 系列
|
|
183
|
-
* @param customerId 用户 ID
|
|
184
|
-
* @returns NFT 系列详情响应
|
|
185
|
-
*/
|
|
186
|
-
async getNftSeriesById(series, customerId) {
|
|
187
|
-
return this.apiHttpClient.getNftSeriesById("badge", series, customerId);
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* 检查徽章 (Legacy)
|
|
191
|
-
* @returns 检查响应
|
|
192
|
-
*/
|
|
193
|
-
async checkBadge() {
|
|
194
|
-
return this.apiHttpClient.check("badge");
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* 获取徽章检查结果 (Legacy)
|
|
198
|
-
* @returns 检查结果响应
|
|
199
|
-
*/
|
|
200
|
-
async getBadgeCheckResult() {
|
|
201
|
-
return this.apiHttpClient.getCheckResult("badge");
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* 处理用户操作哈希 (Legacy)
|
|
205
|
-
* @param userOperationHash 用户操作哈希
|
|
206
|
-
* @param processType 处理类型,默认为 ERC20_TRANSFER
|
|
207
|
-
* @returns 处理响应
|
|
208
|
-
*/
|
|
209
|
-
async processUserOpHash(userOperationHash, processType = "ERC20_TRANSFER") {
|
|
210
|
-
const data = {
|
|
211
|
-
userOperationHash,
|
|
212
|
-
processType,
|
|
213
|
-
};
|
|
214
|
-
return this.apiHttpClient.processUserOpHash(data);
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* 加快交易处理 (Legacy)
|
|
218
|
-
* @param txHash 交易哈希
|
|
219
|
-
* @returns 处理响应
|
|
220
|
-
*/
|
|
221
|
-
async processTransactionHash(txHash) {
|
|
222
|
-
return this.apiHttpClient.processTransactionHash(txHash);
|
|
223
|
-
}
|
|
224
|
-
// ==================== Deprecated Methods (Will be removed) ====================
|
|
225
|
-
/**
|
|
226
|
-
* @deprecated 使用 getBadgeClaimSignatures 替代
|
|
227
|
-
* 铸造徽章
|
|
228
|
-
* @param customerAddress 客户地址
|
|
229
|
-
* @param contractAddress NFT 地址
|
|
230
|
-
* @param claimableIds 可领取 ID 列表
|
|
231
|
-
* @returns NFT 铸造响应
|
|
232
|
-
*/
|
|
233
|
-
async mintBadge(customerAddress, contractAddress, claimableIds) {
|
|
234
|
-
console.warn("mintBadge method is deprecated, use getBadgeClaimSignatures instead");
|
|
235
|
-
const mintRequest = {
|
|
236
|
-
customerAddress,
|
|
237
|
-
nftType: "badge",
|
|
238
|
-
contractAddress,
|
|
239
|
-
claimableIds,
|
|
240
|
-
};
|
|
241
|
-
return this.apiHttpClient.mint("badge", mintRequest);
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* @deprecated 使用 getBadgeClaimSignatures 替代
|
|
245
|
-
* 使用 V2 API 铸造徽章
|
|
246
|
-
* @param customerAddress 客户地址
|
|
247
|
-
* @param contractAddress NFT 地址
|
|
248
|
-
* @param claimableIds 可领取 ID 列表
|
|
249
|
-
* @returns 铸造响应
|
|
250
|
-
*/
|
|
251
|
-
async mintBadgeV2(customerAddress, contractAddress, claimableIds) {
|
|
252
|
-
console.warn("mintBadgeV2 method is deprecated, use getBadgeClaimSignatures instead");
|
|
253
|
-
const mintRequest = {
|
|
254
|
-
customerAddress,
|
|
255
|
-
nftType: "badge",
|
|
256
|
-
contractAddress,
|
|
257
|
-
claimableIds,
|
|
258
|
-
};
|
|
259
|
-
return this.apiHttpClient.mintV2("badge", mintRequest);
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* @deprecated 使用 checkUserClaimableBadges 替代
|
|
263
|
-
* 批量铸造徽章(V2)
|
|
264
|
-
* @param customerAddress 客户地址
|
|
265
|
-
* @param contractAddress NFT 合约地址
|
|
266
|
-
* @param tokenIds 代币 ID 列表
|
|
267
|
-
* @returns 批量铸造响应
|
|
268
|
-
*/
|
|
269
|
-
async batchMintBadge(customerAddress, contractAddress, tokenIds) {
|
|
270
|
-
console.warn("batchMintBadge method is deprecated, use checkUserClaimableBadges instead");
|
|
271
|
-
const batchMintRequest = {
|
|
272
|
-
customerAddress,
|
|
273
|
-
contractAddress,
|
|
274
|
-
tokenIds,
|
|
275
|
-
};
|
|
276
|
-
return this.apiHttpClient.batchMint("badge", batchMintRequest);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
exports.AnchorApiClient = AnchorApiClient;
|