@vultisig/sdk 0.1.0-alpha.1 → 0.1.0
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 +21 -30
- package/package.json +2 -8
package/README.md
CHANGED
|
@@ -25,18 +25,14 @@ npm install @vultisig/sdk
|
|
|
25
25
|
### 1. Initialize the SDK
|
|
26
26
|
|
|
27
27
|
```typescript
|
|
28
|
-
|
|
29
|
-
import { Vultisig, MemoryStorage } from "@vultisig/sdk/node";
|
|
30
|
-
|
|
31
|
-
// Browser
|
|
32
|
-
// import { Vultisig, MemoryStorage } from "@vultisig/sdk/browser";
|
|
28
|
+
import { Vultisig, MemoryStorage } from '@vultisig/sdk'
|
|
33
29
|
|
|
34
30
|
const sdk = new Vultisig({
|
|
35
31
|
storage: new MemoryStorage()
|
|
36
|
-
})
|
|
32
|
+
})
|
|
37
33
|
|
|
38
34
|
// Initialize WASM modules
|
|
39
|
-
await sdk.initialize()
|
|
35
|
+
await sdk.initialize()
|
|
40
36
|
```
|
|
41
37
|
|
|
42
38
|
### 2. Create a Fast Vault (Server-Assisted)
|
|
@@ -115,12 +111,13 @@ The SDK works with any JavaScript framework. Here's a React example:
|
|
|
115
111
|
### React Component Example
|
|
116
112
|
|
|
117
113
|
```typescript
|
|
118
|
-
import { Vultisig,
|
|
114
|
+
import { Vultisig, MemoryStorage } from '@vultisig/sdk'
|
|
115
|
+
import type { VaultBase } from '@vultisig/sdk'
|
|
119
116
|
import { useState, useEffect } from 'react'
|
|
120
117
|
|
|
121
118
|
function VaultApp() {
|
|
122
119
|
const [sdk] = useState(() => new Vultisig({ storage: new MemoryStorage() }))
|
|
123
|
-
const [vault, setVault] = useState<
|
|
120
|
+
const [vault, setVault] = useState<VaultBase | null>(null)
|
|
124
121
|
const [addresses, setAddresses] = useState<Record<string, string>>({})
|
|
125
122
|
|
|
126
123
|
useEffect(() => {
|
|
@@ -313,7 +310,7 @@ See the `/examples` directory for complete sample applications:
|
|
|
313
310
|
|
|
314
311
|
## Requirements
|
|
315
312
|
|
|
316
|
-
- Node.js
|
|
313
|
+
- Node.js 20+
|
|
317
314
|
- Modern browser with WebAssembly support
|
|
318
315
|
- Network access for VultiServer communication (for Fast Vault features)
|
|
319
316
|
|
|
@@ -349,7 +346,7 @@ The WASM files (`dkls.wasm`, `schnorr.wasm`) may fail to load properly in Node.j
|
|
|
349
346
|
|
|
350
347
|
### Prerequisites
|
|
351
348
|
|
|
352
|
-
- Node.js
|
|
349
|
+
- Node.js 20+
|
|
353
350
|
- Yarn 4.x
|
|
354
351
|
|
|
355
352
|
### Setup
|
|
@@ -367,31 +364,25 @@ yarn install
|
|
|
367
364
|
|
|
368
365
|
### Building
|
|
369
366
|
|
|
370
|
-
The SDK bundles functionality from workspace packages (`core/` and `lib/`) into a single distributable package.
|
|
367
|
+
The SDK bundles functionality from workspace packages (`packages/core/` and `packages/lib/`) into a single distributable package.
|
|
371
368
|
|
|
372
369
|
```bash
|
|
373
370
|
# Build the SDK (from root directory)
|
|
374
371
|
yarn workspace @vultisig/sdk build
|
|
375
|
-
|
|
376
|
-
# Or using npm scripts (from src/ directory)
|
|
377
|
-
cd src && npm run build
|
|
378
372
|
```
|
|
379
373
|
|
|
380
|
-
This creates the distributable package in `
|
|
374
|
+
This creates the distributable package in `packages/sdk/dist/` with all dependencies bundled.
|
|
381
375
|
|
|
382
376
|
### Testing
|
|
383
377
|
|
|
384
378
|
```bash
|
|
385
379
|
# Run tests (from root directory)
|
|
386
380
|
yarn workspace @vultisig/sdk test
|
|
387
|
-
|
|
388
|
-
# Or from src/ directory
|
|
389
|
-
cd src && npm test
|
|
390
381
|
```
|
|
391
382
|
|
|
392
383
|
### Development Workflow
|
|
393
384
|
|
|
394
|
-
1. **Make changes** to SDK code in `src/` or workspace packages in `core/`/`lib/`
|
|
385
|
+
1. **Make changes** to SDK code in `packages/sdk/src/` or workspace packages in `packages/core/`/`packages/lib/`
|
|
395
386
|
2. **Build**: `yarn workspace @vultisig/sdk build`
|
|
396
387
|
3. **Test**: `yarn workspace @vultisig/sdk test`
|
|
397
388
|
4. **Lint**: `yarn lint` (from root)
|
|
@@ -399,26 +390,26 @@ cd src && npm test
|
|
|
399
390
|
### Project Structure
|
|
400
391
|
|
|
401
392
|
```
|
|
402
|
-
|
|
403
|
-
├──
|
|
404
|
-
├──
|
|
405
|
-
├──
|
|
406
|
-
├──
|
|
407
|
-
├──
|
|
393
|
+
packages/sdk/
|
|
394
|
+
├── src/ # SDK source code
|
|
395
|
+
│ ├── chains/ # Address derivation and chain management
|
|
396
|
+
│ ├── mpc/ # Multi-party computation logic
|
|
397
|
+
│ ├── vault/ # Vault creation and management
|
|
398
|
+
│ ├── server/ # Fast vault server integration
|
|
399
|
+
│ └── wasm/ # WASM module management
|
|
408
400
|
├── tests/ # Test suite
|
|
409
|
-
├── rollup.config.js # Build configuration
|
|
410
401
|
└── package.json # SDK package configuration
|
|
411
402
|
|
|
412
403
|
# Workspace packages (bundled into SDK)
|
|
413
|
-
|
|
414
|
-
|
|
404
|
+
packages/core/ # Core blockchain functionality
|
|
405
|
+
packages/lib/ # Shared libraries and utilities
|
|
415
406
|
```
|
|
416
407
|
|
|
417
408
|
## Contributing
|
|
418
409
|
|
|
419
410
|
1. Fork the repository
|
|
420
411
|
2. Install dependencies from root: `yarn install`
|
|
421
|
-
3. Make your changes in `src/` or workspace packages
|
|
412
|
+
3. Make your changes in `packages/sdk/src/` or workspace packages
|
|
422
413
|
4. Run tests: `yarn workspace @vultisig/sdk test`
|
|
423
414
|
5. Build: `yarn workspace @vultisig/sdk build`
|
|
424
415
|
6. Submit a pull request
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vultisig/sdk",
|
|
3
|
-
"version": "0.1.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "TypeScript SDK for secure multi-party computation and blockchain operations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.node.cjs",
|
|
@@ -107,13 +107,7 @@
|
|
|
107
107
|
"7z-wasm": "^1.2.0",
|
|
108
108
|
"@bufbuild/protobuf": "^2.7.0",
|
|
109
109
|
"@coral-xyz/anchor": "^0.31.1",
|
|
110
|
-
"@core/chain": "workspace:^",
|
|
111
|
-
"@core/config": "workspace:^",
|
|
112
|
-
"@core/mpc": "workspace:^",
|
|
113
110
|
"@cosmjs/stargate": "^0.36.0",
|
|
114
|
-
"@lib/dkls": "workspace:^",
|
|
115
|
-
"@lib/schnorr": "workspace:^",
|
|
116
|
-
"@lib/utils": "workspace:^",
|
|
117
111
|
"@lifi/sdk": "^3.12.2",
|
|
118
112
|
"@mysten/sui": "^1.37.6",
|
|
119
113
|
"@noble/hashes": "^2.0.0",
|
|
@@ -167,6 +161,6 @@
|
|
|
167
161
|
"registry": "https://registry.npmjs.org/"
|
|
168
162
|
},
|
|
169
163
|
"engines": {
|
|
170
|
-
"node": ">=
|
|
164
|
+
"node": ">=20.0.0"
|
|
171
165
|
}
|
|
172
166
|
}
|