@neus/sdk 1.1.1 → 1.1.2
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 +184 -206
- package/cjs/client.cjs +23 -15
- package/cjs/index.cjs +23 -15
- package/cjs/mcp-hosts.cjs +125 -0
- package/cli/neus.mjs +613 -342
- package/client.js +32 -17
- package/mcp-hosts.js +121 -0
- package/package.json +147 -142
- package/types.d.ts +38 -7
- package/widgets/README.md +6 -10
- 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,184 @@
|
|
|
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
|
-
npx -y -p @neus/sdk neus setup
|
|
186
|
-
npx -y -p @neus/sdk neus auth
|
|
187
|
-
npx -y -p @neus/sdk neus doctor --live
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
Re-sign in or rotate credentials:
|
|
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
|
+
Call `neus_context` in your MCP client. For agent workflows, call `neus_agent_link` before assuming identity or delegation is ready.
|
|
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
|
+
| NEUS for AI assistants | [NEUS for AI assistants](https://docs.neus.network/mcp/ide-plugin) |
|
|
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_abc123',
|
|
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_abc123"
|
|
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_abc123',
|
|
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
|
+
Editors with plugin marketplaces can install **`neus-trust@neus`** for the bundled session workflow. In Claude Code, run `/plugin marketplace add https://github.com/neus/network` and `/plugin install neus-trust@neus` inside chat. Other hosts: [NEUS for AI assistants](https://docs.neus.network/mcp/ide-plugin).
|
|
176
|
+
|
|
177
|
+
## Docs
|
|
178
|
+
|
|
179
|
+
- Quickstart: https://docs.neus.network/quickstart
|
|
180
|
+
- JavaScript SDK: https://docs.neus.network/sdks/javascript
|
|
181
|
+
- Ownership Basic: https://docs.neus.network/verification/ownership-basic
|
|
182
|
+
- Widgets: https://docs.neus.network/widgets/overview
|
|
183
|
+
- MCP: https://docs.neus.network/mcp/overview
|
|
184
|
+
- API: https://docs.neus.network/api/overview
|
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;
|
package/cjs/index.cjs
CHANGED
|
@@ -2089,21 +2089,20 @@ var init_client = __esm({
|
|
|
2089
2089
|
return hex;
|
|
2090
2090
|
}
|
|
2091
2091
|
};
|
|
2092
|
-
const
|
|
2092
|
+
const isBaseMiniAppWallet = (() => {
|
|
2093
2093
|
if (typeof window === "undefined") return false;
|
|
2094
2094
|
try {
|
|
2095
2095
|
const w = window;
|
|
2096
|
-
const
|
|
2097
|
-
if (!
|
|
2098
|
-
const
|
|
2099
|
-
if (
|
|
2100
|
-
if (w.
|
|
2101
|
-
if (w.ethereum === provider && fc && fc.context) return true;
|
|
2096
|
+
const mini = w.mini;
|
|
2097
|
+
if (!mini) return false;
|
|
2098
|
+
const miniProvider = mini.wallet || mini.provider;
|
|
2099
|
+
if (miniProvider === provider) return true;
|
|
2100
|
+
if (w.ethereum === provider && mini) return true;
|
|
2102
2101
|
} catch {
|
|
2103
2102
|
}
|
|
2104
2103
|
return false;
|
|
2105
2104
|
})();
|
|
2106
|
-
if (
|
|
2105
|
+
if (isBaseMiniAppWallet) {
|
|
2107
2106
|
try {
|
|
2108
2107
|
const hexMsg = toHexUtf82(message);
|
|
2109
2108
|
signature2 = await provider.request({ method: "personal_sign", params: [hexMsg, walletAddress2] });
|
|
@@ -2452,7 +2451,9 @@ ${bytes.length}`;
|
|
|
2452
2451
|
const pathId = /^0x[a-fA-F0-9]{40}$/i.test(id) ? id.toLowerCase() : id;
|
|
2453
2452
|
const qs = [];
|
|
2454
2453
|
if (options.limit) qs.push(`limit=${encodeURIComponent(String(options.limit))}`);
|
|
2455
|
-
|
|
2454
|
+
const cursorRaw = options.cursor !== null && options.cursor !== void 0 ? String(options.cursor).trim() : "";
|
|
2455
|
+
if (cursorRaw) qs.push(`cursor=${encodeURIComponent(cursorRaw)}`);
|
|
2456
|
+
else if (options.offset) qs.push(`offset=${encodeURIComponent(String(options.offset))}`);
|
|
2456
2457
|
if (options.qHash) qs.push(`qHash=${encodeURIComponent(options.qHash.toLowerCase())}`);
|
|
2457
2458
|
const query = qs.length ? `?${qs.join("&")}` : "";
|
|
2458
2459
|
const response = await this._makeRequest(
|
|
@@ -2468,7 +2469,8 @@ ${bytes.length}`;
|
|
|
2468
2469
|
proofs: Array.isArray(proofs) ? proofs : [],
|
|
2469
2470
|
totalCount: response.data?.totalCount ?? proofs.length,
|
|
2470
2471
|
hasMore: Boolean(response.data?.hasMore),
|
|
2471
|
-
nextOffset: response.data?.nextOffset ?? null
|
|
2472
|
+
nextOffset: response.data?.nextOffset ?? null,
|
|
2473
|
+
nextCursor: typeof response.data?.nextCursor === "string" && response.data.nextCursor.trim() ? response.data.nextCursor.trim() : null
|
|
2472
2474
|
};
|
|
2473
2475
|
}
|
|
2474
2476
|
async getPrivateProofsByWallet(walletAddress, options = {}, wallet = null) {
|
|
@@ -2520,7 +2522,9 @@ ${bytes.length}`;
|
|
|
2520
2522
|
}
|
|
2521
2523
|
const qs = [];
|
|
2522
2524
|
if (options.limit) qs.push(`limit=${encodeURIComponent(String(options.limit))}`);
|
|
2523
|
-
|
|
2525
|
+
const cursorRaw = options.cursor !== null && options.cursor !== void 0 ? String(options.cursor).trim() : "";
|
|
2526
|
+
if (cursorRaw) qs.push(`cursor=${encodeURIComponent(cursorRaw)}`);
|
|
2527
|
+
else if (options.offset) qs.push(`offset=${encodeURIComponent(String(options.offset))}`);
|
|
2524
2528
|
if (options.qHash) qs.push(`qHash=${encodeURIComponent(options.qHash.toLowerCase())}`);
|
|
2525
2529
|
const query = qs.length ? `?${qs.join("&")}` : "";
|
|
2526
2530
|
const response = await this._makeRequest("GET", `/api/v1/proofs/by-wallet/${encodeURIComponent(pathId)}${query}`, null, {
|
|
@@ -2538,7 +2542,8 @@ ${bytes.length}`;
|
|
|
2538
2542
|
proofs: Array.isArray(proofs) ? proofs : [],
|
|
2539
2543
|
totalCount: response.data?.totalCount ?? proofs.length,
|
|
2540
2544
|
hasMore: Boolean(response.data?.hasMore),
|
|
2541
|
-
nextOffset: response.data?.nextOffset ?? null
|
|
2545
|
+
nextOffset: response.data?.nextOffset ?? null,
|
|
2546
|
+
nextCursor: typeof response.data?.nextCursor === "string" && response.data.nextCursor.trim() ? response.data.nextCursor.trim() : null
|
|
2542
2547
|
};
|
|
2543
2548
|
}
|
|
2544
2549
|
async gateCheck(params = {}) {
|
|
@@ -2546,6 +2551,8 @@ ${bytes.length}`;
|
|
|
2546
2551
|
if (!validateUniversalAddress(address, params.chain)) {
|
|
2547
2552
|
throw new ValidationError("Valid address is required");
|
|
2548
2553
|
}
|
|
2554
|
+
const gateIdParam = typeof params.gateId === "string" ? params.gateId.trim() : "";
|
|
2555
|
+
const verifierIds = gateIdParam ? void 0 : params.verifierIds;
|
|
2549
2556
|
const qs = new URLSearchParams();
|
|
2550
2557
|
qs.set("address", address);
|
|
2551
2558
|
const setIfPresent = (key, value) => {
|
|
@@ -2567,7 +2574,8 @@ ${bytes.length}`;
|
|
|
2567
2574
|
}
|
|
2568
2575
|
setIfPresent(key, value);
|
|
2569
2576
|
};
|
|
2570
|
-
|
|
2577
|
+
setIfPresent("gateId", gateIdParam);
|
|
2578
|
+
setCsvIfPresent("verifierIds", verifierIds);
|
|
2571
2579
|
setBoolIfPresent("requireAll", params.requireAll);
|
|
2572
2580
|
setIfPresent("minCount", params.minCount);
|
|
2573
2581
|
setIfPresent("sinceDays", params.sinceDays);
|
|
@@ -2631,10 +2639,10 @@ ${bytes.length}`;
|
|
|
2631
2639
|
}
|
|
2632
2640
|
}
|
|
2633
2641
|
let mergedHeaders = headersOverride;
|
|
2634
|
-
if (!mergedHeaders) {
|
|
2642
|
+
if (!mergedHeaders && !gateIdParam) {
|
|
2635
2643
|
try {
|
|
2636
2644
|
const sponsorHeaders = await this._resolveSponsorGrantHeaders(
|
|
2637
|
-
Array.isArray(
|
|
2645
|
+
Array.isArray(verifierIds) ? verifierIds : verifierIds ? [verifierIds] : []
|
|
2638
2646
|
);
|
|
2639
2647
|
if (sponsorHeaders && Object.keys(sponsorHeaders).length > 0) {
|
|
2640
2648
|
mergedHeaders = sponsorHeaders;
|