@veridex/sdk 1.0.0-beta.16 → 1.0.0-beta.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +163 -111
  2. package/dist/chains/aptos/index.d.mts +1 -1
  3. package/dist/chains/aptos/index.d.ts +1 -1
  4. package/dist/chains/evm/index.d.mts +3 -3
  5. package/dist/chains/evm/index.d.ts +3 -3
  6. package/dist/chains/solana/index.d.mts +1 -1
  7. package/dist/chains/solana/index.d.ts +1 -1
  8. package/dist/chains/stacks/index.d.mts +559 -0
  9. package/dist/chains/stacks/index.d.ts +559 -0
  10. package/dist/chains/stacks/index.js +1207 -0
  11. package/dist/chains/stacks/index.js.map +1 -0
  12. package/dist/chains/stacks/index.mjs +1149 -0
  13. package/dist/chains/stacks/index.mjs.map +1 -0
  14. package/dist/chains/starknet/index.d.mts +2 -2
  15. package/dist/chains/starknet/index.d.ts +2 -2
  16. package/dist/chains/sui/index.d.mts +2 -2
  17. package/dist/chains/sui/index.d.ts +2 -2
  18. package/dist/{index-eadz7SCP.d.mts → index-Dy29mvBf.d.mts} +28 -10
  19. package/dist/{index-ruSjoF2m.d.ts → index-eXXqodd0.d.ts} +28 -10
  20. package/dist/index.d.mts +165 -11
  21. package/dist/index.d.ts +165 -11
  22. package/dist/index.js +1582 -134
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.mjs +1536 -134
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/queries/index.js +36 -1
  27. package/dist/queries/index.js.map +1 -1
  28. package/dist/queries/index.mjs +36 -1
  29. package/dist/queries/index.mjs.map +1 -1
  30. package/dist/{types-ChIsqCiw.d.mts → types-DakHNZIP.d.mts} +7 -1
  31. package/dist/{types-ChIsqCiw.d.ts → types-DakHNZIP.d.ts} +7 -1
  32. package/dist/{types-FJL7j6gQ.d.mts → types-DvFRnIBd.d.mts} +1 -1
  33. package/dist/{types-FJL7j6gQ.d.ts → types-DvFRnIBd.d.ts} +1 -1
  34. package/dist/types.d.mts +6 -0
  35. package/dist/types.d.ts +6 -0
  36. package/dist/types.js.map +1 -1
  37. package/package.json +7 -1
package/README.md CHANGED
@@ -3,142 +3,147 @@
3
3
  [![npm version](https://img.shields.io/npm/v/@veridex/sdk.svg)](https://www.npmjs.com/package/@veridex/sdk)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- Veridex Protocol SDK - Client library for **Passkey-based cross-chain authentication**.
6
+ **Passkey-based cross-chain identity and authentication.** One passkey. Every chain.
7
7
 
8
- Build applications with WebAuthn/Passkeys (P-256) that work across EVM, Solana, Aptos, Sui, and Starknet.
9
-
10
- ## Features
11
-
12
- - **Passkey Authentication** - WebAuthn P-256 signature verification (no seed phrases)
13
- - **Cross-Chain Support** - EVM, Solana, Aptos, Sui, Starknet
14
- - **Deterministic Vaults** - Same address across all EVM chains
15
- - **Gasless Transactions** - Relayer-sponsored execution
16
- - **Session Keys** - Temporary delegated access for smooth UX
17
- - **Wormhole Integration** - Guardian-attested cross-chain messaging
18
-
19
- ## Installation
8
+ Register a WebAuthn passkey once, get a deterministic vault address on every supported chain. No seed phrases, no private keys, no browser extensions.
20
9
 
21
10
  ```bash
22
11
  npm install @veridex/sdk ethers
23
- # or
24
- yarn add @veridex/sdk ethers
25
- # or
26
- bun add @veridex/sdk ethers
27
12
  ```
28
13
 
29
- ## Quick Start
30
-
31
14
  ```typescript
32
15
  import { createSDK } from '@veridex/sdk';
33
16
 
34
- // Initialize SDK (testnet by default)
35
17
  const sdk = createSDK('base');
36
18
 
37
- // Register a passkey
19
+ // Register a passkey (biometric prompt)
38
20
  const credential = await sdk.passkey.register('user@example.com', 'My Wallet');
39
21
 
40
- // Get your vault address (same on all EVM chains!)
41
- const vaultAddress = sdk.getVaultAddress();
42
- console.log('Your vault:', vaultAddress);
22
+ // Same vault address on every EVM chain
23
+ const vault = sdk.getVaultAddress();
43
24
 
44
- // Transfer tokens
45
- await sdk.transfer({
46
- token: '0x036CbD53842c5426634e7929541eC2318f3dCF7e', // USDC
47
- recipient: '0x742d35Cc6634C0532925a3b844Bc9e7595f5A234',
48
- amount: 1000000n, // 1 USDC (6 decimals)
25
+ // Transfer tokens (gasless via relayer)
26
+ await sdk.transferViaRelayer({
27
+ token: USDC_ADDRESS,
28
+ recipient: '0x742d35Cc...',
29
+ amount: 1000000n, // 1 USDC
49
30
  });
50
31
  ```
51
32
 
52
- ## Networks
33
+ ## Architecture
53
34
 
54
- ```typescript
55
- // Testnet (default)
56
- const testnetSdk = createSDK('base');
57
-
58
- // Mainnet
59
- const mainnetSdk = createSDK('base', { network: 'mainnet' });
60
-
61
- // Custom RPC
62
- const customSdk = createSDK('base', {
63
- rpcUrl: 'https://my-rpc.example.com'
64
- });
35
+ ```
36
+ ┌─────────────────────┐
37
+ │ WebAuthn Passkey │
38
+ │ (P-256 / secp256r1)│
39
+ └──────────┬──────────┘
40
+
41
+ ┌──────────▼──────────┐
42
+ │ Veridex Hub │
43
+ (Base / EVM) │
44
+ Identity + Vaults │
45
+ └──────────┬──────────┘
46
+ │ Wormhole / Custom Bridge
47
+ ┌────────┬───────────┼───────────┬────────┬────────┐
48
+ ▼ ▼ ▼ ▼ ▼ ▼
49
+ Solana Aptos Sui Starknet Stacks EVM Spokes
50
+ (Ed25519) (Ed25519) (secp256k1) (Stark) (secp256r1) (Opt/Arb/Poly)
65
51
  ```
66
52
 
53
+ **Hub-and-Spoke model**: Identity lives on the Hub (Base). Actions are dispatched to spoke chains via Wormhole guardian-attested messages or custom bridge attestations.
54
+
67
55
  ## Supported Chains
68
56
 
69
- | Chain | Type | Status |
70
- |-------|------|--------|
71
- | Base | Hub (EVM) | Testnet + Mainnet |
72
- | Optimism | Spoke (EVM) | Testnet + Mainnet |
73
- | Arbitrum | Spoke (EVM) | Testnet + Mainnet |
74
- | Ethereum | Spoke (EVM) | Testnet + Mainnet |
75
- | Polygon | Spoke (EVM) | Testnet + Mainnet |
76
- | Solana | Spoke | Devnet + Mainnet |
77
- | Aptos | Spoke | Testnet + Mainnet |
78
- | Sui | Spoke | Testnet + Mainnet |
79
- | Starknet | Spoke | Sepolia + Mainnet |
57
+ | Chain | Type | Wormhole ID | Signature | Networks |
58
+ |-------|------|-------------|-----------|----------|
59
+ | **Base** | Hub (EVM) | 30 | secp256r1 (passkey) + secp256k1 (session) | Sepolia + Mainnet |
60
+ | **Ethereum** | Spoke (EVM) | 2 | secp256r1 + secp256k1 | Sepolia + Mainnet |
61
+ | **Optimism** | Spoke (EVM) | 24 | secp256r1 + secp256k1 | Sepolia + Mainnet |
62
+ | **Arbitrum** | Spoke (EVM) | 23 | secp256r1 + secp256k1 | Sepolia + Mainnet |
63
+ | **Polygon** | Spoke (EVM) | 5 | secp256r1 + secp256k1 | Amoy + Mainnet |
64
+ | **Solana** | Spoke | 1 | Ed25519 | Devnet + Mainnet |
65
+ | **Aptos** | Spoke | 22 | Ed25519 | Testnet + Mainnet |
66
+ | **Sui** | Spoke | 21 | secp256k1 | Testnet + Mainnet |
67
+ | **Starknet** | Spoke | 50001 | Stark ECDSA | Sepolia + Mainnet |
68
+ | **Stacks** | Spoke | 60 | secp256r1 (native!) + secp256k1 | Testnet + Mainnet |
69
+
70
+ ## Key Features
80
71
 
81
- ## Gasless Transactions
72
+ ### Passkey Authentication (No Seed Phrases)
82
73
 
83
74
  ```typescript
84
- const sdk = createSDK('base', {
85
- relayerUrl: 'https://relayer.veridex.io',
86
- relayerApiKey: 'your-api-key',
87
- });
75
+ // Register triggers biometric prompt
76
+ const credential = await sdk.passkey.register('user@example.com', 'My Wallet');
88
77
 
89
- // Transfers are now gasless
90
- await sdk.transferViaRelayer({
91
- token: USDC_ADDRESS,
92
- recipient: '0x...',
93
- amount: 1000000n,
94
- });
78
+ // Authenticate biometric verification
79
+ const signature = await sdk.passkey.sign(challenge);
95
80
  ```
96
81
 
97
- ## Session Keys
82
+ - **RIP-7212** native P-256 verification on EVM (~3,450 gas)
83
+ - **FCL fallback** for chains without precompile
84
+ - **Stacks** has native `secp256r1-verify` in Clarity — no workarounds needed
98
85
 
99
- Enable seamless UX without repeated biometric prompts:
86
+ ### Deterministic Vaults
87
+
88
+ ```typescript
89
+ // Same address on Base, Optimism, Arbitrum, Ethereum, Polygon
90
+ const vault = sdk.getVaultAddress();
91
+
92
+ // Vault is derived from your passkey — no deployment needed on spokes
93
+ ```
94
+
95
+ ### Session Keys
96
+
97
+ Delegate temporary access with spending limits — no repeated biometric prompts:
100
98
 
101
99
  ```typescript
102
- // Create a 1-hour session with 0.1 ETH limit
103
100
  const session = await sdk.sessions.create({
104
- duration: 3600,
101
+ duration: 3600, // 1 hour
105
102
  maxValue: parseEther('0.1'),
103
+ allowedChains: [30, 1], // Base + Solana
106
104
  });
107
105
 
108
- // Execute multiple transactions without prompts
109
- await sdk.sessions.transfer(session, { ... });
110
- await sdk.sessions.transfer(session, { ... });
106
+ // Multiple transactions without prompts
107
+ await sdk.sessions.transfer(session, { token, recipient, amount });
108
+ await sdk.sessions.transfer(session, { token, recipient, amount });
111
109
 
112
- // Revoke when done
110
+ // Revoke anytime
113
111
  await sdk.sessions.revoke(session);
114
112
  ```
115
113
 
116
- ## Cross-Chain Bridging
114
+ ### Gasless Transactions
115
+
116
+ ```typescript
117
+ const sdk = createSDK('base', {
118
+ relayerUrl: 'https://relayer.veridex.network',
119
+ relayerApiKey: 'your-api-key',
120
+ });
121
+
122
+ // Relayer sponsors gas — user pays nothing
123
+ await sdk.transferViaRelayer({
124
+ token: USDC_ADDRESS,
125
+ recipient: '0x...',
126
+ amount: 1000000n,
127
+ });
128
+ ```
129
+
130
+ ### Cross-Chain Bridging
117
131
 
118
132
  ```typescript
119
133
  import { parseUnits } from 'ethers';
120
134
 
135
+ // Bridge USDC from Base to Optimism via Wormhole
121
136
  await sdk.bridge({
122
137
  targetChain: 'optimism',
123
138
  token: USDC_ADDRESS,
124
139
  amount: parseUnits('100', 6),
125
- recipient: '0x...', // Optional, defaults to your vault
140
+ recipient: '0x...', // defaults to your vault
126
141
  });
127
142
  ```
128
143
 
129
- ## API Reference
130
-
131
- ### Core
144
+ ## Chain Clients
132
145
 
133
- | Export | Description |
134
- |--------|-------------|
135
- | `createSDK(chain, config?)` | Create SDK for a chain |
136
- | `VeridexSDK` | Main SDK class |
137
- | `PasskeyManager` | WebAuthn credential management |
138
- | `WalletManager` | Vault address derivation |
139
- | `SessionManager` | Session key management |
140
-
141
- ### Chain Clients
146
+ Each chain has a dedicated client implementing the `ChainClient` interface:
142
147
 
143
148
  ```typescript
144
149
  import { EVMClient } from '@veridex/sdk/chains/evm';
@@ -146,40 +151,93 @@ import { SolanaClient } from '@veridex/sdk/chains/solana';
146
151
  import { AptosClient } from '@veridex/sdk/chains/aptos';
147
152
  import { SuiClient } from '@veridex/sdk/chains/sui';
148
153
  import { StarknetClient } from '@veridex/sdk/chains/starknet';
154
+ import { StacksClient } from '@veridex/sdk/chains/stacks';
155
+ ```
156
+
157
+ All clients support:
158
+ - `buildTransferPayload()` — Build token transfer payloads
159
+ - `buildExecutePayload()` — Build arbitrary execution payloads
160
+ - `buildBridgePayload()` — Build cross-chain bridge payloads
161
+ - `dispatch()` / `dispatchGasless()` — Submit signed actions
162
+ - `getBalance()` / `getTokenBalance()` — Query balances
163
+ - `createVault()` / `createVaultViaRelayer()` — Vault management
164
+
165
+ ### Stacks-Specific
166
+
167
+ Stacks has unique capabilities leveraged by the SDK:
168
+
169
+ ```typescript
170
+ import { StacksClient } from '@veridex/sdk/chains/stacks';
171
+ import {
172
+ compressPublicKey,
173
+ rsToCompactSignature,
174
+ parseDERSignature,
175
+ } from '@veridex/sdk/chains/stacks';
176
+
177
+ // Native secp256r1 verification (no ZK proofs needed)
178
+ // Native sponsored transactions (gasless built-in)
179
+ // Post-conditions for protocol-level spending safety
149
180
  ```
150
181
 
182
+ ## API Reference
183
+
184
+ ### Core Exports
185
+
186
+ | Export | Description |
187
+ |--------|-------------|
188
+ | `createSDK(chain, config?)` | Create SDK instance for a chain |
189
+ | `VeridexSDK` | Main SDK class |
190
+ | `PasskeyManager` | WebAuthn credential management |
191
+ | `WalletManager` | Deterministic vault address derivation |
192
+ | `SessionManager` | Session key lifecycle management |
193
+
151
194
  ### Utilities
152
195
 
153
196
  ```typescript
154
- import {
197
+ import {
155
198
  encodeTransferAction,
199
+ encodeExecuteAction,
156
200
  encodeBridgeAction,
157
201
  parseVAA,
158
202
  fetchVAA,
203
+ WORMHOLE_CHAIN_IDS,
204
+ TESTNET_CHAINS,
205
+ MAINNET_CHAINS,
159
206
  } from '@veridex/sdk';
160
207
  ```
161
208
 
162
- ### Constants
209
+ ### Types
163
210
 
164
211
  ```typescript
165
- import {
166
- WORMHOLE_CHAIN_IDS,
167
- TESTNET_CHAINS,
168
- MAINNET_CHAINS,
212
+ import type {
213
+ ChainName,
214
+ ChainClient,
215
+ ChainConfig,
216
+ NetworkType,
217
+ SimpleSDKConfig,
218
+ TransferParams,
219
+ ExecuteParams,
220
+ BridgeParams,
221
+ SessionKey,
222
+ WebAuthnSignature,
223
+ DispatchResult,
224
+ VaultCreationResult,
169
225
  } from '@veridex/sdk';
170
226
  ```
171
227
 
172
228
  ## Security
173
229
 
174
- - **Passkeys Only** - No EOA or seed phrase assumptions
175
- - **RIP-7212 Support** - Native P-256 verification (~3,450 gas)
176
- - **FCL Fallback** - Software verification when precompile unavailable
177
- - **Wormhole VAA** - 13/19 guardian quorum for cross-chain messages
178
- - **Replay Protection** - Nonce-based action deduplication
230
+ - **Passkeys only** No EOA, no seed phrases, no browser extensions
231
+ - **RIP-7212** Native P-256 verification (~3,450 gas on EVM)
232
+ - **FCL fallback** Software verification when precompile unavailable
233
+ - **Wormhole VAA** 13/19 guardian quorum for cross-chain messages
234
+ - **Custom bridge** Multi-relayer threshold attestations for Starknet
235
+ - **Replay protection** — Nonce-based action deduplication on all chains
236
+ - **Post-conditions** — Protocol-level spending caps on Stacks
179
237
 
180
238
  ## Browser Support
181
239
 
182
- WebAuthn requires a secure context (HTTPS) and a compatible browser:
240
+ WebAuthn requires HTTPS and a compatible browser:
183
241
 
184
242
  | Browser | Minimum Version |
185
243
  |---------|-----------------|
@@ -188,20 +246,13 @@ WebAuthn requires a secure context (HTTPS) and a compatible browser:
188
246
  | Safari | 14+ |
189
247
  | Edge | 18+ |
190
248
 
191
- ## TypeScript
192
-
193
- Full TypeScript support with comprehensive type definitions:
249
+ ## Related Packages
194
250
 
195
- ```typescript
196
- import type {
197
- ChainName,
198
- NetworkType,
199
- SimpleSDKConfig,
200
- TransferParams,
201
- BridgeParams,
202
- SessionKey,
203
- } from '@veridex/sdk';
204
- ```
251
+ | Package | Description |
252
+ |---------|-------------|
253
+ | [`@veridex/agentic-payments`](https://www.npmjs.com/package/@veridex/agentic-payments) | Agent payment SDK — x402, UCP, ACP, AP2 |
254
+ | `@veridex/relayer` | Transaction relayer for gasless execution |
255
+ | `@veridex/contracts` | Smart contracts (EVM, Solana, Aptos, Sui, Starknet, Stacks) |
205
256
 
206
257
  ## License
207
258
 
@@ -209,7 +260,8 @@ MIT
209
260
 
210
261
  ## Links
211
262
 
212
- - [Documentation](https://docs.veridex.io)
263
+ - [Documentation](https://docs.veridex.network)
213
264
  - [GitHub](https://github.com/Veridex-Protocol/sdk)
265
+ - [npm](https://www.npmjs.com/package/@veridex/sdk)
214
266
  - [Discord](https://discord.gg/veridex)
215
267
  - [Twitter](https://twitter.com/VeridexProtocol)
@@ -1,5 +1,5 @@
1
1
  import { Aptos } from '@aptos-labs/ts-sdk';
2
- import { C as ChainClient, a as ChainConfig, T as TransferParams, E as ExecuteParams, B as BridgeParams, W as WebAuthnSignature, D as DispatchResult, V as VaultCreationResult } from '../../types-ChIsqCiw.mjs';
2
+ import { f as ChainClient, a as ChainConfig, T as TransferParams, E as ExecuteParams, B as BridgeParams, w as WebAuthnSignature, D as DispatchResult, j as VaultCreationResult } from '../../types-DakHNZIP.mjs';
3
3
 
4
4
  /**
5
5
  * Veridex Protocol SDK - Aptos Chain Client
@@ -1,5 +1,5 @@
1
1
  import { Aptos } from '@aptos-labs/ts-sdk';
2
- import { C as ChainClient, a as ChainConfig, T as TransferParams, E as ExecuteParams, B as BridgeParams, W as WebAuthnSignature, D as DispatchResult, V as VaultCreationResult } from '../../types-ChIsqCiw.js';
2
+ import { f as ChainClient, a as ChainConfig, T as TransferParams, E as ExecuteParams, B as BridgeParams, w as WebAuthnSignature, D as DispatchResult, j as VaultCreationResult } from '../../types-DakHNZIP.js';
3
3
 
4
4
  /**
5
5
  * Veridex Protocol SDK - Aptos Chain Client
@@ -1,5 +1,5 @@
1
- export { c as EVMClient, e as EVMClientConfig, E as EVMHubClientAdapter } from '../../index-eadz7SCP.mjs';
1
+ export { E as EVMClient, e as EVMClientConfig, c as EVMHubClientAdapter } from '../../index-Dy29mvBf.mjs';
2
2
  import '../../types.mjs';
3
3
  import 'ethers';
4
- import '../../types-ChIsqCiw.mjs';
5
- import '../../types-FJL7j6gQ.mjs';
4
+ import '../../types-DakHNZIP.mjs';
5
+ import '../../types-DvFRnIBd.mjs';
@@ -1,5 +1,5 @@
1
- export { c as EVMClient, e as EVMClientConfig, E as EVMHubClientAdapter } from '../../index-ruSjoF2m.js';
1
+ export { E as EVMClient, e as EVMClientConfig, c as EVMHubClientAdapter } from '../../index-eXXqodd0.js';
2
2
  import '../../types.js';
3
3
  import 'ethers';
4
- import '../../types-ChIsqCiw.js';
5
- import '../../types-FJL7j6gQ.js';
4
+ import '../../types-DakHNZIP.js';
5
+ import '../../types-DvFRnIBd.js';
@@ -1,6 +1,6 @@
1
1
  import * as _solana_web3_js from '@solana/web3.js';
2
2
  import { Connection, PublicKey } from '@solana/web3.js';
3
- import { C as ChainClient, a as ChainConfig, T as TransferParams, E as ExecuteParams, B as BridgeParams, W as WebAuthnSignature, D as DispatchResult, V as VaultCreationResult } from '../../types-ChIsqCiw.mjs';
3
+ import { f as ChainClient, a as ChainConfig, T as TransferParams, E as ExecuteParams, B as BridgeParams, w as WebAuthnSignature, D as DispatchResult, j as VaultCreationResult } from '../../types-DakHNZIP.mjs';
4
4
 
5
5
  interface SolanaClientConfig {
6
6
  wormholeChainId: number;
@@ -1,6 +1,6 @@
1
1
  import * as _solana_web3_js from '@solana/web3.js';
2
2
  import { Connection, PublicKey } from '@solana/web3.js';
3
- import { C as ChainClient, a as ChainConfig, T as TransferParams, E as ExecuteParams, B as BridgeParams, W as WebAuthnSignature, D as DispatchResult, V as VaultCreationResult } from '../../types-ChIsqCiw.js';
3
+ import { f as ChainClient, a as ChainConfig, T as TransferParams, E as ExecuteParams, B as BridgeParams, w as WebAuthnSignature, D as DispatchResult, j as VaultCreationResult } from '../../types-DakHNZIP.js';
4
4
 
5
5
  interface SolanaClientConfig {
6
6
  wormholeChainId: number;