@neus/sdk 1.1.1 → 1.1.4
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 +191 -206
- package/SECURITY.md +38 -38
- package/cjs/client.cjs +23 -15
- package/cjs/index.cjs +23 -15
- package/cjs/mcp-hosts.cjs +125 -0
- package/cli/neus.mjs +2150 -1895
- package/client.js +32 -17
- package/mcp-hosts.js +121 -0
- package/package.json +147 -142
- package/types.d.ts +39 -8
- package/widgets/README.md +41 -45
- package/widgets/verify-gate/dist/ProofBadge.js +14 -4
- package/widgets/verify-gate/dist/VerifyGate.js +66 -203
package/README.md
CHANGED
|
@@ -1,206 +1,191 @@
|
|
|
1
|
-
# @neus/sdk
|
|
2
|
-
|
|
3
|
-
Create, check, and reuse NEUS trust receipts from apps and backends. The same package ships the **`neus`** CLI for hosted MCP setup
|
|
4
|
-
|
|
5
|
-
NEUS makes trust portable across apps, agents, and ecosystems before access, payment, or action.
|
|
6
|
-
|
|
7
|
-
Roadmap: [docs.neus.network/platform/status](https://docs.neus.network/platform/status)
|
|
8
|
-
|
|
9
|
-
## Install (library)
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
npm install @neus/sdk
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npx -y -p @neus/sdk neus
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
type: '
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
```bash
|
|
193
|
-
npx -y -p @neus/sdk neus auth
|
|
194
|
-
npx -y -p @neus/sdk neus auth --access-key <npk_...> # servers and CI only
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
Editors with plugin marketplaces can install **`neus-trust@neus`** for the bundled session workflow. OpenClaw, Hermes, and other runtimes: see [NEUS for AI assistants](https://docs.neus.network/mcp/ide-plugin) for exact paths.
|
|
198
|
-
|
|
199
|
-
## Docs
|
|
200
|
-
|
|
201
|
-
- Quickstart: https://docs.neus.network/quickstart
|
|
202
|
-
- JavaScript SDK: https://docs.neus.network/sdks/javascript
|
|
203
|
-
- Ownership Basic: https://docs.neus.network/verification/ownership-basic
|
|
204
|
-
- Widgets: https://docs.neus.network/widgets/overview
|
|
205
|
-
- MCP: https://docs.neus.network/mcp/overview
|
|
206
|
-
- API: https://docs.neus.network/api/overview
|
|
1
|
+
# @neus/sdk
|
|
2
|
+
|
|
3
|
+
Create, check, and reuse NEUS trust receipts from apps and backends. The same package ships the **`neus`** CLI for hosted MCP setup.
|
|
4
|
+
|
|
5
|
+
NEUS makes trust portable across apps, agents, and ecosystems before access, payment, or action.
|
|
6
|
+
|
|
7
|
+
Roadmap: [docs.neus.network/platform/status](https://docs.neus.network/platform/status)
|
|
8
|
+
|
|
9
|
+
## Install (library)
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @neus/sdk
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Connect editors and assistants
|
|
16
|
+
|
|
17
|
+
One command detects your environment and configures hosted MCP for Claude Code, Codex, Cursor, or VS Code.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx -y -p @neus/sdk neus setup
|
|
21
|
+
npx -y -p @neus/sdk neus doctor --live
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Open your MCP client and ask the assistant to use NEUS Trust.
|
|
25
|
+
|
|
26
|
+
## MCP docs
|
|
27
|
+
|
|
28
|
+
| Topic | Link |
|
|
29
|
+
| --------------------------------- | ----------------------------------------------------------------------------- |
|
|
30
|
+
| Setup, JSON snippets, and headers | [MCP setup](https://docs.neus.network/mcp/setup) |
|
|
31
|
+
| Tools and session order | [MCP overview](https://docs.neus.network/mcp/overview) |
|
|
32
|
+
| Discovery URLs | [Discovery and endpoints](https://docs.neus.network/mcp/endpoints) |
|
|
33
|
+
| Install NEUS Trust | [Install NEUS Trust](https://docs.neus.network/install) |
|
|
34
|
+
|
|
35
|
+
Prefer `neus setup` over hand-editing config files so every host stays on **`https://mcp.neus.network/mcp`**.
|
|
36
|
+
|
|
37
|
+
## What you can ship
|
|
38
|
+
|
|
39
|
+
- Hosted verification flows that return a reusable receipt
|
|
40
|
+
- Server checks before access, rewards, payments, or actions
|
|
41
|
+
- React gates with `VerifyGate`
|
|
42
|
+
- Agent identity and scoped delegation
|
|
43
|
+
- MCP setup for assistants and agent tools
|
|
44
|
+
|
|
45
|
+
## Hosted Verify
|
|
46
|
+
|
|
47
|
+
Use Hosted Verify when you want NEUS to handle the signing/verification flow outside your app UI. Prefer a **published gate**:
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
import { getHostedCheckoutUrl } from '@neus/sdk';
|
|
51
|
+
|
|
52
|
+
const url = getHostedCheckoutUrl({
|
|
53
|
+
gateId: 'gate_your-app-name',
|
|
54
|
+
returnUrl: 'https://yourapp.com/auth/callback'
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
window.location.assign(url);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
After completion, NEUS redirects back with a `qHash`. Store it with your user or record.
|
|
61
|
+
|
|
62
|
+
## Advanced: in-app signing
|
|
63
|
+
|
|
64
|
+
Use this only when your app intentionally handles signing. This example is EVM. For non-EVM accounts, pass the provider explicitly and include `chain` as a CAIP-2 value.
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
import { NeusClient } from '@neus/sdk';
|
|
68
|
+
|
|
69
|
+
const client = new NeusClient({
|
|
70
|
+
apiUrl: 'https://api.neus.network'
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const proof = await client.verify({
|
|
74
|
+
verifier: 'ownership-basic',
|
|
75
|
+
data: {
|
|
76
|
+
owner: '0x...',
|
|
77
|
+
contentType: 'application/json',
|
|
78
|
+
content: JSON.stringify({
|
|
79
|
+
title: 'Verified claim',
|
|
80
|
+
type: 'project-update',
|
|
81
|
+
summary: 'Public summary of what is being proven.'
|
|
82
|
+
}),
|
|
83
|
+
reference: {
|
|
84
|
+
type: 'url',
|
|
85
|
+
id: 'https://example.com/source',
|
|
86
|
+
title: 'Source record'
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
wallet: window.ethereum // EVM provider
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
console.log(proof.qHash);
|
|
93
|
+
console.log(proof.proofUrl);
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## React widget
|
|
97
|
+
|
|
98
|
+
Use `VerifyGate` with your published `gateId`:
|
|
99
|
+
|
|
100
|
+
```jsx
|
|
101
|
+
import { VerifyGate } from '@neus/sdk/widgets';
|
|
102
|
+
|
|
103
|
+
export function Page() {
|
|
104
|
+
return (
|
|
105
|
+
<VerifyGate
|
|
106
|
+
gateId="gate_your-app-name"
|
|
107
|
+
onVerified={result => {
|
|
108
|
+
console.log(result.qHash || result.qHashes);
|
|
109
|
+
}}
|
|
110
|
+
>
|
|
111
|
+
<section>Unlocked content</section>
|
|
112
|
+
</VerifyGate>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Check receipts
|
|
118
|
+
|
|
119
|
+
Use `gateCheck` from trusted server code when you need allow/deny before access:
|
|
120
|
+
|
|
121
|
+
```js
|
|
122
|
+
import { NeusClient } from '@neus/sdk';
|
|
123
|
+
|
|
124
|
+
const client = new NeusClient();
|
|
125
|
+
|
|
126
|
+
const result = await client.gateCheck({
|
|
127
|
+
gateId: 'gate_your-app-name',
|
|
128
|
+
address: '0x...'
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
if (!result.data?.eligible) {
|
|
132
|
+
throw new Error('Access denied');
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Never ship access keys in browser code.
|
|
137
|
+
|
|
138
|
+
## Core methods
|
|
139
|
+
|
|
140
|
+
| Method | Use it for |
|
|
141
|
+
| ------------------------------- | ------------------------------------------- |
|
|
142
|
+
| `getHostedCheckoutUrl()` | Send a user to Hosted Verify |
|
|
143
|
+
| `client.verify()` | Create a proof |
|
|
144
|
+
| `client.getProof()` | Fetch a receipt by `qHash` |
|
|
145
|
+
| `client.pollProofStatus()` | Wait for async completion |
|
|
146
|
+
| `client.gateCheck()` | Server-side eligibility checks |
|
|
147
|
+
| `client.checkGate()` | Local preview against already-loaded proofs |
|
|
148
|
+
| `client.createWalletLinkData()` | Wallet-link payloads |
|
|
149
|
+
|
|
150
|
+
## Configuration
|
|
151
|
+
|
|
152
|
+
```js
|
|
153
|
+
const client = new NeusClient({
|
|
154
|
+
apiUrl: 'https://api.neus.network',
|
|
155
|
+
timeout: 30000
|
|
156
|
+
});
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
`appId` is optional public attribution for advanced server/app flows. Published gate checkout and `gateCheck({ gateId })` do not require it.
|
|
160
|
+
`apiKey` / `npk_*` is optional and server-side only.
|
|
161
|
+
|
|
162
|
+
## MCP step-by-step
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
npx -y -p @neus/sdk neus setup
|
|
166
|
+
npx -y -p @neus/sdk neus doctor --live
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
`neus setup` configures MCP and signs you in: `NEUS_ACCESS_KEY` from the environment when set, otherwise the selected host starts OAuth. Cursor, VS Code, and Claude Code use browser sign-in on NEUS. Pass `--access-key <npk_...>` only to override.
|
|
170
|
+
|
|
171
|
+
Codex owns its local MCP OAuth session. Use `npx -y -p @neus/sdk neus setup --client codex`, then `npx -y -p @neus/sdk neus auth --client codex`.
|
|
172
|
+
|
|
173
|
+
Integrators embedding install UX in apps should import **`@neus/sdk/mcp-hosts`** (setup commands, deeplinks, host labels) instead of duplicating strings.
|
|
174
|
+
|
|
175
|
+
Claude Code users can install **`neus-trust@neus`** for the bundled session workflow:
|
|
176
|
+
|
|
177
|
+
```text
|
|
178
|
+
/plugin marketplace add https://github.com/neus/network
|
|
179
|
+
/plugin install neus-trust@neus
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Other hosts: [Install NEUS Trust](https://docs.neus.network/install).
|
|
183
|
+
|
|
184
|
+
## Docs
|
|
185
|
+
|
|
186
|
+
- Quickstart: https://docs.neus.network/quickstart
|
|
187
|
+
- JavaScript SDK: https://docs.neus.network/sdks/javascript
|
|
188
|
+
- Ownership Basic: https://docs.neus.network/verification/ownership-basic
|
|
189
|
+
- Widgets: https://docs.neus.network/widgets/overview
|
|
190
|
+
- MCP: https://docs.neus.network/mcp/overview
|
|
191
|
+
- API: https://docs.neus.network/api/overview
|
package/SECURITY.md
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
# NEUS SDK security notes
|
|
2
|
-
|
|
3
|
-
Treat **wallet signatures** and **API keys** as secrets. Do not log them, expose them to clients, or store them in analytics.
|
|
4
|
-
|
|
5
|
-
## Authentication model
|
|
6
|
-
|
|
7
|
-
- **Verification requests** are authenticated with a wallet signature over the **CAIP-380 Portable Proof** six-line signing string. Never roll your own message format in production—use the SDK or the hosted preparation step documented for HTTP integrations.
|
|
8
|
-
- **Proof lookups by `qHash`** are safe for public proofs. Private proofs return a minimal payload unless the caller proves ownership (authenticated owner or signed request).
|
|
9
|
-
- **Owner-only reads** of private proof payloads require an extra owner-signed request. The SDK attaches the required signed headers for you.
|
|
10
|
-
|
|
11
|
-
## Do not
|
|
12
|
-
|
|
13
|
-
- Do not treat proof signatures as bearer tokens (they are request-bound).
|
|
14
|
-
- Do not embed API keys in browser apps. Keep API keys server-side only.
|
|
15
|
-
- Do not log or persist proof signatures, API keys, or third-party auth credentials (if your integration uses them).
|
|
16
|
-
|
|
17
|
-
## Privacy defaults
|
|
18
|
-
|
|
19
|
-
**`client.verify()`** defaults to **private**.
|
|
20
|
-
|
|
21
|
-
**`VerifyGate`** create mode also defaults to **private**.
|
|
22
|
-
|
|
23
|
-
Use public visibility only when you need proof reuse without owner-authenticated access:
|
|
24
|
-
|
|
25
|
-
- unlisted public: `privacyLevel: 'public'`, `publicDisplay: false`
|
|
26
|
-
- listed public: `privacyLevel: 'public'`, `publicDisplay: true`
|
|
27
|
-
|
|
28
|
-
Do not treat unlisted public proofs as secret.
|
|
29
|
-
|
|
30
|
-
`storeOriginalContent` is an advanced storage control. Most integrations should leave the default as-is.
|
|
31
|
-
|
|
32
|
-
Controls:
|
|
33
|
-
|
|
34
|
-
- `privacyLevel` - private by default; switch to public only for intentional public reuse
|
|
35
|
-
- `publicDisplay` - discovery vs unlisted
|
|
36
|
-
- `storeOriginalContent` - advanced content-storage control
|
|
37
|
-
|
|
38
|
-
Discoverable listings require **`privacyLevel: 'public'`** and **`publicDisplay: true`**.
|
|
1
|
+
# NEUS SDK security notes
|
|
2
|
+
|
|
3
|
+
Treat **wallet signatures** and **API keys** as secrets. Do not log them, expose them to clients, or store them in analytics.
|
|
4
|
+
|
|
5
|
+
## Authentication model
|
|
6
|
+
|
|
7
|
+
- **Verification requests** are authenticated with a wallet signature over the **CAIP-380 Portable Proof** six-line signing string. Never roll your own message format in production—use the SDK or the hosted preparation step documented for HTTP integrations.
|
|
8
|
+
- **Proof lookups by `qHash`** are safe for public proofs. Private proofs return a minimal payload unless the caller proves ownership (authenticated owner or signed request).
|
|
9
|
+
- **Owner-only reads** of private proof payloads require an extra owner-signed request. The SDK attaches the required signed headers for you.
|
|
10
|
+
|
|
11
|
+
## Do not
|
|
12
|
+
|
|
13
|
+
- Do not treat proof signatures as bearer tokens (they are request-bound).
|
|
14
|
+
- Do not embed API keys in browser apps. Keep API keys server-side only.
|
|
15
|
+
- Do not log or persist proof signatures, API keys, or third-party auth credentials (if your integration uses them).
|
|
16
|
+
|
|
17
|
+
## Privacy defaults
|
|
18
|
+
|
|
19
|
+
**`client.verify()`** defaults to **private**.
|
|
20
|
+
|
|
21
|
+
**`VerifyGate`** create mode also defaults to **private**.
|
|
22
|
+
|
|
23
|
+
Use public visibility only when you need proof reuse without owner-authenticated access:
|
|
24
|
+
|
|
25
|
+
- unlisted public: `privacyLevel: 'public'`, `publicDisplay: false`
|
|
26
|
+
- listed public: `privacyLevel: 'public'`, `publicDisplay: true`
|
|
27
|
+
|
|
28
|
+
Do not treat unlisted public proofs as secret.
|
|
29
|
+
|
|
30
|
+
`storeOriginalContent` is an advanced storage control. Most integrations should leave the default as-is.
|
|
31
|
+
|
|
32
|
+
Controls:
|
|
33
|
+
|
|
34
|
+
- `privacyLevel` - private by default; switch to public only for intentional public reuse
|
|
35
|
+
- `publicDisplay` - discovery vs unlisted
|
|
36
|
+
- `storeOriginalContent` - advanced content-storage control
|
|
37
|
+
|
|
38
|
+
Discoverable listings require **`privacyLevel: 'public'`** and **`publicDisplay: true`**.
|
package/cjs/client.cjs
CHANGED
|
@@ -1396,21 +1396,20 @@ var NeusClient = class {
|
|
|
1396
1396
|
return hex;
|
|
1397
1397
|
}
|
|
1398
1398
|
};
|
|
1399
|
-
const
|
|
1399
|
+
const isBaseMiniAppWallet = (() => {
|
|
1400
1400
|
if (typeof window === "undefined") return false;
|
|
1401
1401
|
try {
|
|
1402
1402
|
const w = window;
|
|
1403
|
-
const
|
|
1404
|
-
if (!
|
|
1405
|
-
const
|
|
1406
|
-
if (
|
|
1407
|
-
if (w.
|
|
1408
|
-
if (w.ethereum === provider && fc && fc.context) return true;
|
|
1403
|
+
const mini = w.mini;
|
|
1404
|
+
if (!mini) return false;
|
|
1405
|
+
const miniProvider = mini.wallet || mini.provider;
|
|
1406
|
+
if (miniProvider === provider) return true;
|
|
1407
|
+
if (w.ethereum === provider && mini) return true;
|
|
1409
1408
|
} catch {
|
|
1410
1409
|
}
|
|
1411
1410
|
return false;
|
|
1412
1411
|
})();
|
|
1413
|
-
if (
|
|
1412
|
+
if (isBaseMiniAppWallet) {
|
|
1414
1413
|
try {
|
|
1415
1414
|
const hexMsg = toHexUtf82(message);
|
|
1416
1415
|
signature2 = await provider.request({ method: "personal_sign", params: [hexMsg, walletAddress2] });
|
|
@@ -1759,7 +1758,9 @@ ${bytes.length}`;
|
|
|
1759
1758
|
const pathId = /^0x[a-fA-F0-9]{40}$/i.test(id) ? id.toLowerCase() : id;
|
|
1760
1759
|
const qs = [];
|
|
1761
1760
|
if (options.limit) qs.push(`limit=${encodeURIComponent(String(options.limit))}`);
|
|
1762
|
-
|
|
1761
|
+
const cursorRaw = options.cursor !== null && options.cursor !== void 0 ? String(options.cursor).trim() : "";
|
|
1762
|
+
if (cursorRaw) qs.push(`cursor=${encodeURIComponent(cursorRaw)}`);
|
|
1763
|
+
else if (options.offset) qs.push(`offset=${encodeURIComponent(String(options.offset))}`);
|
|
1763
1764
|
if (options.qHash) qs.push(`qHash=${encodeURIComponent(options.qHash.toLowerCase())}`);
|
|
1764
1765
|
const query = qs.length ? `?${qs.join("&")}` : "";
|
|
1765
1766
|
const response = await this._makeRequest(
|
|
@@ -1775,7 +1776,8 @@ ${bytes.length}`;
|
|
|
1775
1776
|
proofs: Array.isArray(proofs) ? proofs : [],
|
|
1776
1777
|
totalCount: response.data?.totalCount ?? proofs.length,
|
|
1777
1778
|
hasMore: Boolean(response.data?.hasMore),
|
|
1778
|
-
nextOffset: response.data?.nextOffset ?? null
|
|
1779
|
+
nextOffset: response.data?.nextOffset ?? null,
|
|
1780
|
+
nextCursor: typeof response.data?.nextCursor === "string" && response.data.nextCursor.trim() ? response.data.nextCursor.trim() : null
|
|
1779
1781
|
};
|
|
1780
1782
|
}
|
|
1781
1783
|
async getPrivateProofsByWallet(walletAddress, options = {}, wallet = null) {
|
|
@@ -1827,7 +1829,9 @@ ${bytes.length}`;
|
|
|
1827
1829
|
}
|
|
1828
1830
|
const qs = [];
|
|
1829
1831
|
if (options.limit) qs.push(`limit=${encodeURIComponent(String(options.limit))}`);
|
|
1830
|
-
|
|
1832
|
+
const cursorRaw = options.cursor !== null && options.cursor !== void 0 ? String(options.cursor).trim() : "";
|
|
1833
|
+
if (cursorRaw) qs.push(`cursor=${encodeURIComponent(cursorRaw)}`);
|
|
1834
|
+
else if (options.offset) qs.push(`offset=${encodeURIComponent(String(options.offset))}`);
|
|
1831
1835
|
if (options.qHash) qs.push(`qHash=${encodeURIComponent(options.qHash.toLowerCase())}`);
|
|
1832
1836
|
const query = qs.length ? `?${qs.join("&")}` : "";
|
|
1833
1837
|
const response = await this._makeRequest("GET", `/api/v1/proofs/by-wallet/${encodeURIComponent(pathId)}${query}`, null, {
|
|
@@ -1845,7 +1849,8 @@ ${bytes.length}`;
|
|
|
1845
1849
|
proofs: Array.isArray(proofs) ? proofs : [],
|
|
1846
1850
|
totalCount: response.data?.totalCount ?? proofs.length,
|
|
1847
1851
|
hasMore: Boolean(response.data?.hasMore),
|
|
1848
|
-
nextOffset: response.data?.nextOffset ?? null
|
|
1852
|
+
nextOffset: response.data?.nextOffset ?? null,
|
|
1853
|
+
nextCursor: typeof response.data?.nextCursor === "string" && response.data.nextCursor.trim() ? response.data.nextCursor.trim() : null
|
|
1849
1854
|
};
|
|
1850
1855
|
}
|
|
1851
1856
|
async gateCheck(params = {}) {
|
|
@@ -1853,6 +1858,8 @@ ${bytes.length}`;
|
|
|
1853
1858
|
if (!validateUniversalAddress(address, params.chain)) {
|
|
1854
1859
|
throw new ValidationError("Valid address is required");
|
|
1855
1860
|
}
|
|
1861
|
+
const gateIdParam = typeof params.gateId === "string" ? params.gateId.trim() : "";
|
|
1862
|
+
const verifierIds = gateIdParam ? void 0 : params.verifierIds;
|
|
1856
1863
|
const qs = new URLSearchParams();
|
|
1857
1864
|
qs.set("address", address);
|
|
1858
1865
|
const setIfPresent = (key, value) => {
|
|
@@ -1874,7 +1881,8 @@ ${bytes.length}`;
|
|
|
1874
1881
|
}
|
|
1875
1882
|
setIfPresent(key, value);
|
|
1876
1883
|
};
|
|
1877
|
-
|
|
1884
|
+
setIfPresent("gateId", gateIdParam);
|
|
1885
|
+
setCsvIfPresent("verifierIds", verifierIds);
|
|
1878
1886
|
setBoolIfPresent("requireAll", params.requireAll);
|
|
1879
1887
|
setIfPresent("minCount", params.minCount);
|
|
1880
1888
|
setIfPresent("sinceDays", params.sinceDays);
|
|
@@ -1938,10 +1946,10 @@ ${bytes.length}`;
|
|
|
1938
1946
|
}
|
|
1939
1947
|
}
|
|
1940
1948
|
let mergedHeaders = headersOverride;
|
|
1941
|
-
if (!mergedHeaders) {
|
|
1949
|
+
if (!mergedHeaders && !gateIdParam) {
|
|
1942
1950
|
try {
|
|
1943
1951
|
const sponsorHeaders = await this._resolveSponsorGrantHeaders(
|
|
1944
|
-
Array.isArray(
|
|
1952
|
+
Array.isArray(verifierIds) ? verifierIds : verifierIds ? [verifierIds] : []
|
|
1945
1953
|
);
|
|
1946
1954
|
if (sponsorHeaders && Object.keys(sponsorHeaders).length > 0) {
|
|
1947
1955
|
mergedHeaders = sponsorHeaders;
|