@vauban/glacis-sdk 1.0.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 +124 -0
- package/dist/GlacisClient.d.ts +48 -0
- package/dist/GlacisClient.d.ts.map +1 -0
- package/dist/GlacisClient.js +201 -0
- package/dist/GlacisClient.js.map +1 -0
- package/dist/constants.d.ts +23 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +32 -0
- package/dist/constants.js.map +1 -0
- package/dist/errors.d.ts +24 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +38 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +42 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +37 -0
package/README.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# @vauban/glacis-sdk
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for [Glacis Protocol](https://github.com/vauban-org/glacis-protocol) -- post-quantum Proof of Humanity on Starknet.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @vauban/glacis-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { GlacisClient } from '@vauban/glacis-sdk';
|
|
15
|
+
|
|
16
|
+
const glacis = new GlacisClient({ network: 'starknet-sepolia' });
|
|
17
|
+
|
|
18
|
+
// Check if a wallet is a verified human (free on-chain read)
|
|
19
|
+
const isHuman = await glacis.isVerifiedHuman('0x03C31f...');
|
|
20
|
+
console.log(isHuman); // true or false
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## API Reference
|
|
24
|
+
|
|
25
|
+
### `GlacisClient`
|
|
26
|
+
|
|
27
|
+
#### Constructor
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
const glacis = new GlacisClient({
|
|
31
|
+
network: 'starknet-sepolia', // or 'starknet-mainnet'
|
|
32
|
+
providerUrl: '...', // optional: custom RPC endpoint
|
|
33
|
+
contractAddress: '0x...', // optional: custom verifier address
|
|
34
|
+
attestationTokenAddress: '0x...', // optional: custom attestation address
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
#### `isVerifiedHuman(wallet: string): Promise<boolean>`
|
|
39
|
+
|
|
40
|
+
Check if a wallet has a valid, non-expired, non-revoked human attestation. Free on-chain read.
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
const isHuman = await glacis.isVerifiedHuman('0x03C31f...');
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
#### `getScopedIdentity(wallet: string, appDomain: string): Promise<string>`
|
|
47
|
+
|
|
48
|
+
Get the scoped pseudonym for a wallet in your application domain. Different apps see different pseudonyms for the same user, preventing cross-app tracking.
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
const pseudonym = await glacis.getScopedIdentity('0x03C31f...', 'my-dapp');
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### `getAttestationExpiry(wallet: string): Promise<Date | null>`
|
|
55
|
+
|
|
56
|
+
Get the attestation expiration date. Returns `null` if no attestation exists.
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
const expiry = await glacis.getAttestationExpiry('0x03C31f...');
|
|
60
|
+
if (expiry && expiry > new Date()) {
|
|
61
|
+
console.log(`Verified until ${expiry.toISOString()}`);
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
#### `getAttestationInfo(wallet: string): Promise<AttestationInfo>`
|
|
66
|
+
|
|
67
|
+
Get full attestation details in a single call.
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
const info = await glacis.getAttestationInfo('0x03C31f...');
|
|
71
|
+
// { verified: true, expired: false, revoked: false, expiry: Date }
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
#### `submitProof(account: Account, submission: ProofSubmission): Promise<TransactionResult>`
|
|
75
|
+
|
|
76
|
+
Submit a STARK proof to the GlacisVerifier contract. Requires a starknet.js `Account` for signing.
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
import { Account, RpcProvider } from 'starknet';
|
|
80
|
+
|
|
81
|
+
const provider = new RpcProvider({ nodeUrl: '...' });
|
|
82
|
+
const account = new Account(provider, address, privateKey);
|
|
83
|
+
|
|
84
|
+
const result = await glacis.submitProof(account, {
|
|
85
|
+
proof: [...], // STARK proof felts
|
|
86
|
+
nullifier: '0x...', // deterministic nullifier
|
|
87
|
+
pseudonym: '0x...', // scoped pseudonym
|
|
88
|
+
caKeyHash: '0x...', // CA key identifier
|
|
89
|
+
});
|
|
90
|
+
console.log(result.transactionHash);
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Network Configuration
|
|
94
|
+
|
|
95
|
+
The SDK ships with built-in configurations for Sepolia and mainnet:
|
|
96
|
+
|
|
97
|
+
| Network | Contracts | RPC |
|
|
98
|
+
|---------|-----------|-----|
|
|
99
|
+
| `starknet-sepolia` | Pre-configured | `sepolia.rpc.vauban.tech` |
|
|
100
|
+
| `starknet-mainnet` | Set via constructor | `mainnet.rpc.vauban.tech` |
|
|
101
|
+
|
|
102
|
+
Override any default with constructor options.
|
|
103
|
+
|
|
104
|
+
## Error Handling
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import { GlacisError, NetworkError, ContractError, TransactionError } from '@vauban/glacis-sdk';
|
|
108
|
+
|
|
109
|
+
try {
|
|
110
|
+
await glacis.isVerifiedHuman(wallet);
|
|
111
|
+
} catch (err) {
|
|
112
|
+
if (err instanceof NetworkError) {
|
|
113
|
+
// RPC connection failed
|
|
114
|
+
} else if (err instanceof ContractError) {
|
|
115
|
+
// Contract call failed
|
|
116
|
+
} else if (err instanceof TransactionError) {
|
|
117
|
+
// Transaction submission failed
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## License
|
|
123
|
+
|
|
124
|
+
[MIT](https://github.com/vauban-org/glacis-protocol/blob/master/LICENSE)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Glacis SDK — Main client for interacting with Glacis Protocol on Starknet.
|
|
3
|
+
*
|
|
4
|
+
* Supports two modes:
|
|
5
|
+
* - Read-only (provider only): query verification status, pseudonyms, expiry
|
|
6
|
+
* - Read-write (with Account): submit proofs via verify_and_attest
|
|
7
|
+
*/
|
|
8
|
+
import { RpcProvider, Account } from 'starknet';
|
|
9
|
+
import type { GlacisConfig, AttestationInfo, TransactionResult, ProofSubmission } from './types.js';
|
|
10
|
+
export declare class GlacisClient {
|
|
11
|
+
private readonly provider;
|
|
12
|
+
private readonly verifier;
|
|
13
|
+
private readonly attestation;
|
|
14
|
+
private readonly network;
|
|
15
|
+
constructor(config: GlacisConfig);
|
|
16
|
+
/**
|
|
17
|
+
* Check if a wallet has a valid (non-expired, non-revoked) human attestation.
|
|
18
|
+
* Free on-chain read — no transaction fee.
|
|
19
|
+
*/
|
|
20
|
+
isVerifiedHuman(wallet: string): Promise<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Get the scoped pseudonym for a wallet in a given application domain.
|
|
23
|
+
* Returns '0x0' if the wallet has no attestation.
|
|
24
|
+
*/
|
|
25
|
+
getScopedIdentity(wallet: string, appDomain: string): Promise<string>;
|
|
26
|
+
/**
|
|
27
|
+
* Get the attestation expiration date for a wallet.
|
|
28
|
+
* Returns null if no attestation exists.
|
|
29
|
+
*/
|
|
30
|
+
getAttestationExpiry(wallet: string): Promise<Date | null>;
|
|
31
|
+
/**
|
|
32
|
+
* Get full attestation info for a wallet.
|
|
33
|
+
* Combines verification status, expiry, and revocation in a single call.
|
|
34
|
+
*/
|
|
35
|
+
getAttestationInfo(wallet: string): Promise<AttestationInfo>;
|
|
36
|
+
/**
|
|
37
|
+
* Submit a proof to the GlacisVerifier contract.
|
|
38
|
+
* Requires a starknet.js Account instance for transaction signing.
|
|
39
|
+
*
|
|
40
|
+
* Flow: verify STARK proof -> check CA trust -> register nullifier -> mint SBT -> collect fee
|
|
41
|
+
*/
|
|
42
|
+
submitProof(account: Account, submission: ProofSubmission): Promise<TransactionResult>;
|
|
43
|
+
/** Get the current network. */
|
|
44
|
+
getNetwork(): 'starknet-mainnet' | 'starknet-sepolia';
|
|
45
|
+
/** Get the RPC provider instance. */
|
|
46
|
+
getProvider(): RpcProvider;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=GlacisClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GlacisClient.d.ts","sourceRoot":"","sources":["../src/GlacisClient.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,OAAO,EAAyC,MAAM,UAAU,CAAC;AACvF,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AA+EpG,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAc;IACvC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAW;IACpC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAW;IACvC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0C;gBAEtD,MAAM,EAAE,YAAY;IAiChC;;;OAGG;IACG,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IASvD;;;OAGG;IACG,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAY3E;;;OAGG;IACG,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAWhE;;;OAGG;IACG,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAoBlE;;;;;OAKG;IACG,WAAW,CACf,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,eAAe,GAC1B,OAAO,CAAC,iBAAiB,CAAC;IAmB7B,+BAA+B;IAC/B,UAAU,IAAI,kBAAkB,GAAG,kBAAkB;IAIrD,qCAAqC;IACrC,WAAW,IAAI,WAAW;CAG3B"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Glacis SDK — Main client for interacting with Glacis Protocol on Starknet.
|
|
3
|
+
*
|
|
4
|
+
* Supports two modes:
|
|
5
|
+
* - Read-only (provider only): query verification status, pseudonyms, expiry
|
|
6
|
+
* - Read-write (with Account): submit proofs via verify_and_attest
|
|
7
|
+
*/
|
|
8
|
+
import { RpcProvider, Contract } from 'starknet';
|
|
9
|
+
import { ContractError, NetworkError, TransactionError } from './errors.js';
|
|
10
|
+
import { getNetworkConfig } from './constants.js';
|
|
11
|
+
/** ABI for GlacisVerifier — functions used by the SDK. */
|
|
12
|
+
const VERIFIER_ABI = [
|
|
13
|
+
{
|
|
14
|
+
type: 'function',
|
|
15
|
+
name: 'verify_and_attest',
|
|
16
|
+
inputs: [
|
|
17
|
+
{ name: 'proof', type: 'core::array::Span::<core::felt252>' },
|
|
18
|
+
{ name: 'nullifier', type: 'core::felt252' },
|
|
19
|
+
{ name: 'pseudonym', type: 'core::felt252' },
|
|
20
|
+
{ name: 'ca_key_hash', type: 'core::felt252' },
|
|
21
|
+
],
|
|
22
|
+
outputs: [],
|
|
23
|
+
state_mutability: 'external',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: 'function',
|
|
27
|
+
name: 'is_verified_human',
|
|
28
|
+
inputs: [
|
|
29
|
+
{ name: 'wallet', type: 'core::starknet::contract_address::ContractAddress' },
|
|
30
|
+
],
|
|
31
|
+
outputs: [{ type: 'core::bool' }],
|
|
32
|
+
state_mutability: 'view',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: 'function',
|
|
36
|
+
name: 'get_scoped_pseudonym',
|
|
37
|
+
inputs: [
|
|
38
|
+
{ name: 'wallet', type: 'core::starknet::contract_address::ContractAddress' },
|
|
39
|
+
{ name: 'app_domain', type: 'core::felt252' },
|
|
40
|
+
],
|
|
41
|
+
outputs: [{ type: 'core::felt252' }],
|
|
42
|
+
state_mutability: 'view',
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
/** ABI for HumanAttestationToken — expiry and revocation queries. */
|
|
46
|
+
const ATTESTATION_ABI = [
|
|
47
|
+
{
|
|
48
|
+
type: 'function',
|
|
49
|
+
name: 'is_expired',
|
|
50
|
+
inputs: [
|
|
51
|
+
{ name: 'wallet', type: 'core::starknet::contract_address::ContractAddress' },
|
|
52
|
+
],
|
|
53
|
+
outputs: [{ type: 'core::bool' }],
|
|
54
|
+
state_mutability: 'view',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: 'function',
|
|
58
|
+
name: 'is_revoked',
|
|
59
|
+
inputs: [
|
|
60
|
+
{ name: 'wallet', type: 'core::starknet::contract_address::ContractAddress' },
|
|
61
|
+
],
|
|
62
|
+
outputs: [{ type: 'core::bool' }],
|
|
63
|
+
state_mutability: 'view',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
type: 'function',
|
|
67
|
+
name: 'get_expiration',
|
|
68
|
+
inputs: [
|
|
69
|
+
{ name: 'wallet', type: 'core::starknet::contract_address::ContractAddress' },
|
|
70
|
+
],
|
|
71
|
+
outputs: [{ type: 'core::integer::u64' }],
|
|
72
|
+
state_mutability: 'view',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
type: 'function',
|
|
76
|
+
name: 'is_verified',
|
|
77
|
+
inputs: [
|
|
78
|
+
{ name: 'wallet', type: 'core::starknet::contract_address::ContractAddress' },
|
|
79
|
+
],
|
|
80
|
+
outputs: [{ type: 'core::bool' }],
|
|
81
|
+
state_mutability: 'view',
|
|
82
|
+
},
|
|
83
|
+
];
|
|
84
|
+
export class GlacisClient {
|
|
85
|
+
provider;
|
|
86
|
+
verifier;
|
|
87
|
+
attestation;
|
|
88
|
+
network;
|
|
89
|
+
constructor(config) {
|
|
90
|
+
const networkConfig = getNetworkConfig(config.network);
|
|
91
|
+
const verifierAddr = config.contractAddress ?? networkConfig.verifierAddress;
|
|
92
|
+
if (!verifierAddr) {
|
|
93
|
+
throw new NetworkError('No verifier contract address configured. ' +
|
|
94
|
+
'Set contractAddress in GlacisConfig or update MAINNET_CONFIG in constants.ts after deployment.');
|
|
95
|
+
}
|
|
96
|
+
this.network = config.network;
|
|
97
|
+
this.provider = new RpcProvider({
|
|
98
|
+
nodeUrl: config.providerUrl ?? networkConfig.rpcUrl,
|
|
99
|
+
});
|
|
100
|
+
this.verifier = new Contract(VERIFIER_ABI, verifierAddr, this.provider);
|
|
101
|
+
const attestationAddr = config.attestationTokenAddress ?? networkConfig.attestationTokenAddress;
|
|
102
|
+
if (!attestationAddr) {
|
|
103
|
+
throw new NetworkError('No attestation token address configured. ' +
|
|
104
|
+
'Set attestationTokenAddress in GlacisConfig or update MAINNET_CONFIG in constants.ts after deployment.');
|
|
105
|
+
}
|
|
106
|
+
this.attestation = new Contract(ATTESTATION_ABI, attestationAddr, this.provider);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Check if a wallet has a valid (non-expired, non-revoked) human attestation.
|
|
110
|
+
* Free on-chain read — no transaction fee.
|
|
111
|
+
*/
|
|
112
|
+
async isVerifiedHuman(wallet) {
|
|
113
|
+
try {
|
|
114
|
+
const result = await this.verifier.call('is_verified_human', [wallet]);
|
|
115
|
+
return Boolean(result);
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
throw new ContractError('Failed to query verification status', err);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Get the scoped pseudonym for a wallet in a given application domain.
|
|
123
|
+
* Returns '0x0' if the wallet has no attestation.
|
|
124
|
+
*/
|
|
125
|
+
async getScopedIdentity(wallet, appDomain) {
|
|
126
|
+
try {
|
|
127
|
+
const result = await this.verifier.call('get_scoped_pseudonym', [
|
|
128
|
+
wallet,
|
|
129
|
+
appDomain,
|
|
130
|
+
]);
|
|
131
|
+
return String(result);
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
throw new ContractError('Failed to query scoped pseudonym', err);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Get the attestation expiration date for a wallet.
|
|
139
|
+
* Returns null if no attestation exists.
|
|
140
|
+
*/
|
|
141
|
+
async getAttestationExpiry(wallet) {
|
|
142
|
+
try {
|
|
143
|
+
const result = await this.attestation.call('get_expiration', [wallet]);
|
|
144
|
+
const timestamp = Number(result);
|
|
145
|
+
if (timestamp === 0)
|
|
146
|
+
return null;
|
|
147
|
+
return new Date(timestamp * 1000);
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
throw new ContractError('Failed to query attestation expiry', err);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Get full attestation info for a wallet.
|
|
155
|
+
* Combines verification status, expiry, and revocation in a single call.
|
|
156
|
+
*/
|
|
157
|
+
async getAttestationInfo(wallet) {
|
|
158
|
+
try {
|
|
159
|
+
const [verified, expired, revoked, expiration] = await Promise.all([
|
|
160
|
+
this.attestation.call('is_verified', [wallet]).then(Boolean),
|
|
161
|
+
this.attestation.call('is_expired', [wallet]).then(Boolean),
|
|
162
|
+
this.attestation.call('is_revoked', [wallet]).then(Boolean),
|
|
163
|
+
this.attestation.call('get_expiration', [wallet]).then(Number),
|
|
164
|
+
]);
|
|
165
|
+
return {
|
|
166
|
+
verified,
|
|
167
|
+
expired,
|
|
168
|
+
revoked,
|
|
169
|
+
expiry: expiration === 0 ? null : new Date(expiration * 1000),
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
catch (err) {
|
|
173
|
+
throw new ContractError('Failed to query attestation info', err);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Submit a proof to the GlacisVerifier contract.
|
|
178
|
+
* Requires a starknet.js Account instance for transaction signing.
|
|
179
|
+
*
|
|
180
|
+
* Flow: verify STARK proof -> check CA trust -> register nullifier -> mint SBT -> collect fee
|
|
181
|
+
*/
|
|
182
|
+
async submitProof(account, submission) {
|
|
183
|
+
try {
|
|
184
|
+
const connectedVerifier = new Contract(VERIFIER_ABI, this.verifier.address, account);
|
|
185
|
+
const result = await connectedVerifier.invoke('verify_and_attest', [submission.proof, submission.nullifier, submission.pseudonym, submission.caKeyHash]);
|
|
186
|
+
return { transactionHash: result.transaction_hash };
|
|
187
|
+
}
|
|
188
|
+
catch (err) {
|
|
189
|
+
throw new TransactionError('Proof submission failed', err);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/** Get the current network. */
|
|
193
|
+
getNetwork() {
|
|
194
|
+
return this.network;
|
|
195
|
+
}
|
|
196
|
+
/** Get the RPC provider instance. */
|
|
197
|
+
getProvider() {
|
|
198
|
+
return this.provider;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=GlacisClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GlacisClient.js","sourceRoot":"","sources":["../src/GlacisClient.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAW,QAAQ,EAA+B,MAAM,UAAU,CAAC;AAEvF,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,0DAA0D;AAC1D,MAAM,YAAY,GAAG;IACnB;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,mBAAmB;QACzB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nE,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,WAAW,CACf,OAAgB,EAChB,UAA2B;QAE3B,IAAI,CAAC;YACH,MAAM,iBAAiB,GAAG,IAAI,QAAQ,CACpC,YAAY,EACZ,IAAI,CAAC,QAAQ,CAAC,OAAO,EACrB,OAAO,CACR,CAAC;YAEF,MAAM,MAAM,GAA2B,MAAM,iBAAiB,CAAC,MAAM,CACnE,mBAAmB,EACnB,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,SAAS,EAAE,UAAU,CAAC,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,CACrF,CAAC;YAEF,OAAO,EAAE,eAAe,EAAE,MAAM,CAAC,gBAAgB,EAAE,CAAC;QACtD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,IAAI,gBAAgB,CAAC,yBAAyB,EAAE,GAAG,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IAED,+BAA+B;IAC/B,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,qCAAqC;IACrC,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Glacis SDK — Network configurations and contract addresses.
|
|
3
|
+
*/
|
|
4
|
+
export interface NetworkConfig {
|
|
5
|
+
rpcUrl: string;
|
|
6
|
+
verifierAddress: string;
|
|
7
|
+
attestationTokenAddress: string;
|
|
8
|
+
explorerBaseUrl: string;
|
|
9
|
+
}
|
|
10
|
+
/** Starknet Sepolia testnet deployment. */
|
|
11
|
+
export declare const SEPOLIA_CONFIG: NetworkConfig;
|
|
12
|
+
/**
|
|
13
|
+
* Starknet mainnet deployment.
|
|
14
|
+
*
|
|
15
|
+
* Addresses are placeholders until deploy-mainnet.sh is run.
|
|
16
|
+
* After deployment, update these with real addresses from deployments/mainnet.json.
|
|
17
|
+
*/
|
|
18
|
+
export declare const MAINNET_CONFIG: NetworkConfig;
|
|
19
|
+
/** Resolve a network name to its configuration. */
|
|
20
|
+
export declare function getNetworkConfig(network: 'starknet-mainnet' | 'starknet-sepolia'): NetworkConfig;
|
|
21
|
+
/** Build a Starkscan URL for a transaction. */
|
|
22
|
+
export declare function explorerTxUrl(network: 'starknet-mainnet' | 'starknet-sepolia', txHash: string): string;
|
|
23
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,uBAAuB,EAAE,MAAM,CAAC;IAChC,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,2CAA2C;AAC3C,eAAO,MAAM,cAAc,EAAE,aAO5B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,aAK5B,CAAC;AAEF,mDAAmD;AACnD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,kBAAkB,GAAG,kBAAkB,GAC/C,aAAa,CAEf;AAED,+CAA+C;AAC/C,wBAAgB,aAAa,CAC3B,OAAO,EAAE,kBAAkB,GAAG,kBAAkB,EAChD,MAAM,EAAE,MAAM,GACb,MAAM,CAGR"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Glacis SDK — Network configurations and contract addresses.
|
|
3
|
+
*/
|
|
4
|
+
/** Starknet Sepolia testnet deployment. */
|
|
5
|
+
export const SEPOLIA_CONFIG = {
|
|
6
|
+
rpcUrl: 'https://sepolia.rpc.vauban.tech/rpc/v0_7',
|
|
7
|
+
verifierAddress: '0x051814c8a17ace1491a7203d9fac2525a32c0813fe44d78bb96ba8bd8737cf9c',
|
|
8
|
+
attestationTokenAddress: '0x0082d381f17ac9490c0de35f95f86916bececebb2a472398f64514982a5bf54c',
|
|
9
|
+
explorerBaseUrl: 'https://sepolia.starkscan.co',
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Starknet mainnet deployment.
|
|
13
|
+
*
|
|
14
|
+
* Addresses are placeholders until deploy-mainnet.sh is run.
|
|
15
|
+
* After deployment, update these with real addresses from deployments/mainnet.json.
|
|
16
|
+
*/
|
|
17
|
+
export const MAINNET_CONFIG = {
|
|
18
|
+
rpcUrl: 'https://mainnet.rpc.vauban.tech/rpc/v0_7',
|
|
19
|
+
verifierAddress: '',
|
|
20
|
+
attestationTokenAddress: '',
|
|
21
|
+
explorerBaseUrl: 'https://voyager.online',
|
|
22
|
+
};
|
|
23
|
+
/** Resolve a network name to its configuration. */
|
|
24
|
+
export function getNetworkConfig(network) {
|
|
25
|
+
return network === 'starknet-mainnet' ? MAINNET_CONFIG : SEPOLIA_CONFIG;
|
|
26
|
+
}
|
|
27
|
+
/** Build a Starkscan URL for a transaction. */
|
|
28
|
+
export function explorerTxUrl(network, txHash) {
|
|
29
|
+
const config = getNetworkConfig(network);
|
|
30
|
+
return `${config.explorerBaseUrl}/tx/${txHash}`;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,2CAA2C;AAC3C,MAAM,CAAC,MAAM,cAAc,GAAkB;IAC3C,MAAM,EAAE,0CAA0C;IAClD,eAAe,EACb,oEAAoE;IACtE,uBAAuB,EACrB,oEAAoE;IACtE,eAAe,EAAE,8BAA8B;CAChD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAkB;IAC3C,MAAM,EAAE,0CAA0C;IAClD,eAAe,EAAE,EAAE;IACnB,uBAAuB,EAAE,EAAE;IAC3B,eAAe,EAAE,wBAAwB;CAC1C,CAAC;AAEF,mDAAmD;AACnD,MAAM,UAAU,gBAAgB,CAC9B,OAAgD;IAEhD,OAAO,OAAO,KAAK,kBAAkB,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC;AAC1E,CAAC;AAED,+CAA+C;AAC/C,MAAM,UAAU,aAAa,CAC3B,OAAgD,EAChD,MAAc;IAEd,MAAM,MAAM,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACzC,OAAO,GAAG,MAAM,CAAC,eAAe,OAAO,MAAM,EAAE,CAAC;AAClD,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Glacis SDK — Error hierarchy.
|
|
3
|
+
*/
|
|
4
|
+
/** Base error for all Glacis SDK errors. */
|
|
5
|
+
export declare class GlacisError extends Error {
|
|
6
|
+
constructor(message: string);
|
|
7
|
+
}
|
|
8
|
+
/** Thrown when network configuration is invalid. */
|
|
9
|
+
export declare class NetworkError extends GlacisError {
|
|
10
|
+
constructor(message: string);
|
|
11
|
+
}
|
|
12
|
+
/** Thrown when a contract call fails. */
|
|
13
|
+
export declare class ContractError extends GlacisError {
|
|
14
|
+
/** The underlying RPC error, if available. */
|
|
15
|
+
readonly cause: unknown;
|
|
16
|
+
constructor(message: string, cause?: unknown);
|
|
17
|
+
}
|
|
18
|
+
/** Thrown when a proof submission transaction fails. */
|
|
19
|
+
export declare class TransactionError extends GlacisError {
|
|
20
|
+
/** The underlying RPC error, if available. */
|
|
21
|
+
readonly cause: unknown;
|
|
22
|
+
constructor(message: string, cause?: unknown);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,4CAA4C;AAC5C,qBAAa,WAAY,SAAQ,KAAK;gBACxB,OAAO,EAAE,MAAM;CAI5B;AAED,oDAAoD;AACpD,qBAAa,YAAa,SAAQ,WAAW;gBAC/B,OAAO,EAAE,MAAM;CAI5B;AAED,yCAAyC;AACzC,qBAAa,aAAc,SAAQ,WAAW;IAC5C,8CAA8C;IAC9C,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;gBAEZ,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAK7C;AAED,wDAAwD;AACxD,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C,8CAA8C;IAC9C,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;gBAEZ,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAK7C"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Glacis SDK — Error hierarchy.
|
|
3
|
+
*/
|
|
4
|
+
/** Base error for all Glacis SDK errors. */
|
|
5
|
+
export class GlacisError extends Error {
|
|
6
|
+
constructor(message) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = 'GlacisError';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/** Thrown when network configuration is invalid. */
|
|
12
|
+
export class NetworkError extends GlacisError {
|
|
13
|
+
constructor(message) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.name = 'NetworkError';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/** Thrown when a contract call fails. */
|
|
19
|
+
export class ContractError extends GlacisError {
|
|
20
|
+
/** The underlying RPC error, if available. */
|
|
21
|
+
cause;
|
|
22
|
+
constructor(message, cause) {
|
|
23
|
+
super(message);
|
|
24
|
+
this.name = 'ContractError';
|
|
25
|
+
this.cause = cause;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** Thrown when a proof submission transaction fails. */
|
|
29
|
+
export class TransactionError extends GlacisError {
|
|
30
|
+
/** The underlying RPC error, if available. */
|
|
31
|
+
cause;
|
|
32
|
+
constructor(message, cause) {
|
|
33
|
+
super(message);
|
|
34
|
+
this.name = 'TransactionError';
|
|
35
|
+
this.cause = cause;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,4CAA4C;AAC5C,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AAED,oDAAoD;AACpD,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAED,yCAAyC;AACzC,MAAM,OAAO,aAAc,SAAQ,WAAW;IAC5C,8CAA8C;IACrC,KAAK,CAAU;IAExB,YAAY,OAAe,EAAE,KAAe;QAC1C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AAED,wDAAwD;AACxD,MAAM,OAAO,gBAAiB,SAAQ,WAAW;IAC/C,8CAA8C;IACrC,KAAK,CAAU;IAExB,YAAY,OAAe,EAAE,KAAe;QAC1C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vauban/glacis-sdk — Glacis Protocol SDK for Starknet.
|
|
3
|
+
*
|
|
4
|
+
* Query human verification status, scoped pseudonyms, and submit proofs.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { GlacisClient } from '@vauban/glacis-sdk';
|
|
9
|
+
*
|
|
10
|
+
* const client = new GlacisClient({ network: 'starknet-sepolia' });
|
|
11
|
+
* const isHuman = await client.isVerifiedHuman('0x123...');
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export { GlacisClient } from './GlacisClient.js';
|
|
15
|
+
export { GlacisError, NetworkError, ContractError, TransactionError } from './errors.js';
|
|
16
|
+
export { getNetworkConfig, explorerTxUrl, SEPOLIA_CONFIG, MAINNET_CONFIG } from './constants.js';
|
|
17
|
+
export type { GlacisConfig, AttestationInfo, TransactionResult, ProofSubmission, } from './types.js';
|
|
18
|
+
export type { NetworkConfig } from './constants.js';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACjG,YAAY,EACV,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vauban/glacis-sdk — Glacis Protocol SDK for Starknet.
|
|
3
|
+
*
|
|
4
|
+
* Query human verification status, scoped pseudonyms, and submit proofs.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { GlacisClient } from '@vauban/glacis-sdk';
|
|
9
|
+
*
|
|
10
|
+
* const client = new GlacisClient({ network: 'starknet-sepolia' });
|
|
11
|
+
* const isHuman = await client.isVerifiedHuman('0x123...');
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export { GlacisClient } from './GlacisClient.js';
|
|
15
|
+
export { GlacisError, NetworkError, ContractError, TransactionError } from './errors.js';
|
|
16
|
+
export { getNetworkConfig, explorerTxUrl, SEPOLIA_CONFIG, MAINNET_CONFIG } from './constants.js';
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Glacis SDK — Type definitions.
|
|
3
|
+
*/
|
|
4
|
+
/** SDK configuration. */
|
|
5
|
+
export interface GlacisConfig {
|
|
6
|
+
/** Target network. */
|
|
7
|
+
network: 'starknet-mainnet' | 'starknet-sepolia';
|
|
8
|
+
/** Custom RPC endpoint URL. Overrides the default for the selected network. */
|
|
9
|
+
providerUrl?: string;
|
|
10
|
+
/** Custom GlacisVerifier contract address. Overrides the default deployment. */
|
|
11
|
+
contractAddress?: string;
|
|
12
|
+
/** Custom HumanAttestationToken contract address. Overrides the default deployment. */
|
|
13
|
+
attestationTokenAddress?: string;
|
|
14
|
+
}
|
|
15
|
+
/** Human attestation status for a wallet. */
|
|
16
|
+
export interface AttestationInfo {
|
|
17
|
+
/** Whether the wallet has a valid (non-expired, non-revoked) attestation. */
|
|
18
|
+
verified: boolean;
|
|
19
|
+
/** Expiration timestamp (Date), or null if no attestation exists. */
|
|
20
|
+
expiry: Date | null;
|
|
21
|
+
/** Whether the attestation has been revoked. */
|
|
22
|
+
revoked: boolean;
|
|
23
|
+
/** Whether the attestation has expired. */
|
|
24
|
+
expired: boolean;
|
|
25
|
+
}
|
|
26
|
+
/** Result of a proof submission transaction. */
|
|
27
|
+
export interface TransactionResult {
|
|
28
|
+
/** Transaction hash on Starknet. */
|
|
29
|
+
transactionHash: string;
|
|
30
|
+
}
|
|
31
|
+
/** Proof submission parameters. */
|
|
32
|
+
export interface ProofSubmission {
|
|
33
|
+
/** STARK proof elements (felt252 hex strings). */
|
|
34
|
+
proof: string[];
|
|
35
|
+
/** Deterministic nullifier (felt252 hex). */
|
|
36
|
+
nullifier: string;
|
|
37
|
+
/** Scoped pseudonym (felt252 hex). */
|
|
38
|
+
pseudonym: string;
|
|
39
|
+
/** CA public key hash (felt252 hex). */
|
|
40
|
+
caKeyHash: string;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,yBAAyB;AACzB,MAAM,WAAW,YAAY;IAC3B,sBAAsB;IACtB,OAAO,EAAE,kBAAkB,GAAG,kBAAkB,CAAC;IACjD,+EAA+E;IAC/E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uFAAuF;IACvF,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,6CAA6C;AAC7C,MAAM,WAAW,eAAe;IAC9B,6EAA6E;IAC7E,QAAQ,EAAE,OAAO,CAAC;IAClB,qEAAqE;IACrE,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC;IACpB,gDAAgD;IAChD,OAAO,EAAE,OAAO,CAAC;IACjB,2CAA2C;IAC3C,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,gDAAgD;AAChD,MAAM,WAAW,iBAAiB;IAChC,oCAAoC;IACpC,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,mCAAmC;AACnC,MAAM,WAAW,eAAe;IAC9B,kDAAkD;IAClD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vauban/glacis-sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "TypeScript SDK for Glacis Protocol — Proof of Humanity on Starknet",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc",
|
|
13
|
+
"test": "vitest run",
|
|
14
|
+
"test:watch": "vitest",
|
|
15
|
+
"lint": "tsc --noEmit"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"starknet",
|
|
19
|
+
"proof-of-humanity",
|
|
20
|
+
"stark",
|
|
21
|
+
"zk",
|
|
22
|
+
"glacis",
|
|
23
|
+
"vauban"
|
|
24
|
+
],
|
|
25
|
+
"author": "Vauban",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"starknet": "^6.24.1"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"typescript": "^5.7.0",
|
|
32
|
+
"vitest": "^3.0.0"
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=20.0.0"
|
|
36
|
+
}
|
|
37
|
+
}
|