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.
- package/README.md +258 -47
- package/dist/cjs/api-indexer/BitBadgesApi.js +13 -17
- package/dist/cjs/api-indexer/BitBadgesApi.js.map +1 -1
- package/dist/cjs/api-indexer/BitBadgesCollection.d.ts +4 -2
- package/dist/cjs/api-indexer/BitBadgesCollection.d.ts.map +1 -1
- package/dist/cjs/api-indexer/BitBadgesCollection.js +1 -0
- package/dist/cjs/api-indexer/BitBadgesCollection.js.map +1 -1
- package/dist/cjs/api-indexer/base.d.ts +2 -1
- package/dist/cjs/api-indexer/base.d.ts.map +1 -1
- package/dist/cjs/api-indexer/base.js +4 -12
- package/dist/cjs/api-indexer/base.js.map +1 -1
- package/dist/cjs/api-indexer/docs-types/docs.d.ts +0 -1
- package/dist/cjs/api-indexer/docs-types/docs.d.ts.map +1 -1
- package/dist/cjs/api-indexer/docs-types/docs.js +0 -1
- package/dist/cjs/api-indexer/docs-types/docs.js.map +1 -1
- package/dist/cjs/api-indexer/docs-types/interfaces.d.ts +0 -1
- package/dist/cjs/api-indexer/docs-types/interfaces.d.ts.map +1 -1
- package/dist/cjs/api-indexer/docs-types/interfaces.js.map +1 -1
- package/dist/cjs/api-indexer/metadata/tokenMetadata.d.ts +4 -4
- package/dist/cjs/api-indexer/metadata/tokenMetadata.d.ts.map +1 -1
- package/dist/cjs/api-indexer/requests/requests.d.ts +0 -2
- package/dist/cjs/api-indexer/requests/requests.d.ts.map +1 -1
- package/dist/cjs/api-indexer/requests/requests.js.map +1 -1
- package/dist/cjs/core/addressLists.d.ts +3 -0
- package/dist/cjs/core/addressLists.d.ts.map +1 -1
- package/dist/cjs/core/addressLists.js +39 -0
- package/dist/cjs/core/addressLists.js.map +1 -1
- package/dist/cjs/core/approvals.d.ts +11 -2
- package/dist/cjs/core/approvals.d.ts.map +1 -1
- package/dist/cjs/core/approvals.js +50 -8
- package/dist/cjs/core/approvals.js.map +1 -1
- package/dist/cjs/core/balances.d.ts +12 -0
- package/dist/cjs/core/balances.d.ts.map +1 -1
- package/dist/cjs/core/balances.js +37 -1
- package/dist/cjs/core/balances.js.map +1 -1
- package/dist/cjs/core/ibc-wrappers.d.ts +2 -1
- package/dist/cjs/core/ibc-wrappers.d.ts.map +1 -1
- package/dist/cjs/core/ibc-wrappers.js +21 -2
- package/dist/cjs/core/ibc-wrappers.js.map +1 -1
- package/dist/cjs/core/misc.d.ts +38 -2
- package/dist/cjs/core/misc.d.ts.map +1 -1
- package/dist/cjs/core/misc.js +107 -4
- package/dist/cjs/core/misc.js.map +1 -1
- package/dist/cjs/core/overlaps.d.ts.map +1 -1
- package/dist/cjs/core/overlaps.js +6 -22
- package/dist/cjs/core/overlaps.js.map +1 -1
- package/dist/cjs/core/overlaps.spec.js +131 -0
- package/dist/cjs/core/overlaps.spec.js.map +1 -1
- package/dist/cjs/core/transfers.spec.js +267 -0
- package/dist/cjs/core/transfers.spec.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/interfaces/types/approvals.d.ts +4 -1
- package/dist/cjs/interfaces/types/approvals.d.ts.map +1 -1
- package/dist/cjs/interfaces/types/core.d.ts +26 -0
- package/dist/cjs/interfaces/types/core.d.ts.map +1 -1
- package/dist/cjs/proto/google/protobuf/descriptor_pb.js +2 -2
- package/dist/cjs/proto/google/protobuf/descriptor_pb.js.map +1 -1
- package/dist/cjs/proto/tokenization/approval_criteria_pb.d.ts +4 -1
- package/dist/cjs/proto/tokenization/approval_criteria_pb.d.ts.map +1 -1
- package/dist/cjs/proto/tokenization/approval_criteria_pb.js +6 -0
- package/dist/cjs/proto/tokenization/approval_criteria_pb.js.map +1 -1
- package/dist/cjs/proto/tokenization/challenges_pb.d.ts +17 -0
- package/dist/cjs/proto/tokenization/challenges_pb.d.ts.map +1 -1
- package/dist/cjs/proto/tokenization/challenges_pb.js +38 -1
- package/dist/cjs/proto/tokenization/challenges_pb.js.map +1 -1
- package/dist/cjs/proto/tokenization/collections_pb.d.ts +14 -0
- package/dist/cjs/proto/tokenization/collections_pb.d.ts.map +1 -1
- package/dist/cjs/proto/tokenization/collections_pb.js +31 -1
- package/dist/cjs/proto/tokenization/collections_pb.js.map +1 -1
- package/dist/cjs/proto/tokenization/genesis_pb.d.ts +3 -1
- package/dist/cjs/proto/tokenization/genesis_pb.d.ts.map +1 -1
- package/dist/cjs/proto/tokenization/genesis_pb.js +4 -0
- package/dist/cjs/proto/tokenization/genesis_pb.js.map +1 -1
- package/dist/cjs/proto/tokenization/icq_pb.d.ts +84 -0
- package/dist/cjs/proto/tokenization/icq_pb.d.ts.map +1 -0
- package/dist/cjs/proto/tokenization/icq_pb.js +185 -0
- package/dist/cjs/proto/tokenization/icq_pb.js.map +1 -0
- package/dist/cjs/proto/tokenization/packet_pb.d.ts +19 -0
- package/dist/cjs/proto/tokenization/packet_pb.d.ts.map +1 -1
- package/dist/cjs/proto/tokenization/packet_pb.js +7 -0
- package/dist/cjs/proto/tokenization/packet_pb.js.map +1 -1
- package/dist/cjs/proto/tokenization/query_pb.d.ts +23 -1
- package/dist/cjs/proto/tokenization/query_pb.d.ts.map +1 -1
- package/dist/cjs/proto/tokenization/query_pb.js +50 -1
- package/dist/cjs/proto/tokenization/query_pb.js.map +1 -1
- package/dist/cjs/proto/tokenization/tx_pb.d.ts +2 -0
- package/dist/cjs/proto/tokenization/tx_pb.d.ts.map +1 -1
- package/dist/cjs/proto/tokenization/tx_pb.js +3 -0
- package/dist/cjs/proto/tokenization/tx_pb.js.map +1 -1
- package/dist/cjs/signing/BitBadgesSigningClient.d.ts +32 -0
- package/dist/cjs/signing/BitBadgesSigningClient.d.ts.map +1 -0
- package/dist/cjs/signing/BitBadgesSigningClient.js +270 -0
- package/dist/cjs/signing/BitBadgesSigningClient.js.map +1 -0
- package/dist/cjs/signing/BitBadgesSigningClient.spec.d.ts +2 -0
- package/dist/cjs/signing/BitBadgesSigningClient.spec.d.ts.map +1 -0
- package/dist/cjs/signing/BitBadgesSigningClient.spec.js +182 -0
- package/dist/cjs/signing/BitBadgesSigningClient.spec.js.map +1 -0
- package/dist/cjs/signing/adapters/GenericCosmosAdapter.d.ts +73 -0
- package/dist/cjs/signing/adapters/GenericCosmosAdapter.d.ts.map +1 -0
- package/dist/cjs/signing/adapters/GenericCosmosAdapter.js +189 -0
- package/dist/cjs/signing/adapters/GenericCosmosAdapter.js.map +1 -0
- package/dist/cjs/signing/adapters/GenericEvmAdapter.d.ts +37 -0
- package/dist/cjs/signing/adapters/GenericEvmAdapter.d.ts.map +1 -0
- package/dist/cjs/signing/adapters/GenericEvmAdapter.js +71 -0
- package/dist/cjs/signing/adapters/GenericEvmAdapter.js.map +1 -0
- package/dist/cjs/signing/adapters/WalletAdapter.d.ts +23 -0
- package/dist/cjs/signing/adapters/WalletAdapter.d.ts.map +1 -0
- package/dist/cjs/signing/adapters/WalletAdapter.js +16 -0
- package/dist/cjs/signing/adapters/WalletAdapter.js.map +1 -0
- package/dist/cjs/signing/adapters/index.d.ts +4 -0
- package/dist/cjs/signing/adapters/index.d.ts.map +1 -0
- package/dist/cjs/signing/adapters/index.js +10 -0
- package/dist/cjs/signing/adapters/index.js.map +1 -0
- package/dist/cjs/signing/index.d.ts +4 -0
- package/dist/cjs/signing/index.d.ts.map +1 -0
- package/dist/cjs/signing/index.js +10 -0
- package/dist/cjs/signing/index.js.map +1 -0
- package/dist/cjs/signing/types.d.ts +68 -0
- package/dist/cjs/signing/types.d.ts.map +1 -0
- package/dist/cjs/signing/types.js +3 -0
- package/dist/cjs/signing/types.js.map +1 -0
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/api-indexer/BitBadgesApi.js +13 -17
- package/dist/esm/api-indexer/BitBadgesApi.js.map +1 -1
- package/dist/esm/api-indexer/BitBadgesCollection.d.ts +4 -2
- package/dist/esm/api-indexer/BitBadgesCollection.d.ts.map +1 -1
- package/dist/esm/api-indexer/BitBadgesCollection.js +3 -1
- package/dist/esm/api-indexer/BitBadgesCollection.js.map +1 -1
- package/dist/esm/api-indexer/base.d.ts +2 -1
- package/dist/esm/api-indexer/base.d.ts.map +1 -1
- package/dist/esm/api-indexer/base.js +7 -12
- package/dist/esm/api-indexer/base.js.map +1 -1
- package/dist/esm/api-indexer/docs-types/docs.d.ts +0 -1
- package/dist/esm/api-indexer/docs-types/docs.d.ts.map +1 -1
- package/dist/esm/api-indexer/docs-types/docs.js +0 -2
- package/dist/esm/api-indexer/docs-types/docs.js.map +1 -1
- package/dist/esm/api-indexer/docs-types/interfaces.d.ts +0 -1
- package/dist/esm/api-indexer/docs-types/interfaces.d.ts.map +1 -1
- package/dist/esm/api-indexer/docs-types/interfaces.js.map +1 -1
- package/dist/esm/api-indexer/metadata/tokenMetadata.d.ts +4 -4
- package/dist/esm/api-indexer/metadata/tokenMetadata.d.ts.map +1 -1
- package/dist/esm/api-indexer/requests/requests.d.ts +0 -2
- package/dist/esm/api-indexer/requests/requests.d.ts.map +1 -1
- package/dist/esm/api-indexer/requests/requests.js.map +1 -1
- package/dist/esm/core/addressLists.d.ts +3 -0
- package/dist/esm/core/addressLists.d.ts.map +1 -1
- package/dist/esm/core/addressLists.js +39 -0
- package/dist/esm/core/addressLists.js.map +1 -1
- package/dist/esm/core/approvals.d.ts +11 -2
- package/dist/esm/core/approvals.d.ts.map +1 -1
- package/dist/esm/core/approvals.js +57 -9
- package/dist/esm/core/approvals.js.map +1 -1
- package/dist/esm/core/balances.d.ts +12 -0
- package/dist/esm/core/balances.d.ts.map +1 -1
- package/dist/esm/core/balances.js +35 -0
- package/dist/esm/core/balances.js.map +1 -1
- package/dist/esm/core/ibc-wrappers.d.ts +2 -1
- package/dist/esm/core/ibc-wrappers.d.ts.map +1 -1
- package/dist/esm/core/ibc-wrappers.js +22 -2
- package/dist/esm/core/ibc-wrappers.js.map +1 -1
- package/dist/esm/core/misc.d.ts +38 -2
- package/dist/esm/core/misc.d.ts.map +1 -1
- package/dist/esm/core/misc.js +114 -3
- package/dist/esm/core/misc.js.map +1 -1
- package/dist/esm/core/overlaps.d.ts.map +1 -1
- package/dist/esm/core/overlaps.js +6 -22
- package/dist/esm/core/overlaps.js.map +1 -1
- package/dist/esm/core/overlaps.spec.js +131 -0
- package/dist/esm/core/overlaps.spec.js.map +1 -1
- package/dist/esm/core/transfers.spec.js +267 -0
- package/dist/esm/core/transfers.spec.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interfaces/types/approvals.d.ts +4 -1
- package/dist/esm/interfaces/types/approvals.d.ts.map +1 -1
- package/dist/esm/interfaces/types/core.d.ts +26 -0
- package/dist/esm/interfaces/types/core.d.ts.map +1 -1
- package/dist/esm/proto/google/protobuf/descriptor_pb.js +2 -2
- package/dist/esm/proto/google/protobuf/descriptor_pb.js.map +1 -1
- package/dist/esm/proto/tokenization/approval_criteria_pb.d.ts +4 -1
- package/dist/esm/proto/tokenization/approval_criteria_pb.d.ts.map +1 -1
- package/dist/esm/proto/tokenization/approval_criteria_pb.js +7 -1
- package/dist/esm/proto/tokenization/approval_criteria_pb.js.map +1 -1
- package/dist/esm/proto/tokenization/challenges_pb.d.ts +17 -0
- package/dist/esm/proto/tokenization/challenges_pb.d.ts.map +1 -1
- package/dist/esm/proto/tokenization/challenges_pb.js +36 -0
- package/dist/esm/proto/tokenization/challenges_pb.js.map +1 -1
- package/dist/esm/proto/tokenization/collections_pb.d.ts +14 -0
- package/dist/esm/proto/tokenization/collections_pb.d.ts.map +1 -1
- package/dist/esm/proto/tokenization/collections_pb.js +29 -0
- package/dist/esm/proto/tokenization/collections_pb.js.map +1 -1
- package/dist/esm/proto/tokenization/genesis_pb.d.ts +3 -1
- package/dist/esm/proto/tokenization/genesis_pb.d.ts.map +1 -1
- package/dist/esm/proto/tokenization/genesis_pb.js +5 -1
- package/dist/esm/proto/tokenization/genesis_pb.js.map +1 -1
- package/dist/esm/proto/tokenization/icq_pb.d.ts +84 -0
- package/dist/esm/proto/tokenization/icq_pb.d.ts.map +1 -0
- package/dist/esm/proto/tokenization/icq_pb.js +176 -0
- package/dist/esm/proto/tokenization/icq_pb.js.map +1 -0
- package/dist/esm/proto/tokenization/packet_pb.d.ts +19 -0
- package/dist/esm/proto/tokenization/packet_pb.d.ts.map +1 -1
- package/dist/esm/proto/tokenization/packet_pb.js +7 -0
- package/dist/esm/proto/tokenization/packet_pb.js.map +1 -1
- package/dist/esm/proto/tokenization/query_pb.d.ts +23 -1
- package/dist/esm/proto/tokenization/query_pb.d.ts.map +1 -1
- package/dist/esm/proto/tokenization/query_pb.js +49 -1
- package/dist/esm/proto/tokenization/query_pb.js.map +1 -1
- package/dist/esm/proto/tokenization/tx_pb.d.ts +2 -0
- package/dist/esm/proto/tokenization/tx_pb.d.ts.map +1 -1
- package/dist/esm/proto/tokenization/tx_pb.js +3 -0
- package/dist/esm/proto/tokenization/tx_pb.js.map +1 -1
- package/dist/esm/signing/BitBadgesSigningClient.d.ts +32 -0
- package/dist/esm/signing/BitBadgesSigningClient.d.ts.map +1 -0
- package/dist/esm/signing/BitBadgesSigningClient.js +275 -0
- package/dist/esm/signing/BitBadgesSigningClient.js.map +1 -0
- package/dist/esm/signing/BitBadgesSigningClient.spec.d.ts +2 -0
- package/dist/esm/signing/BitBadgesSigningClient.spec.d.ts.map +1 -0
- package/dist/esm/signing/BitBadgesSigningClient.spec.js +176 -0
- package/dist/esm/signing/BitBadgesSigningClient.spec.js.map +1 -0
- package/dist/esm/signing/adapters/GenericCosmosAdapter.d.ts +73 -0
- package/dist/esm/signing/adapters/GenericCosmosAdapter.d.ts.map +1 -0
- package/dist/esm/signing/adapters/GenericCosmosAdapter.js +162 -0
- package/dist/esm/signing/adapters/GenericCosmosAdapter.js.map +1 -0
- package/dist/esm/signing/adapters/GenericEvmAdapter.d.ts +37 -0
- package/dist/esm/signing/adapters/GenericEvmAdapter.d.ts.map +1 -0
- package/dist/esm/signing/adapters/GenericEvmAdapter.js +70 -0
- package/dist/esm/signing/adapters/GenericEvmAdapter.js.map +1 -0
- package/dist/esm/signing/adapters/WalletAdapter.d.ts +23 -0
- package/dist/esm/signing/adapters/WalletAdapter.d.ts.map +1 -0
- package/dist/esm/signing/adapters/WalletAdapter.js +12 -0
- package/dist/esm/signing/adapters/WalletAdapter.js.map +1 -0
- package/dist/esm/signing/adapters/index.d.ts +4 -0
- package/dist/esm/signing/adapters/index.d.ts.map +1 -0
- package/dist/esm/signing/adapters/index.js +4 -0
- package/dist/esm/signing/adapters/index.js.map +1 -0
- package/dist/esm/signing/index.d.ts +4 -0
- package/dist/esm/signing/index.d.ts.map +1 -0
- package/dist/esm/signing/index.js +3 -0
- package/dist/esm/signing/index.js.map +1 -0
- package/dist/esm/signing/types.d.ts +68 -0
- package/dist/esm/signing/types.d.ts.map +1 -0
- package/dist/esm/signing/types.js +2 -0
- package/dist/esm/signing/types.js.map +1 -0
- package/dist/esm/tsconfig-esm.build.tsbuildinfo +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,70 +1,281 @@
|
|
|
1
|
-
#
|
|
1
|
+
# BitBadges SDK
|
|
2
2
|
|
|
3
|
-
The
|
|
3
|
+
The official TypeScript SDK for interacting with the BitBadges blockchain, API, and indexer.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/bitbadgesjs-sdk)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Installation
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
```bash
|
|
10
|
+
npm install bitbadgesjs-sdk
|
|
11
|
+
# or
|
|
12
|
+
bun add bitbadgesjs-sdk
|
|
13
|
+
```
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
## Quick Start
|
|
13
16
|
|
|
14
|
-
|
|
17
|
+
### 1. Initialize the API Client
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { BitBadgesAPI, BigIntify } from 'bitbadgesjs-sdk';
|
|
15
21
|
|
|
16
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
43
|
+
const collection = response.collections[0]?.collection;
|
|
44
|
+
console.log('Name:', collection?.collectionMetadataTimeline?.[0]?.collectionMetadata?.name);
|
|
45
|
+
```
|
|
35
46
|
|
|
36
|
-
###
|
|
47
|
+
### 3. Check a User's Balance
|
|
37
48
|
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
|
|
49
|
+
```typescript
|
|
50
|
+
const balance = await api.getBalanceByAddress(
|
|
51
|
+
'1', // collectionId
|
|
52
|
+
'bb1abc...', // address
|
|
53
|
+
{}
|
|
54
|
+
);
|
|
41
55
|
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
60
|
+
### 4. Get Token Activity
|
|
47
61
|
|
|
48
|
-
|
|
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
|
-
//
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
62
|
-
const broadcastPost = await fetch(
|
|
63
|
-
broadcastEndpoint,
|
|
64
|
-
postOptions,
|
|
65
|
-
)
|
|
205
|
+
### Key Exports
|
|
66
206
|
|
|
67
|
-
|
|
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
|
-
|
|
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@
|
|
6629
|
-
if (["BYTES_PER_ELEMENT", "buffer", "byteLength", "byteOffset", "length", "__@toStringTag@
|
|
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@
|
|
6984
|
-
path: _path + "[\"__@toStringTag@
|
|
6983
|
+
}), "Uint8Array" === input["__@toStringTag@81"] || _report(_exceptionable, {
|
|
6984
|
+
path: _path + "[\"__@toStringTag@81\"]",
|
|
6985
6985
|
expected: "\"Uint8Array\"",
|
|
6986
|
-
value: input["__@toStringTag@
|
|
6986
|
+
value: input["__@toStringTag@81"]
|
|
6987
6987
|
}), false === _exceptionable || Object.keys(input).map(key => {
|
|
6988
|
-
if (["BYTES_PER_ELEMENT", "buffer", "byteLength", "byteOffset", "length", "__@toStringTag@
|
|
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@
|
|
7051
|
-
if (["BYTES_PER_ELEMENT", "buffer", "byteLength", "byteOffset", "length", "__@toStringTag@
|
|
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@
|
|
7255
|
-
path: _path + "[\"__@toStringTag@
|
|
7254
|
+
}), "Uint8Array" === input["__@toStringTag@81"] || _report(_exceptionable, {
|
|
7255
|
+
path: _path + "[\"__@toStringTag@81\"]",
|
|
7256
7256
|
expected: "\"Uint8Array\"",
|
|
7257
|
-
value: input["__@toStringTag@
|
|
7257
|
+
value: input["__@toStringTag@81"]
|
|
7258
7258
|
}), false === _exceptionable || Object.keys(input).map(key => {
|
|
7259
|
-
if (["BYTES_PER_ELEMENT", "buffer", "byteLength", "byteOffset", "length", "__@toStringTag@
|
|
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.
|
|
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)",
|