anchor-sdk 0.1.36 → 0.1.39

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/README.md CHANGED
@@ -44,7 +44,7 @@ Anchor SDK 需要以下依赖:
44
44
 
45
45
  - **Node.js**: >= 16.0.0
46
46
  - **TypeScript**: >= 4.5.0 (如果使用 TypeScript)
47
- - **viem**: ^2.23.9
47
+ - **viem**: ^2.37.6
48
48
  - **ethers**: ^6.15.0
49
49
 
50
50
  ### 可选依赖
package/dist/index.js CHANGED
@@ -396,7 +396,7 @@ class AnchorSDK {
396
396
  !mintResponse.obj ||
397
397
  !mintResponse.obj.signatures ||
398
398
  mintResponse.obj.signatures.length === 0) {
399
- throw new Error("Failed to get mint request from backend");
399
+ throw new Error(mintResponse.code || "Failed to get mint request from backend");
400
400
  }
401
401
  const mintRequest = mintResponse.obj.signatures[0];
402
402
  // 检查必要字段
@@ -540,7 +540,7 @@ class AnchorSDK {
540
540
  !mintResponse.obj ||
541
541
  !mintResponse.obj.signatures ||
542
542
  mintResponse.obj.signatures.length === 0) {
543
- throw new Error("Failed to get mint request from backend");
543
+ throw new Error(mintResponse.code || "Failed to get mint request from backend");
544
544
  }
545
545
  const mintRequest = mintResponse.obj.signatures[0];
546
546
  // 检查必要字段
@@ -874,7 +874,7 @@ class AnchorSDK {
874
874
  !mintResponse.obj ||
875
875
  !mintResponse.obj.signatures ||
876
876
  mintResponse.obj.signatures.length === 0) {
877
- throw new Error("Failed to get mint request from backend");
877
+ throw new Error(mintResponse.code || "Failed to get mint request from backend");
878
878
  }
879
879
  if (options?.sendTransaction === false) {
880
880
  const mintRequests = mintResponse.obj.signatures; // 获取所有签名
@@ -1095,7 +1095,8 @@ class AnchorSDK {
1095
1095
  !batchMintResponse.obj ||
1096
1096
  !batchMintResponse.obj.signatures ||
1097
1097
  batchMintResponse.obj.signatures.length === 0) {
1098
- throw new Error("Failed to get batch mint request from backend");
1098
+ throw new Error(batchMintResponse.code ||
1099
+ "Failed to get batch mint request from backend");
1099
1100
  }
1100
1101
  const mintRequests = batchMintResponse.obj.signatures;
1101
1102
  // AA 模式:只返回所有交易数据
@@ -1211,7 +1212,8 @@ class AnchorSDK {
1211
1212
  !batchMintResponse.obj ||
1212
1213
  !batchMintResponse.obj.signatures ||
1213
1214
  batchMintResponse.obj.signatures.length === 0) {
1214
- throw new Error("Failed to get batch mint request from backend");
1215
+ throw new Error(batchMintResponse.code ||
1216
+ "Failed to get batch mint request from backend");
1215
1217
  }
1216
1218
  const mintRequests = batchMintResponse.obj.signatures;
1217
1219
  // 编码所有 mintWithSignature 调用的 calldata
@@ -1306,7 +1308,7 @@ class AnchorSDK {
1306
1308
  !mintResponse.obj ||
1307
1309
  !mintResponse.obj.signatures ||
1308
1310
  mintResponse.obj.signatures.length === 0) {
1309
- throw new Error("Failed to get mint request from backend");
1311
+ throw new Error(mintResponse.code || "Failed to get mint request from backend");
1310
1312
  }
1311
1313
  // 编码所有 mintWithSignature 调用的 calldata
1312
1314
  const calldatas = mintResponse.obj.signatures.map((mintRequest) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anchor-sdk",
3
- "version": "0.1.36",
3
+ "version": "0.1.39",
4
4
  "description": "TypeScript SDK for interacting with Anchor ecosystem - badge minting, payment processing, and ERC1155 token management",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -63,7 +63,7 @@
63
63
  "dependencies": {
64
64
  "abitype": "^0.10.2",
65
65
  "ethers": "^6.15.0",
66
- "viem": "2.23.9"
66
+ "viem": "^2.37.6"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@typechain/ethers-v6": "^0.5.1",