bitbadgesjs-sdk 0.29.3 → 0.30.1

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 (250) hide show
  1. package/README.md +258 -47
  2. package/dist/cjs/api-indexer/BitBadgesApi.js +13 -17
  3. package/dist/cjs/api-indexer/BitBadgesApi.js.map +1 -1
  4. package/dist/cjs/api-indexer/BitBadgesCollection.d.ts +4 -2
  5. package/dist/cjs/api-indexer/BitBadgesCollection.d.ts.map +1 -1
  6. package/dist/cjs/api-indexer/BitBadgesCollection.js +1 -0
  7. package/dist/cjs/api-indexer/BitBadgesCollection.js.map +1 -1
  8. package/dist/cjs/api-indexer/base.d.ts +2 -1
  9. package/dist/cjs/api-indexer/base.d.ts.map +1 -1
  10. package/dist/cjs/api-indexer/base.js +4 -12
  11. package/dist/cjs/api-indexer/base.js.map +1 -1
  12. package/dist/cjs/api-indexer/docs-types/docs.d.ts +0 -1
  13. package/dist/cjs/api-indexer/docs-types/docs.d.ts.map +1 -1
  14. package/dist/cjs/api-indexer/docs-types/docs.js +0 -1
  15. package/dist/cjs/api-indexer/docs-types/docs.js.map +1 -1
  16. package/dist/cjs/api-indexer/docs-types/interfaces.d.ts +0 -1
  17. package/dist/cjs/api-indexer/docs-types/interfaces.d.ts.map +1 -1
  18. package/dist/cjs/api-indexer/docs-types/interfaces.js.map +1 -1
  19. package/dist/cjs/api-indexer/metadata/tokenMetadata.d.ts +4 -4
  20. package/dist/cjs/api-indexer/metadata/tokenMetadata.d.ts.map +1 -1
  21. package/dist/cjs/api-indexer/requests/requests.d.ts +0 -2
  22. package/dist/cjs/api-indexer/requests/requests.d.ts.map +1 -1
  23. package/dist/cjs/api-indexer/requests/requests.js.map +1 -1
  24. package/dist/cjs/core/addressLists.d.ts +3 -0
  25. package/dist/cjs/core/addressLists.d.ts.map +1 -1
  26. package/dist/cjs/core/addressLists.js +39 -0
  27. package/dist/cjs/core/addressLists.js.map +1 -1
  28. package/dist/cjs/core/approvals.d.ts +11 -2
  29. package/dist/cjs/core/approvals.d.ts.map +1 -1
  30. package/dist/cjs/core/approvals.js +50 -8
  31. package/dist/cjs/core/approvals.js.map +1 -1
  32. package/dist/cjs/core/balances.d.ts +12 -0
  33. package/dist/cjs/core/balances.d.ts.map +1 -1
  34. package/dist/cjs/core/balances.js +37 -1
  35. package/dist/cjs/core/balances.js.map +1 -1
  36. package/dist/cjs/core/ibc-wrappers.d.ts +2 -1
  37. package/dist/cjs/core/ibc-wrappers.d.ts.map +1 -1
  38. package/dist/cjs/core/ibc-wrappers.js +21 -2
  39. package/dist/cjs/core/ibc-wrappers.js.map +1 -1
  40. package/dist/cjs/core/misc.d.ts +38 -2
  41. package/dist/cjs/core/misc.d.ts.map +1 -1
  42. package/dist/cjs/core/misc.js +107 -4
  43. package/dist/cjs/core/misc.js.map +1 -1
  44. package/dist/cjs/core/overlaps.d.ts.map +1 -1
  45. package/dist/cjs/core/overlaps.js +6 -22
  46. package/dist/cjs/core/overlaps.js.map +1 -1
  47. package/dist/cjs/core/overlaps.spec.js +131 -0
  48. package/dist/cjs/core/overlaps.spec.js.map +1 -1
  49. package/dist/cjs/core/transfers.spec.js +267 -0
  50. package/dist/cjs/core/transfers.spec.js.map +1 -1
  51. package/dist/cjs/index.d.ts +1 -0
  52. package/dist/cjs/index.d.ts.map +1 -1
  53. package/dist/cjs/index.js +1 -0
  54. package/dist/cjs/index.js.map +1 -1
  55. package/dist/cjs/interfaces/types/approvals.d.ts +4 -1
  56. package/dist/cjs/interfaces/types/approvals.d.ts.map +1 -1
  57. package/dist/cjs/interfaces/types/core.d.ts +26 -0
  58. package/dist/cjs/interfaces/types/core.d.ts.map +1 -1
  59. package/dist/cjs/proto/google/protobuf/descriptor_pb.js +2 -2
  60. package/dist/cjs/proto/google/protobuf/descriptor_pb.js.map +1 -1
  61. package/dist/cjs/proto/tokenization/approval_criteria_pb.d.ts +4 -1
  62. package/dist/cjs/proto/tokenization/approval_criteria_pb.d.ts.map +1 -1
  63. package/dist/cjs/proto/tokenization/approval_criteria_pb.js +6 -0
  64. package/dist/cjs/proto/tokenization/approval_criteria_pb.js.map +1 -1
  65. package/dist/cjs/proto/tokenization/challenges_pb.d.ts +17 -0
  66. package/dist/cjs/proto/tokenization/challenges_pb.d.ts.map +1 -1
  67. package/dist/cjs/proto/tokenization/challenges_pb.js +38 -1
  68. package/dist/cjs/proto/tokenization/challenges_pb.js.map +1 -1
  69. package/dist/cjs/proto/tokenization/collections_pb.d.ts +14 -0
  70. package/dist/cjs/proto/tokenization/collections_pb.d.ts.map +1 -1
  71. package/dist/cjs/proto/tokenization/collections_pb.js +31 -1
  72. package/dist/cjs/proto/tokenization/collections_pb.js.map +1 -1
  73. package/dist/cjs/proto/tokenization/genesis_pb.d.ts +3 -1
  74. package/dist/cjs/proto/tokenization/genesis_pb.d.ts.map +1 -1
  75. package/dist/cjs/proto/tokenization/genesis_pb.js +4 -0
  76. package/dist/cjs/proto/tokenization/genesis_pb.js.map +1 -1
  77. package/dist/cjs/proto/tokenization/icq_pb.d.ts +84 -0
  78. package/dist/cjs/proto/tokenization/icq_pb.d.ts.map +1 -0
  79. package/dist/cjs/proto/tokenization/icq_pb.js +185 -0
  80. package/dist/cjs/proto/tokenization/icq_pb.js.map +1 -0
  81. package/dist/cjs/proto/tokenization/packet_pb.d.ts +19 -0
  82. package/dist/cjs/proto/tokenization/packet_pb.d.ts.map +1 -1
  83. package/dist/cjs/proto/tokenization/packet_pb.js +7 -0
  84. package/dist/cjs/proto/tokenization/packet_pb.js.map +1 -1
  85. package/dist/cjs/proto/tokenization/query_pb.d.ts +23 -1
  86. package/dist/cjs/proto/tokenization/query_pb.d.ts.map +1 -1
  87. package/dist/cjs/proto/tokenization/query_pb.js +50 -1
  88. package/dist/cjs/proto/tokenization/query_pb.js.map +1 -1
  89. package/dist/cjs/proto/tokenization/tx_pb.d.ts +2 -0
  90. package/dist/cjs/proto/tokenization/tx_pb.d.ts.map +1 -1
  91. package/dist/cjs/proto/tokenization/tx_pb.js +3 -0
  92. package/dist/cjs/proto/tokenization/tx_pb.js.map +1 -1
  93. package/dist/cjs/signing/BitBadgesSigningClient.d.ts +32 -0
  94. package/dist/cjs/signing/BitBadgesSigningClient.d.ts.map +1 -0
  95. package/dist/cjs/signing/BitBadgesSigningClient.js +270 -0
  96. package/dist/cjs/signing/BitBadgesSigningClient.js.map +1 -0
  97. package/dist/cjs/signing/BitBadgesSigningClient.spec.d.ts +2 -0
  98. package/dist/cjs/signing/BitBadgesSigningClient.spec.d.ts.map +1 -0
  99. package/dist/cjs/signing/BitBadgesSigningClient.spec.js +182 -0
  100. package/dist/cjs/signing/BitBadgesSigningClient.spec.js.map +1 -0
  101. package/dist/cjs/signing/adapters/GenericCosmosAdapter.d.ts +73 -0
  102. package/dist/cjs/signing/adapters/GenericCosmosAdapter.d.ts.map +1 -0
  103. package/dist/cjs/signing/adapters/GenericCosmosAdapter.js +189 -0
  104. package/dist/cjs/signing/adapters/GenericCosmosAdapter.js.map +1 -0
  105. package/dist/cjs/signing/adapters/GenericEvmAdapter.d.ts +37 -0
  106. package/dist/cjs/signing/adapters/GenericEvmAdapter.d.ts.map +1 -0
  107. package/dist/cjs/signing/adapters/GenericEvmAdapter.js +71 -0
  108. package/dist/cjs/signing/adapters/GenericEvmAdapter.js.map +1 -0
  109. package/dist/cjs/signing/adapters/WalletAdapter.d.ts +23 -0
  110. package/dist/cjs/signing/adapters/WalletAdapter.d.ts.map +1 -0
  111. package/dist/cjs/signing/adapters/WalletAdapter.js +16 -0
  112. package/dist/cjs/signing/adapters/WalletAdapter.js.map +1 -0
  113. package/dist/cjs/signing/adapters/index.d.ts +4 -0
  114. package/dist/cjs/signing/adapters/index.d.ts.map +1 -0
  115. package/dist/cjs/signing/adapters/index.js +10 -0
  116. package/dist/cjs/signing/adapters/index.js.map +1 -0
  117. package/dist/cjs/signing/index.d.ts +4 -0
  118. package/dist/cjs/signing/index.d.ts.map +1 -0
  119. package/dist/cjs/signing/index.js +10 -0
  120. package/dist/cjs/signing/index.js.map +1 -0
  121. package/dist/cjs/signing/types.d.ts +68 -0
  122. package/dist/cjs/signing/types.d.ts.map +1 -0
  123. package/dist/cjs/signing/types.js +3 -0
  124. package/dist/cjs/signing/types.js.map +1 -0
  125. package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
  126. package/dist/esm/api-indexer/BitBadgesApi.js +13 -17
  127. package/dist/esm/api-indexer/BitBadgesApi.js.map +1 -1
  128. package/dist/esm/api-indexer/BitBadgesCollection.d.ts +4 -2
  129. package/dist/esm/api-indexer/BitBadgesCollection.d.ts.map +1 -1
  130. package/dist/esm/api-indexer/BitBadgesCollection.js +3 -1
  131. package/dist/esm/api-indexer/BitBadgesCollection.js.map +1 -1
  132. package/dist/esm/api-indexer/base.d.ts +2 -1
  133. package/dist/esm/api-indexer/base.d.ts.map +1 -1
  134. package/dist/esm/api-indexer/base.js +7 -12
  135. package/dist/esm/api-indexer/base.js.map +1 -1
  136. package/dist/esm/api-indexer/docs-types/docs.d.ts +0 -1
  137. package/dist/esm/api-indexer/docs-types/docs.d.ts.map +1 -1
  138. package/dist/esm/api-indexer/docs-types/docs.js +0 -2
  139. package/dist/esm/api-indexer/docs-types/docs.js.map +1 -1
  140. package/dist/esm/api-indexer/docs-types/interfaces.d.ts +0 -1
  141. package/dist/esm/api-indexer/docs-types/interfaces.d.ts.map +1 -1
  142. package/dist/esm/api-indexer/docs-types/interfaces.js.map +1 -1
  143. package/dist/esm/api-indexer/metadata/tokenMetadata.d.ts +4 -4
  144. package/dist/esm/api-indexer/metadata/tokenMetadata.d.ts.map +1 -1
  145. package/dist/esm/api-indexer/requests/requests.d.ts +0 -2
  146. package/dist/esm/api-indexer/requests/requests.d.ts.map +1 -1
  147. package/dist/esm/api-indexer/requests/requests.js.map +1 -1
  148. package/dist/esm/core/addressLists.d.ts +3 -0
  149. package/dist/esm/core/addressLists.d.ts.map +1 -1
  150. package/dist/esm/core/addressLists.js +39 -0
  151. package/dist/esm/core/addressLists.js.map +1 -1
  152. package/dist/esm/core/approvals.d.ts +11 -2
  153. package/dist/esm/core/approvals.d.ts.map +1 -1
  154. package/dist/esm/core/approvals.js +57 -9
  155. package/dist/esm/core/approvals.js.map +1 -1
  156. package/dist/esm/core/balances.d.ts +12 -0
  157. package/dist/esm/core/balances.d.ts.map +1 -1
  158. package/dist/esm/core/balances.js +35 -0
  159. package/dist/esm/core/balances.js.map +1 -1
  160. package/dist/esm/core/ibc-wrappers.d.ts +2 -1
  161. package/dist/esm/core/ibc-wrappers.d.ts.map +1 -1
  162. package/dist/esm/core/ibc-wrappers.js +22 -2
  163. package/dist/esm/core/ibc-wrappers.js.map +1 -1
  164. package/dist/esm/core/misc.d.ts +38 -2
  165. package/dist/esm/core/misc.d.ts.map +1 -1
  166. package/dist/esm/core/misc.js +114 -3
  167. package/dist/esm/core/misc.js.map +1 -1
  168. package/dist/esm/core/overlaps.d.ts.map +1 -1
  169. package/dist/esm/core/overlaps.js +6 -22
  170. package/dist/esm/core/overlaps.js.map +1 -1
  171. package/dist/esm/core/overlaps.spec.js +131 -0
  172. package/dist/esm/core/overlaps.spec.js.map +1 -1
  173. package/dist/esm/core/transfers.spec.js +267 -0
  174. package/dist/esm/core/transfers.spec.js.map +1 -1
  175. package/dist/esm/index.d.ts +1 -0
  176. package/dist/esm/index.d.ts.map +1 -1
  177. package/dist/esm/index.js +1 -0
  178. package/dist/esm/index.js.map +1 -1
  179. package/dist/esm/interfaces/types/approvals.d.ts +4 -1
  180. package/dist/esm/interfaces/types/approvals.d.ts.map +1 -1
  181. package/dist/esm/interfaces/types/core.d.ts +26 -0
  182. package/dist/esm/interfaces/types/core.d.ts.map +1 -1
  183. package/dist/esm/proto/google/protobuf/descriptor_pb.js +2 -2
  184. package/dist/esm/proto/google/protobuf/descriptor_pb.js.map +1 -1
  185. package/dist/esm/proto/tokenization/approval_criteria_pb.d.ts +4 -1
  186. package/dist/esm/proto/tokenization/approval_criteria_pb.d.ts.map +1 -1
  187. package/dist/esm/proto/tokenization/approval_criteria_pb.js +7 -1
  188. package/dist/esm/proto/tokenization/approval_criteria_pb.js.map +1 -1
  189. package/dist/esm/proto/tokenization/challenges_pb.d.ts +17 -0
  190. package/dist/esm/proto/tokenization/challenges_pb.d.ts.map +1 -1
  191. package/dist/esm/proto/tokenization/challenges_pb.js +36 -0
  192. package/dist/esm/proto/tokenization/challenges_pb.js.map +1 -1
  193. package/dist/esm/proto/tokenization/collections_pb.d.ts +14 -0
  194. package/dist/esm/proto/tokenization/collections_pb.d.ts.map +1 -1
  195. package/dist/esm/proto/tokenization/collections_pb.js +29 -0
  196. package/dist/esm/proto/tokenization/collections_pb.js.map +1 -1
  197. package/dist/esm/proto/tokenization/genesis_pb.d.ts +3 -1
  198. package/dist/esm/proto/tokenization/genesis_pb.d.ts.map +1 -1
  199. package/dist/esm/proto/tokenization/genesis_pb.js +5 -1
  200. package/dist/esm/proto/tokenization/genesis_pb.js.map +1 -1
  201. package/dist/esm/proto/tokenization/icq_pb.d.ts +84 -0
  202. package/dist/esm/proto/tokenization/icq_pb.d.ts.map +1 -0
  203. package/dist/esm/proto/tokenization/icq_pb.js +176 -0
  204. package/dist/esm/proto/tokenization/icq_pb.js.map +1 -0
  205. package/dist/esm/proto/tokenization/packet_pb.d.ts +19 -0
  206. package/dist/esm/proto/tokenization/packet_pb.d.ts.map +1 -1
  207. package/dist/esm/proto/tokenization/packet_pb.js +7 -0
  208. package/dist/esm/proto/tokenization/packet_pb.js.map +1 -1
  209. package/dist/esm/proto/tokenization/query_pb.d.ts +23 -1
  210. package/dist/esm/proto/tokenization/query_pb.d.ts.map +1 -1
  211. package/dist/esm/proto/tokenization/query_pb.js +49 -1
  212. package/dist/esm/proto/tokenization/query_pb.js.map +1 -1
  213. package/dist/esm/proto/tokenization/tx_pb.d.ts +2 -0
  214. package/dist/esm/proto/tokenization/tx_pb.d.ts.map +1 -1
  215. package/dist/esm/proto/tokenization/tx_pb.js +3 -0
  216. package/dist/esm/proto/tokenization/tx_pb.js.map +1 -1
  217. package/dist/esm/signing/BitBadgesSigningClient.d.ts +32 -0
  218. package/dist/esm/signing/BitBadgesSigningClient.d.ts.map +1 -0
  219. package/dist/esm/signing/BitBadgesSigningClient.js +275 -0
  220. package/dist/esm/signing/BitBadgesSigningClient.js.map +1 -0
  221. package/dist/esm/signing/BitBadgesSigningClient.spec.d.ts +2 -0
  222. package/dist/esm/signing/BitBadgesSigningClient.spec.d.ts.map +1 -0
  223. package/dist/esm/signing/BitBadgesSigningClient.spec.js +176 -0
  224. package/dist/esm/signing/BitBadgesSigningClient.spec.js.map +1 -0
  225. package/dist/esm/signing/adapters/GenericCosmosAdapter.d.ts +73 -0
  226. package/dist/esm/signing/adapters/GenericCosmosAdapter.d.ts.map +1 -0
  227. package/dist/esm/signing/adapters/GenericCosmosAdapter.js +162 -0
  228. package/dist/esm/signing/adapters/GenericCosmosAdapter.js.map +1 -0
  229. package/dist/esm/signing/adapters/GenericEvmAdapter.d.ts +37 -0
  230. package/dist/esm/signing/adapters/GenericEvmAdapter.d.ts.map +1 -0
  231. package/dist/esm/signing/adapters/GenericEvmAdapter.js +70 -0
  232. package/dist/esm/signing/adapters/GenericEvmAdapter.js.map +1 -0
  233. package/dist/esm/signing/adapters/WalletAdapter.d.ts +23 -0
  234. package/dist/esm/signing/adapters/WalletAdapter.d.ts.map +1 -0
  235. package/dist/esm/signing/adapters/WalletAdapter.js +12 -0
  236. package/dist/esm/signing/adapters/WalletAdapter.js.map +1 -0
  237. package/dist/esm/signing/adapters/index.d.ts +4 -0
  238. package/dist/esm/signing/adapters/index.d.ts.map +1 -0
  239. package/dist/esm/signing/adapters/index.js +4 -0
  240. package/dist/esm/signing/adapters/index.js.map +1 -0
  241. package/dist/esm/signing/index.d.ts +4 -0
  242. package/dist/esm/signing/index.d.ts.map +1 -0
  243. package/dist/esm/signing/index.js +3 -0
  244. package/dist/esm/signing/index.js.map +1 -0
  245. package/dist/esm/signing/types.d.ts +68 -0
  246. package/dist/esm/signing/types.d.ts.map +1 -0
  247. package/dist/esm/signing/types.js +2 -0
  248. package/dist/esm/signing/types.js.map +1 -0
  249. package/dist/esm/tsconfig-esm.build.tsbuildinfo +1 -1
  250. package/package.json +2 -2
package/README.md CHANGED
@@ -1,70 +1,281 @@
1
- # Overview
1
+ # BitBadges SDK
2
2
 
3
- The BitBadges SDK is a bundle of TypeScript libraries that provide all the tools and functions needed for you to build your own frontend or interact with the BitBadges API, blockchain, and indexer.
3
+ The official TypeScript SDK for interacting with the BitBadges blockchain, API, and indexer.
4
4
 
5
- GitHub: [https://github.com/bitbadges/bitbadgesjs](https://github.com/bitbadges/bitbadgesjs)
5
+ [![npm version](https://badge.fury.io/js/bitbadgesjs-sdk.svg)](https://www.npmjs.com/package/bitbadgesjs-sdk)
6
6
 
7
- Reference repositories that use the SDK:
7
+ ## Installation
8
8
 
9
- - [BitBadges Frontend](https://github.com/BitBadges/bitbadges-frontend)
10
- - [BitBadges Indexer / API](https://github.com/BitBadges/bitbadges-indexer)
9
+ ```bash
10
+ npm install bitbadgesjs-sdk
11
+ # or
12
+ bun add bitbadgesjs-sdk
13
+ ```
11
14
 
12
- See [full documentation](full-documentation.md) for complete documentation on each library. Also, the BitBadges official indexer source code and BitBadges official frontend code both use the SDK, so please feel free to reference them.
15
+ ## Quick Start
13
16
 
14
- ## Version Compatibility
17
+ ### 1. Initialize the API Client
18
+
19
+ ```typescript
20
+ import { BitBadgesAPI, BigIntify } from 'bitbadgesjs-sdk';
15
21
 
16
- This SDK is designed to be compatible with specific BitBadges chain versions. Use the following mapping to ensure compatibility:
22
+ const api = new BitBadgesAPI({
23
+ convertFunction: BigIntify,
24
+ apiKey: 'your-api-key', // Get from https://bitbadges.io/developer
25
+ apiUrl: 'https://api.bitbadges.io' // Optional, defaults to production
26
+ });
27
+ ```
17
28
 
18
- | BitBadges Chain Version | SDK Version Range | Status |
19
- | ----------------------- | ----------------- | ---------- |
20
- | v12 | 0.18.x | ✅ Current |
21
- | v13 | 0.19.x | ✅ Current |
22
- | v14 | 0.20.x | ✅ Current |
23
- | v15 | 0.20.x | ✅ Current |
24
- | v16 | 0.21.x | ✅ Current |
25
- | v18 | 0.23.x | ✅ Current |
26
- | v19 | 0.24.x | ✅ Current |
27
- | v20 | 0.25.x | ✅ Current |
28
- | v21 | 0.26.x | ✅ Current |
29
- | v22 | 0.27.x | ✅ Current |
30
- | v23 | 0.28.x | ✅ Current |
29
+ ### 2. Fetch a Collection
31
30
 
32
- **Recommendation:** Always use the latest patch version within your compatible major.minor version range. For example, if you're using BitBadges v12, use the latest `0.18.x` version.
31
+ ```typescript
32
+ const response = await api.getCollections({
33
+ collectionsToFetch: [
34
+ {
35
+ collectionId: '1',
36
+ metadataToFetch: {
37
+ tokenIds: [{ start: 1n, end: 10n }]
38
+ }
39
+ }
40
+ ]
41
+ });
33
42
 
34
- > 📖 **For detailed version information, see [VERSION_COMPATIBILITY.md](./VERSION_COMPATIBILITY.md)**
43
+ const collection = response.collections[0]?.collection;
44
+ console.log('Name:', collection?.collectionMetadataTimeline?.[0]?.collectionMetadata?.name);
45
+ ```
35
46
 
36
- ### Installation
47
+ ### 3. Check a User's Balance
37
48
 
38
- ```bash
39
- # For specific version
40
- npm install bitbadgesjs-sdk@^0.19.0
49
+ ```typescript
50
+ const balance = await api.getBalanceByAddress(
51
+ '1', // collectionId
52
+ 'bb1abc...', // address
53
+ {}
54
+ );
41
55
 
42
- # For latest version
43
- npm install bitbadgesjs-sdk
56
+ console.log('Token IDs:', balance.balances.map(b => b.badgeIds));
57
+ console.log('Amounts:', balance.balances.map(b => b.amount));
44
58
  ```
45
59
 
46
- This library provides miscellaneous functionality to help you interact with BitBadges, such as types, API routes, managing metadata requests, logic with ID ranges and balances, etc.
60
+ ### 4. Get Token Activity
47
61
 
48
- It also exports functions for broadcasting transactions and interacting with the blockchain. See [Broadcasting Txs](../create-and-broadcast-txs/) for how to use.
62
+ ```typescript
63
+ const activity = await api.getTokenActivity('1', '1', { bookmark: '' });
64
+
65
+ for (const item of activity.activity) {
66
+ console.log(`${item.from} -> ${item.to}: ${item.balances}`);
67
+ }
68
+ ```
69
+
70
+ ## Browser vs Node.js Usage
71
+
72
+ The SDK works in both browser and Node.js environments. Environment detection is handled automatically.
73
+
74
+ ### Node.js
49
75
 
50
76
  ```typescript
51
- // Find a node URL from a network endpoint:
52
- // https://docs.evmos.org/develop/api/networks.
53
- const nodeUrl = ...
54
-
55
- const postOptions = {
56
- method: 'POST',
57
- headers: { 'Content-Type': 'application/json' },
58
- body: generatePostBodyBroadcast(signedTx),
77
+ // API key can be set via environment variable
78
+ process.env.BITBADGES_API_KEY = 'your-api-key';
79
+
80
+ const api = new BitBadgesAPI({
81
+ convertFunction: BigIntify
82
+ // apiKey will be read from BITBADGES_API_KEY env var
83
+ });
84
+ ```
85
+
86
+ ### Browser
87
+
88
+ ```typescript
89
+ // In browsers, you MUST pass the apiKey explicitly
90
+ const api = new BitBadgesAPI({
91
+ convertFunction: BigIntify,
92
+ apiKey: 'your-api-key' // Required in browser - no env var access
93
+ });
94
+ ```
95
+
96
+ > **Note**: The SDK uses defensive checks (`typeof process !== 'undefined'`) to support both environments. No polyfills needed.
97
+
98
+ ## Core Concepts
99
+
100
+ ### Number Types
101
+
102
+ The SDK uses a flexible `NumberType` system supporting `bigint`, `number`, and `string` to handle large blockchain values safely.
103
+
104
+ ```typescript
105
+ import { BigIntify, Stringify, Numberify } from 'bitbadgesjs-sdk';
106
+
107
+ // Always use BigIntify for large numbers (recommended)
108
+ const collectionId = BigIntify('12345678901234567890');
109
+
110
+ // Stringify for JSON serialization
111
+ const idString = Stringify(12345678901234567890n);
112
+
113
+ // Numberify only for small, safe integers
114
+ const smallNum = Numberify('100');
115
+ ```
116
+
117
+ ### Type System
118
+
119
+ The SDK has three type layers:
120
+
121
+ | Type | Example | Use Case |
122
+ |------|---------|----------|
123
+ | **Interface** (`iType`) | `iBalance<bigint>` | Type annotations, function parameters |
124
+ | **Class** | `Balance` | Most SDK operations - has utility methods |
125
+ | **Proto** | `proto.Balance` | Blockchain serialization (strings only) |
126
+
127
+ ```typescript
128
+ import { Balance, UintRange } from 'bitbadgesjs-sdk';
129
+
130
+ // Create instances with classes
131
+ const balance = new Balance({
132
+ amount: 100n,
133
+ badgeIds: [{ start: 1n, end: 10n }],
134
+ ownershipTimes: [{ start: 1n, end: 1000n }]
135
+ });
136
+
137
+ // Convert between number types
138
+ const stringBalance = balance.convert(Stringify);
139
+
140
+ // Convert to proto for blockchain
141
+ const protoBalance = balance.toProto();
142
+ ```
143
+
144
+ ## Common Patterns
145
+
146
+ ### Pagination
147
+
148
+ ```typescript
149
+ let bookmark = '';
150
+ let hasMore = true;
151
+
152
+ while (hasMore) {
153
+ const response = await api.getTokenActivity('1', '1', { bookmark });
154
+
155
+ // Process results
156
+ console.log(response.activity);
157
+
158
+ // Get next page
159
+ hasMore = response.pagination.hasMore;
160
+ bookmark = response.pagination.bookmark;
161
+ }
162
+ ```
163
+
164
+ ### Error Handling
165
+
166
+ ```typescript
167
+ try {
168
+ const response = await api.getCollections({ collectionsToFetch: [{ collectionId: '1' }] });
169
+ } catch (error) {
170
+ if (error.errorMessage) {
171
+ console.error('API Error:', error.errorMessage);
172
+ }
173
+ if (error.unauthorized) {
174
+ console.error('Authentication required');
175
+ }
59
176
  }
177
+ ```
178
+
179
+ ### Address Utilities
180
+
181
+ ```typescript
182
+ import { convertToBitBadgesAddress, isAddressValid } from 'bitbadgesjs-sdk';
183
+
184
+ // Validate a BitBadges address
185
+ const isValid = isAddressValid('bb1abc...');
186
+
187
+ // Convert to BitBadges format (bb-prefixed only)
188
+ const bbAddress = convertToBitBadgesAddress('bb1abc...');
189
+ ```
190
+
191
+ ## Module Structure
192
+
193
+ ```
194
+ bitbadgesjs-sdk/
195
+ ├── core/ # Balance, UintRange, Approvals, Permissions
196
+ ├── api-indexer/ # BitBadgesAPI client and response types
197
+ ├── transactions/ # Message builders (MsgTransferTokens, etc.)
198
+ ├── address-converter/ # Address utilities
199
+ ├── interfaces/ # TypeScript type definitions
200
+ ├── proto/ # Protocol buffer types
201
+ ├── common/ # Number conversion utilities
202
+ └── gamm/ # AMM pool utilities
203
+ ```
60
204
 
61
- const broadcastEndpoint = `${nodeUrl}${generateEndpointBroadcast()}`
62
- const broadcastPost = await fetch(
63
- broadcastEndpoint,
64
- postOptions,
65
- )
205
+ ### Key Exports
66
206
 
67
- const response = await broadcastPost.json()
207
+ ```typescript
208
+ // API Client
209
+ import { BitBadgesAPI } from 'bitbadgesjs-sdk';
210
+
211
+ // Number Conversion
212
+ import { BigIntify, Stringify, Numberify } from 'bitbadgesjs-sdk';
213
+
214
+ // Core Classes
215
+ import { Balance, UintRange, Transfer, CollectionApproval } from 'bitbadgesjs-sdk';
216
+
217
+ // Address Utilities
218
+ import { convertToBitBadgesAddress, isAddressValid } from 'bitbadgesjs-sdk';
219
+
220
+ // Transaction Messages
221
+ import { MsgTransferTokens, MsgCreateCollection } from 'bitbadgesjs-sdk';
222
+ ```
223
+
224
+ ## Version Compatibility
225
+
226
+ | BitBadges Chain | SDK Version | Status |
227
+ |-----------------|-------------|--------|
228
+ | v25 | 0.30.x | Current |
229
+ | v24 | 0.29.x | Supported |
230
+ | v23 | 0.28.x | Supported |
231
+ | v22 | 0.27.x | Supported |
232
+ | v21 | 0.26.x | Supported |
233
+ | v20 | 0.25.x | Supported |
234
+ | v19 | 0.24.x | Supported |
235
+ | v18 | 0.23.x | Supported |
236
+ | v16 | 0.21.x | Supported |
237
+ | v14-15 | 0.20.x | Supported |
238
+ | v13 | 0.19.x | Supported |
239
+ | v12 | 0.18.x | Supported |
240
+
241
+ ```bash
242
+ # Install specific version for your chain
243
+ npm install bitbadgesjs-sdk@^0.30.0
68
244
  ```
69
245
 
70
- For most use cases, you will not need to broadcast transactions. If you do, consider first exploring the helper broadcast tool at [https://bitbadges.io/dev/broadcast](https://bitbadges.io/dev/broadcast).
246
+ ## Troubleshooting
247
+
248
+ ### "BigInt is not defined"
249
+ Ensure you're running Node.js 10.4+ or a modern browser. BigInt is required.
250
+
251
+ ### Precision loss with large numbers
252
+ Always use `BigIntify` instead of `Numberify` for collection IDs and token IDs.
253
+
254
+ ### Browser: "process is not defined"
255
+ This shouldn't occur - the SDK checks for `process` existence. If it does, ensure you're using the latest SDK version.
256
+
257
+ ### API authentication errors
258
+ - Verify your API key at https://bitbadges.io/developer
259
+ - In browsers, pass `apiKey` explicitly (env vars don't work)
260
+ - For authenticated endpoints, use `api.setAccessToken(token)`
261
+
262
+ ### Transaction failures
263
+ 1. Always simulate first: `await api.simulateTx(payload)`
264
+ 2. Verify account has sufficient balance for fees
265
+ 3. Check sequence number is correct
266
+
267
+ ## Additional Resources
268
+
269
+ - **Detailed Patterns & Examples**: See [AI_AGENT_GUIDE.md](./AI_AGENT_GUIDE.md) for comprehensive patterns
270
+ - **API Documentation**: https://docs.bitbadges.io/for-developers/bitbadges-api/api
271
+ - **GitHub**: https://github.com/bitbadges/bitbadgesjs
272
+ - **Broadcast Helper**: https://bitbadges.io/dev/broadcast
273
+
274
+ ### Reference Implementations
275
+
276
+ - [BitBadges Frontend](https://github.com/BitBadges/bitbadges-frontend) - Next.js web app
277
+ - [BitBadges Indexer](https://github.com/BitBadges/bitbadges-indexer) - Express.js API
278
+
279
+ ## License
280
+
281
+ See [LICENSE](./LICENSE) for details.
@@ -6625,8 +6625,8 @@ class BitBadgesAdminAPI extends BitBadgesAPI {
6625
6625
  if (undefined === value)
6626
6626
  return true;
6627
6627
  return "string" === typeof value;
6628
- }); const _io3 = input => "string" === typeof input.type && "string" === typeof input.name && ("string" === typeof input.value || "number" === typeof input.value || "boolean" === typeof input.value); const _io4 = input => "string" === typeof input.name && "string" === typeof input.image && "string" === typeof input.description && (undefined === input.url || "string" === typeof input.url); const _io5 = input => Array.isArray(input.tokenIds) && input.tokenIds.every(elem => "object" === typeof elem && null !== elem && _io6(elem)) && (undefined === input.metadata || "object" === typeof input.metadata && null !== input.metadata && _io1(input.metadata)) && "string" === typeof input.uri && (undefined === input.fetchedUri || "string" === typeof input.fetchedUri) && "string" === typeof input.customData && (undefined === input.toUploadToIpfs || "boolean" === typeof input.toUploadToIpfs); const _io6 = input => ("string" === typeof input.start || "number" === typeof input.start || "bigint" === typeof input.start) && ("string" === typeof input.end || "number" === typeof input.end || "bigint" === typeof input.end); const _io7 = input => (undefined === input.metadata || "object" === typeof input.metadata && null !== input.metadata && _io1(input.metadata)) && "string" === typeof input.uri && (undefined === input.fetchedUri || "string" === typeof input.fetchedUri) && "string" === typeof input.customData && (undefined === input.toUploadToIpfs || "boolean" === typeof input.toUploadToIpfs); const _io8 = input => Array.isArray(input.leaves) && input.leaves.every(elem => "string" === typeof elem) && "boolean" === typeof input.isHashed && (undefined === input.preimages || Array.isArray(input.preimages) && input.preimages.every(elem => "string" === typeof elem)) && (undefined === input.seedCode || "string" === typeof input.seedCode) && (undefined === input.tree || "object" === typeof input.tree && null !== input.tree && false === Array.isArray(input.tree) && _io9(input.tree)) && (undefined === input.treeOptions || "object" === typeof input.treeOptions && null !== input.treeOptions && false === Array.isArray(input.treeOptions) && _io10(input.treeOptions)) && (undefined === input.numLeaves || "string" === typeof input.numLeaves || "number" === typeof input.numLeaves || "bigint" === typeof input.numLeaves) && (undefined === input.currCode || "string" === typeof input.currCode || "number" === typeof input.currCode || "bigint" === typeof input.currCode); const _io9 = input => true; const _io10 = input => (undefined === input.duplicateOdd || "boolean" === typeof input.duplicateOdd) && (undefined === input.hashLeaves || "boolean" === typeof input.hashLeaves) && (undefined === input.isBitcoinTree || "boolean" === typeof input.isBitcoinTree) && (undefined === input.sortLeaves || "boolean" === typeof input.sortLeaves) && (undefined === input.sortPairs || "boolean" === typeof input.sortPairs) && (undefined === input.sort || "boolean" === typeof input.sort) && (null !== input.fillDefaultHash && (undefined === input.fillDefaultHash || "function" === typeof input.fillDefaultHash || "string" === typeof input.fillDefaultHash || "object" === typeof input.fillDefaultHash && null !== input.fillDefaultHash && _io11(input.fillDefaultHash))) && (undefined === input.complete || "boolean" === typeof input.complete) && (undefined === input.concatenator || true); const _io11 = input => "number" === typeof input.BYTES_PER_ELEMENT && (input.buffer instanceof ArrayBuffer || input.buffer instanceof SharedArrayBuffer) && "number" === typeof input.byteLength && "number" === typeof input.byteOffset && "number" === typeof input.length && "Uint8Array" === input["__@toStringTag@82"] && Object.keys(input).every(key => {
6629
- if (["BYTES_PER_ELEMENT", "buffer", "byteLength", "byteOffset", "length", "__@toStringTag@82"].some(prop => key === prop))
6628
+ }); const _io3 = input => "string" === typeof input.type && "string" === typeof input.name && ("string" === typeof input.value || "number" === typeof input.value || "boolean" === typeof input.value); const _io4 = input => "string" === typeof input.name && "string" === typeof input.image && "string" === typeof input.description && (undefined === input.url || "string" === typeof input.url); const _io5 = input => Array.isArray(input.tokenIds) && input.tokenIds.every(elem => "object" === typeof elem && null !== elem && _io6(elem)) && (undefined === input.metadata || "object" === typeof input.metadata && null !== input.metadata && _io1(input.metadata)) && "string" === typeof input.uri && (undefined === input.fetchedUri || "string" === typeof input.fetchedUri) && "string" === typeof input.customData && (undefined === input.toUploadToIpfs || "boolean" === typeof input.toUploadToIpfs); const _io6 = input => ("string" === typeof input.start || "number" === typeof input.start || "bigint" === typeof input.start) && ("string" === typeof input.end || "number" === typeof input.end || "bigint" === typeof input.end); const _io7 = input => (undefined === input.metadata || "object" === typeof input.metadata && null !== input.metadata && _io1(input.metadata)) && "string" === typeof input.uri && (undefined === input.fetchedUri || "string" === typeof input.fetchedUri) && "string" === typeof input.customData && (undefined === input.toUploadToIpfs || "boolean" === typeof input.toUploadToIpfs); const _io8 = input => Array.isArray(input.leaves) && input.leaves.every(elem => "string" === typeof elem) && "boolean" === typeof input.isHashed && (undefined === input.preimages || Array.isArray(input.preimages) && input.preimages.every(elem => "string" === typeof elem)) && (undefined === input.seedCode || "string" === typeof input.seedCode) && (undefined === input.tree || "object" === typeof input.tree && null !== input.tree && false === Array.isArray(input.tree) && _io9(input.tree)) && (undefined === input.treeOptions || "object" === typeof input.treeOptions && null !== input.treeOptions && false === Array.isArray(input.treeOptions) && _io10(input.treeOptions)) && (undefined === input.numLeaves || "string" === typeof input.numLeaves || "number" === typeof input.numLeaves || "bigint" === typeof input.numLeaves) && (undefined === input.currCode || "string" === typeof input.currCode || "number" === typeof input.currCode || "bigint" === typeof input.currCode); const _io9 = input => true; const _io10 = input => (undefined === input.duplicateOdd || "boolean" === typeof input.duplicateOdd) && (undefined === input.hashLeaves || "boolean" === typeof input.hashLeaves) && (undefined === input.isBitcoinTree || "boolean" === typeof input.isBitcoinTree) && (undefined === input.sortLeaves || "boolean" === typeof input.sortLeaves) && (undefined === input.sortPairs || "boolean" === typeof input.sortPairs) && (undefined === input.sort || "boolean" === typeof input.sort) && (null !== input.fillDefaultHash && (undefined === input.fillDefaultHash || "function" === typeof input.fillDefaultHash || "string" === typeof input.fillDefaultHash || "object" === typeof input.fillDefaultHash && null !== input.fillDefaultHash && _io11(input.fillDefaultHash))) && (undefined === input.complete || "boolean" === typeof input.complete) && (undefined === input.concatenator || true); const _io11 = input => "number" === typeof input.BYTES_PER_ELEMENT && (input.buffer instanceof ArrayBuffer || input.buffer instanceof SharedArrayBuffer) && "number" === typeof input.byteLength && "number" === typeof input.byteOffset && "number" === typeof input.length && "Uint8Array" === input["__@toStringTag@81"] && Object.keys(input).every(key => {
6629
+ if (["BYTES_PER_ELEMENT", "buffer", "byteLength", "byteOffset", "length", "__@toStringTag@81"].some(prop => key === prop))
6630
6630
  return true;
6631
6631
  const value = input[key];
6632
6632
  if (undefined === value)
@@ -6980,12 +6980,12 @@ class BitBadgesAdminAPI extends BitBadgesAPI {
6980
6980
  path: _path + ".length",
6981
6981
  expected: "number",
6982
6982
  value: input.length
6983
- }), "Uint8Array" === input["__@toStringTag@82"] || _report(_exceptionable, {
6984
- path: _path + "[\"__@toStringTag@82\"]",
6983
+ }), "Uint8Array" === input["__@toStringTag@81"] || _report(_exceptionable, {
6984
+ path: _path + "[\"__@toStringTag@81\"]",
6985
6985
  expected: "\"Uint8Array\"",
6986
- value: input["__@toStringTag@82"]
6986
+ value: input["__@toStringTag@81"]
6987
6987
  }), false === _exceptionable || Object.keys(input).map(key => {
6988
- if (["BYTES_PER_ELEMENT", "buffer", "byteLength", "byteOffset", "length", "__@toStringTag@82"].some(prop => key === prop))
6988
+ if (["BYTES_PER_ELEMENT", "buffer", "byteLength", "byteOffset", "length", "__@toStringTag@81"].some(prop => key === prop))
6989
6989
  return true;
6990
6990
  const value = input[key];
6991
6991
  if (undefined === value)
@@ -7047,8 +7047,8 @@ class BitBadgesAdminAPI extends BitBadgesAPI {
7047
7047
  }
7048
7048
  async addApprovalDetailsToOffChainStorage(payload) {
7049
7049
  try {
7050
- const validateRes = (() => { const _io0 = input => Array.isArray(input.approvalDetails) && input.approvalDetails.every(elem => "object" === typeof elem && null !== elem && _io1(elem)); const _io1 = input => "string" === typeof input.name && "string" === typeof input.description && "string" === typeof input.image && (undefined === input.challengeInfoDetails || Array.isArray(input.challengeInfoDetails) && input.challengeInfoDetails.every(elem => "object" === typeof elem && null !== elem && _io2(elem))); const _io2 = input => "object" === typeof input.challengeDetails && null !== input.challengeDetails && _io3(input.challengeDetails) && (undefined === input.claim || "object" === typeof input.claim && null !== input.claim && _io7(input.claim)); const _io3 = input => Array.isArray(input.leaves) && input.leaves.every(elem => "string" === typeof elem) && "boolean" === typeof input.isHashed && (undefined === input.preimages || Array.isArray(input.preimages) && input.preimages.every(elem => "string" === typeof elem)) && (undefined === input.seedCode || "string" === typeof input.seedCode) && (undefined === input.tree || "object" === typeof input.tree && null !== input.tree && false === Array.isArray(input.tree) && _io4(input.tree)) && (undefined === input.treeOptions || "object" === typeof input.treeOptions && null !== input.treeOptions && false === Array.isArray(input.treeOptions) && _io5(input.treeOptions)) && (undefined === input.numLeaves || "string" === typeof input.numLeaves || "number" === typeof input.numLeaves || "bigint" === typeof input.numLeaves) && (undefined === input.currCode || "string" === typeof input.currCode || "number" === typeof input.currCode || "bigint" === typeof input.currCode); const _io4 = input => true; const _io5 = input => (undefined === input.duplicateOdd || "boolean" === typeof input.duplicateOdd) && (undefined === input.hashLeaves || "boolean" === typeof input.hashLeaves) && (undefined === input.isBitcoinTree || "boolean" === typeof input.isBitcoinTree) && (undefined === input.sortLeaves || "boolean" === typeof input.sortLeaves) && (undefined === input.sortPairs || "boolean" === typeof input.sortPairs) && (undefined === input.sort || "boolean" === typeof input.sort) && (null !== input.fillDefaultHash && (undefined === input.fillDefaultHash || "function" === typeof input.fillDefaultHash || "string" === typeof input.fillDefaultHash || "object" === typeof input.fillDefaultHash && null !== input.fillDefaultHash && _io6(input.fillDefaultHash))) && (undefined === input.complete || "boolean" === typeof input.complete) && (undefined === input.concatenator || true); const _io6 = input => "number" === typeof input.BYTES_PER_ELEMENT && (input.buffer instanceof ArrayBuffer || input.buffer instanceof SharedArrayBuffer) && "number" === typeof input.byteLength && "number" === typeof input.byteOffset && "number" === typeof input.length && "Uint8Array" === input["__@toStringTag@82"] && Object.keys(input).every(key => {
7051
- if (["BYTES_PER_ELEMENT", "buffer", "byteLength", "byteOffset", "length", "__@toStringTag@82"].some(prop => key === prop))
7050
+ const validateRes = (() => { const _io0 = input => Array.isArray(input.approvalDetails) && input.approvalDetails.every(elem => "object" === typeof elem && null !== elem && _io1(elem)); const _io1 = input => "string" === typeof input.name && "string" === typeof input.description && "string" === typeof input.image && (undefined === input.challengeInfoDetails || Array.isArray(input.challengeInfoDetails) && input.challengeInfoDetails.every(elem => "object" === typeof elem && null !== elem && _io2(elem))); const _io2 = input => "object" === typeof input.challengeDetails && null !== input.challengeDetails && _io3(input.challengeDetails) && (undefined === input.claim || "object" === typeof input.claim && null !== input.claim && _io7(input.claim)); const _io3 = input => Array.isArray(input.leaves) && input.leaves.every(elem => "string" === typeof elem) && "boolean" === typeof input.isHashed && (undefined === input.preimages || Array.isArray(input.preimages) && input.preimages.every(elem => "string" === typeof elem)) && (undefined === input.seedCode || "string" === typeof input.seedCode) && (undefined === input.tree || "object" === typeof input.tree && null !== input.tree && false === Array.isArray(input.tree) && _io4(input.tree)) && (undefined === input.treeOptions || "object" === typeof input.treeOptions && null !== input.treeOptions && false === Array.isArray(input.treeOptions) && _io5(input.treeOptions)) && (undefined === input.numLeaves || "string" === typeof input.numLeaves || "number" === typeof input.numLeaves || "bigint" === typeof input.numLeaves) && (undefined === input.currCode || "string" === typeof input.currCode || "number" === typeof input.currCode || "bigint" === typeof input.currCode); const _io4 = input => true; const _io5 = input => (undefined === input.duplicateOdd || "boolean" === typeof input.duplicateOdd) && (undefined === input.hashLeaves || "boolean" === typeof input.hashLeaves) && (undefined === input.isBitcoinTree || "boolean" === typeof input.isBitcoinTree) && (undefined === input.sortLeaves || "boolean" === typeof input.sortLeaves) && (undefined === input.sortPairs || "boolean" === typeof input.sortPairs) && (undefined === input.sort || "boolean" === typeof input.sort) && (null !== input.fillDefaultHash && (undefined === input.fillDefaultHash || "function" === typeof input.fillDefaultHash || "string" === typeof input.fillDefaultHash || "object" === typeof input.fillDefaultHash && null !== input.fillDefaultHash && _io6(input.fillDefaultHash))) && (undefined === input.complete || "boolean" === typeof input.complete) && (undefined === input.concatenator || true); const _io6 = input => "number" === typeof input.BYTES_PER_ELEMENT && (input.buffer instanceof ArrayBuffer || input.buffer instanceof SharedArrayBuffer) && "number" === typeof input.byteLength && "number" === typeof input.byteOffset && "number" === typeof input.length && "Uint8Array" === input["__@toStringTag@81"] && Object.keys(input).every(key => {
7051
+ if (["BYTES_PER_ELEMENT", "buffer", "byteLength", "byteOffset", "length", "__@toStringTag@81"].some(prop => key === prop))
7052
7052
  return true;
7053
7053
  const value = input[key];
7054
7054
  if (undefined === value)
@@ -7251,12 +7251,12 @@ class BitBadgesAdminAPI extends BitBadgesAPI {
7251
7251
  path: _path + ".length",
7252
7252
  expected: "number",
7253
7253
  value: input.length
7254
- }), "Uint8Array" === input["__@toStringTag@82"] || _report(_exceptionable, {
7255
- path: _path + "[\"__@toStringTag@82\"]",
7254
+ }), "Uint8Array" === input["__@toStringTag@81"] || _report(_exceptionable, {
7255
+ path: _path + "[\"__@toStringTag@81\"]",
7256
7256
  expected: "\"Uint8Array\"",
7257
- value: input["__@toStringTag@82"]
7257
+ value: input["__@toStringTag@81"]
7258
7258
  }), false === _exceptionable || Object.keys(input).map(key => {
7259
- if (["BYTES_PER_ELEMENT", "buffer", "byteLength", "byteOffset", "length", "__@toStringTag@82"].some(prop => key === prop))
7259
+ if (["BYTES_PER_ELEMENT", "buffer", "byteLength", "byteOffset", "length", "__@toStringTag@81"].some(prop => key === prop))
7260
7260
  return true;
7261
7261
  const value = input[key];
7262
7262
  if (undefined === value)
@@ -8200,7 +8200,7 @@ class BitBadgesAdminAPI extends BitBadgesAPI {
8200
8200
  }
8201
8201
  async updateAccountInfo(payload) {
8202
8202
  try {
8203
- const validateRes = (() => { const _io0 = input => (undefined === input.discord || "string" === typeof input.discord) && (undefined === input.twitter || "string" === typeof input.twitter) && (undefined === input.github || "string" === typeof input.github) && (undefined === input.telegram || "string" === typeof input.telegram) && (undefined === input.bluesky || "string" === typeof input.bluesky) && (undefined === input.affiliateCode || "string" === typeof input.affiliateCode) && (undefined === input.seenActivity || "string" === typeof input.seenActivity || "number" === typeof input.seenActivity || "bigint" === typeof input.seenActivity) && (undefined === input.readme || "string" === typeof input.readme) && (undefined === input.hiddenTokens || Array.isArray(input.hiddenTokens) && input.hiddenTokens.every(elem => "object" === typeof elem && null !== elem && _io1(elem))) && (undefined === input.profilePicUrl || "string" === typeof input.profilePicUrl) && (undefined === input.bannerImage || "string" === typeof input.bannerImage) && (undefined === input.username || "string" === typeof input.username) && true && (undefined === input.notifications || "object" === typeof input.notifications && null !== input.notifications && false === Array.isArray(input.notifications) && _io3(input.notifications)) && (undefined === input.socialConnections || "object" === typeof input.socialConnections && null !== input.socialConnections && false === Array.isArray(input.socialConnections) && _io6(input.socialConnections)) && (undefined === input.publicSocialConnectionsToSet || Array.isArray(input.publicSocialConnectionsToSet) && input.publicSocialConnectionsToSet.every(elem => "object" === typeof elem && null !== elem && _io25(elem))); const _io1 = input => "string" === typeof input.collectionId && (Array.isArray(input.tokenIds) && input.tokenIds.every(elem => "object" === typeof elem && null !== elem && _io2(elem))); const _io2 = input => ("string" === typeof input.start || "number" === typeof input.start || "bigint" === typeof input.start) && ("string" === typeof input.end || "number" === typeof input.end || "bigint" === typeof input.end); const _io3 = input => (undefined === input.email || "string" === typeof input.email) && (undefined === input.discord || "object" === typeof input.discord && null !== input.discord && _io4(input.discord)) && (undefined === input.antiPhishingCode || "string" === typeof input.antiPhishingCode) && (undefined === input.preferences || "object" === typeof input.preferences && null !== input.preferences && false === Array.isArray(input.preferences) && _io5(input.preferences)); const _io4 = input => "string" === typeof input.id && "string" === typeof input.username && (undefined === input.discriminator || "string" === typeof input.discriminator); const _io5 = input => (undefined === input.transferActivity || "boolean" === typeof input.transferActivity) && (undefined === input.ignoreIfInitiator || "boolean" === typeof input.ignoreIfInitiator) && (undefined === input.signInAlertsEnabled || "boolean" === typeof input.signInAlertsEnabled); const _io6 = input => (undefined === input.discord || "object" === typeof input.discord && null !== input.discord && _io7(input.discord)) && (undefined === input.twitter || "object" === typeof input.twitter && null !== input.twitter && _io8(input.twitter)) && (undefined === input.google || "object" === typeof input.google && null !== input.google && _io9(input.google)) && (undefined === input.github || "object" === typeof input.github && null !== input.github && _io10(input.github)) && (undefined === input.twitch || "object" === typeof input.twitch && null !== input.twitch && _io11(input.twitch)) && (undefined === input.strava || "object" === typeof input.strava && null !== input.strava && _io12(input.strava)) && (undefined === input.reddit || "object" === typeof input.reddit && null !== input.reddit && _io13(input.reddit)) && (undefined === input.meetup || "object" === typeof input.meetup && null !== input.meetup && _io14(input.meetup)) && (undefined === input.bluesky || "object" === typeof input.bluesky && null !== input.bluesky && _io15(input.bluesky)) && (undefined === input.mailchimp || "object" === typeof input.mailchimp && null !== input.mailchimp && _io16(input.mailchimp)) && (undefined === input.facebook || "object" === typeof input.facebook && null !== input.facebook && _io17(input.facebook)) && (undefined === input.googleCalendar || "object" === typeof input.googleCalendar && null !== input.googleCalendar && _io18(input.googleCalendar)) && (undefined === input.youtube || "object" === typeof input.youtube && null !== input.youtube && _io19(input.youtube)) && (undefined === input.linkedIn || "object" === typeof input.linkedIn && null !== input.linkedIn && _io20(input.linkedIn)) && (undefined === input.shopify || "object" === typeof input.shopify && null !== input.shopify && _io21(input.shopify)) && (undefined === input.telegram || "object" === typeof input.telegram && null !== input.telegram && _io22(input.telegram)) && (undefined === input.farcaster || "object" === typeof input.farcaster && null !== input.farcaster && _io23(input.farcaster)) && (undefined === input.slack || "object" === typeof input.slack && null !== input.slack && _io24(input.slack)); const _io7 = input => "string" === typeof input.username && "string" === typeof input.id && (undefined === input.discriminator || "string" === typeof input.discriminator) && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io8 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io9 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io10 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io11 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io12 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io13 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io14 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io15 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io16 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io17 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io18 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io19 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io20 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io21 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io22 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io23 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io24 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io25 = input => "string" === typeof input.appName && (undefined === input.toDelete || "boolean" === typeof input.toDelete); const _vo0 = (input, _path, _exceptionable = true) => [undefined === input.discord || "string" === typeof input.discord || _report(_exceptionable, {
8203
+ const validateRes = (() => { const _io0 = input => (undefined === input.discord || "string" === typeof input.discord) && (undefined === input.twitter || "string" === typeof input.twitter) && (undefined === input.github || "string" === typeof input.github) && (undefined === input.telegram || "string" === typeof input.telegram) && (undefined === input.bluesky || "string" === typeof input.bluesky) && (undefined === input.seenActivity || "string" === typeof input.seenActivity || "number" === typeof input.seenActivity || "bigint" === typeof input.seenActivity) && (undefined === input.readme || "string" === typeof input.readme) && (undefined === input.hiddenTokens || Array.isArray(input.hiddenTokens) && input.hiddenTokens.every(elem => "object" === typeof elem && null !== elem && _io1(elem))) && (undefined === input.profilePicUrl || "string" === typeof input.profilePicUrl) && (undefined === input.bannerImage || "string" === typeof input.bannerImage) && (undefined === input.username || "string" === typeof input.username) && true && (undefined === input.notifications || "object" === typeof input.notifications && null !== input.notifications && false === Array.isArray(input.notifications) && _io3(input.notifications)) && (undefined === input.socialConnections || "object" === typeof input.socialConnections && null !== input.socialConnections && false === Array.isArray(input.socialConnections) && _io6(input.socialConnections)) && (undefined === input.publicSocialConnectionsToSet || Array.isArray(input.publicSocialConnectionsToSet) && input.publicSocialConnectionsToSet.every(elem => "object" === typeof elem && null !== elem && _io25(elem))); const _io1 = input => "string" === typeof input.collectionId && (Array.isArray(input.tokenIds) && input.tokenIds.every(elem => "object" === typeof elem && null !== elem && _io2(elem))); const _io2 = input => ("string" === typeof input.start || "number" === typeof input.start || "bigint" === typeof input.start) && ("string" === typeof input.end || "number" === typeof input.end || "bigint" === typeof input.end); const _io3 = input => (undefined === input.email || "string" === typeof input.email) && (undefined === input.discord || "object" === typeof input.discord && null !== input.discord && _io4(input.discord)) && (undefined === input.antiPhishingCode || "string" === typeof input.antiPhishingCode) && (undefined === input.preferences || "object" === typeof input.preferences && null !== input.preferences && false === Array.isArray(input.preferences) && _io5(input.preferences)); const _io4 = input => "string" === typeof input.id && "string" === typeof input.username && (undefined === input.discriminator || "string" === typeof input.discriminator); const _io5 = input => (undefined === input.transferActivity || "boolean" === typeof input.transferActivity) && (undefined === input.ignoreIfInitiator || "boolean" === typeof input.ignoreIfInitiator) && (undefined === input.signInAlertsEnabled || "boolean" === typeof input.signInAlertsEnabled); const _io6 = input => (undefined === input.discord || "object" === typeof input.discord && null !== input.discord && _io7(input.discord)) && (undefined === input.twitter || "object" === typeof input.twitter && null !== input.twitter && _io8(input.twitter)) && (undefined === input.google || "object" === typeof input.google && null !== input.google && _io9(input.google)) && (undefined === input.github || "object" === typeof input.github && null !== input.github && _io10(input.github)) && (undefined === input.twitch || "object" === typeof input.twitch && null !== input.twitch && _io11(input.twitch)) && (undefined === input.strava || "object" === typeof input.strava && null !== input.strava && _io12(input.strava)) && (undefined === input.reddit || "object" === typeof input.reddit && null !== input.reddit && _io13(input.reddit)) && (undefined === input.meetup || "object" === typeof input.meetup && null !== input.meetup && _io14(input.meetup)) && (undefined === input.bluesky || "object" === typeof input.bluesky && null !== input.bluesky && _io15(input.bluesky)) && (undefined === input.mailchimp || "object" === typeof input.mailchimp && null !== input.mailchimp && _io16(input.mailchimp)) && (undefined === input.facebook || "object" === typeof input.facebook && null !== input.facebook && _io17(input.facebook)) && (undefined === input.googleCalendar || "object" === typeof input.googleCalendar && null !== input.googleCalendar && _io18(input.googleCalendar)) && (undefined === input.youtube || "object" === typeof input.youtube && null !== input.youtube && _io19(input.youtube)) && (undefined === input.linkedIn || "object" === typeof input.linkedIn && null !== input.linkedIn && _io20(input.linkedIn)) && (undefined === input.shopify || "object" === typeof input.shopify && null !== input.shopify && _io21(input.shopify)) && (undefined === input.telegram || "object" === typeof input.telegram && null !== input.telegram && _io22(input.telegram)) && (undefined === input.farcaster || "object" === typeof input.farcaster && null !== input.farcaster && _io23(input.farcaster)) && (undefined === input.slack || "object" === typeof input.slack && null !== input.slack && _io24(input.slack)); const _io7 = input => "string" === typeof input.username && "string" === typeof input.id && (undefined === input.discriminator || "string" === typeof input.discriminator) && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io8 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io9 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io10 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io11 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io12 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io13 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io14 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io15 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io16 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io17 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io18 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io19 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io20 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io21 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io22 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io23 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io24 = input => "string" === typeof input.username && "string" === typeof input.id && ("string" === typeof input.lastUpdated || "number" === typeof input.lastUpdated || "bigint" === typeof input.lastUpdated); const _io25 = input => "string" === typeof input.appName && (undefined === input.toDelete || "boolean" === typeof input.toDelete); const _vo0 = (input, _path, _exceptionable = true) => [undefined === input.discord || "string" === typeof input.discord || _report(_exceptionable, {
8204
8204
  path: _path + ".discord",
8205
8205
  expected: "(string | undefined)",
8206
8206
  value: input.discord
@@ -8220,10 +8220,6 @@ class BitBadgesAdminAPI extends BitBadgesAPI {
8220
8220
  path: _path + ".bluesky",
8221
8221
  expected: "(string | undefined)",
8222
8222
  value: input.bluesky
8223
- }), undefined === input.affiliateCode || "string" === typeof input.affiliateCode || _report(_exceptionable, {
8224
- path: _path + ".affiliateCode",
8225
- expected: "(string | undefined)",
8226
- value: input.affiliateCode
8227
8223
  }), undefined === input.seenActivity || "string" === typeof input.seenActivity || "number" === typeof input.seenActivity || "bigint" === typeof input.seenActivity || _report(_exceptionable, {
8228
8224
  path: _path + ".seenActivity",
8229
8225
  expected: "(bigint | number | string | undefined)",