@sip-protocol/sdk 0.1.0 → 0.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/dist/index.d.mts +3236 -1554
- package/dist/index.d.ts +3236 -1554
- package/dist/index.js +9185 -3521
- package/dist/index.mjs +8995 -3376
- package/package.json +5 -2
- package/src/adapters/near-intents.ts +48 -35
- package/src/adapters/oneclick-client.ts +9 -1
- package/src/compliance/compliance-manager.ts +1035 -0
- package/src/compliance/index.ts +43 -0
- package/src/index.ts +129 -2
- package/src/payment/index.ts +54 -0
- package/src/payment/payment.ts +623 -0
- package/src/payment/stablecoins.ts +306 -0
- package/src/privacy.ts +127 -94
- package/src/proofs/circuits/fulfillment_proof.json +1 -0
- package/src/proofs/circuits/funding_proof.json +1 -0
- package/src/proofs/circuits/validity_proof.json +1 -0
- package/src/proofs/interface.ts +13 -1
- package/src/proofs/noir.ts +967 -97
- package/src/secure-memory.ts +147 -0
- package/src/sip.ts +399 -37
- package/src/stealth.ts +116 -84
- package/src/treasury/index.ts +43 -0
- package/src/treasury/treasury.ts +911 -0
- package/src/wallet/hardware/index.ts +87 -0
- package/src/wallet/hardware/ledger.ts +628 -0
- package/src/wallet/hardware/mock.ts +667 -0
- package/src/wallet/hardware/trezor.ts +657 -0
- package/src/wallet/hardware/types.ts +317 -0
- package/src/wallet/index.ts +40 -0
- package/src/zcash/shielded-service.ts +59 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enterprise Compliance Module for SIP Protocol
|
|
3
|
+
*
|
|
4
|
+
* Provides compliance management, auditor access control,
|
|
5
|
+
* transaction disclosure, and reporting functionality.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { ComplianceManager } from '@sip-protocol/sdk'
|
|
10
|
+
*
|
|
11
|
+
* // Create compliance manager
|
|
12
|
+
* const compliance = await ComplianceManager.create({
|
|
13
|
+
* organizationName: 'Acme Corp',
|
|
14
|
+
* })
|
|
15
|
+
*
|
|
16
|
+
* // Register an auditor
|
|
17
|
+
* const auditor = await compliance.registerAuditor({
|
|
18
|
+
* organization: 'Big Four Audit',
|
|
19
|
+
* contactName: 'John Auditor',
|
|
20
|
+
* contactEmail: 'john@bigfour.com',
|
|
21
|
+
* publicKey: '0x...',
|
|
22
|
+
* scope: {
|
|
23
|
+
* transactionTypes: ['all'],
|
|
24
|
+
* chains: ['ethereum'],
|
|
25
|
+
* tokens: [],
|
|
26
|
+
* startDate: Date.now() / 1000 - 365 * 24 * 60 * 60,
|
|
27
|
+
* },
|
|
28
|
+
* }, adminAddress)
|
|
29
|
+
*
|
|
30
|
+
* // Generate compliance report
|
|
31
|
+
* const report = await compliance.generateReport({
|
|
32
|
+
* type: 'transaction_summary',
|
|
33
|
+
* title: 'Q4 Report',
|
|
34
|
+
* format: 'json',
|
|
35
|
+
* startDate: quarterStart,
|
|
36
|
+
* endDate: quarterEnd,
|
|
37
|
+
* }, requesterAddress)
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @module compliance
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
export { ComplianceManager } from './compliance-manager'
|
package/src/index.ts
CHANGED
|
@@ -45,8 +45,8 @@ export {
|
|
|
45
45
|
export type { SerializedError } from './errors'
|
|
46
46
|
|
|
47
47
|
// Main client
|
|
48
|
-
export { SIP, createSIP } from './sip'
|
|
49
|
-
export type { SIPConfig, WalletAdapter } from './sip'
|
|
48
|
+
export { SIP, createSIP, createProductionSIP } from './sip'
|
|
49
|
+
export type { SIPConfig, WalletAdapter, ProductionQuote } from './sip'
|
|
50
50
|
|
|
51
51
|
// Intent creation
|
|
52
52
|
export {
|
|
@@ -95,6 +95,14 @@ export {
|
|
|
95
95
|
generateRandomBytes,
|
|
96
96
|
} from './crypto'
|
|
97
97
|
|
|
98
|
+
// Secure memory handling
|
|
99
|
+
export {
|
|
100
|
+
secureWipe,
|
|
101
|
+
secureWipeAll,
|
|
102
|
+
withSecureBuffer,
|
|
103
|
+
withSecureBufferSync,
|
|
104
|
+
} from './secure-memory'
|
|
105
|
+
|
|
98
106
|
// Pedersen Commitments (recommended for new code)
|
|
99
107
|
export {
|
|
100
108
|
commit,
|
|
@@ -178,6 +186,57 @@ export type {
|
|
|
178
186
|
ChainId,
|
|
179
187
|
HexString,
|
|
180
188
|
Hash,
|
|
189
|
+
// Payment types
|
|
190
|
+
StablecoinSymbol,
|
|
191
|
+
PaymentPurpose,
|
|
192
|
+
PaymentStatusType,
|
|
193
|
+
ShieldedPayment,
|
|
194
|
+
CreatePaymentParams,
|
|
195
|
+
PaymentReceipt,
|
|
196
|
+
TrackedPayment,
|
|
197
|
+
} from '@sip-protocol/types'
|
|
198
|
+
|
|
199
|
+
// Payment status enum
|
|
200
|
+
export { PaymentStatus } from '@sip-protocol/types'
|
|
201
|
+
|
|
202
|
+
// Treasury types
|
|
203
|
+
export { ProposalStatus } from '@sip-protocol/types'
|
|
204
|
+
export type {
|
|
205
|
+
TreasuryRole,
|
|
206
|
+
ProposalStatusType,
|
|
207
|
+
ProposalType,
|
|
208
|
+
TreasuryMember,
|
|
209
|
+
TreasuryConfig,
|
|
210
|
+
BatchPaymentRecipient,
|
|
211
|
+
BatchPaymentRequest,
|
|
212
|
+
ProposalSignature,
|
|
213
|
+
TreasuryProposal,
|
|
214
|
+
TreasuryBalance,
|
|
215
|
+
TreasuryTransaction,
|
|
216
|
+
CreateTreasuryParams,
|
|
217
|
+
CreatePaymentProposalParams,
|
|
218
|
+
CreateBatchProposalParams,
|
|
219
|
+
AuditorViewingKey,
|
|
220
|
+
} from '@sip-protocol/types'
|
|
221
|
+
|
|
222
|
+
// Compliance types
|
|
223
|
+
export { ReportStatus } from '@sip-protocol/types'
|
|
224
|
+
export type {
|
|
225
|
+
ComplianceRole,
|
|
226
|
+
AuditScope,
|
|
227
|
+
AuditorRegistration,
|
|
228
|
+
DisclosedTransaction,
|
|
229
|
+
ReportType,
|
|
230
|
+
ReportFormat,
|
|
231
|
+
ReportStatusType,
|
|
232
|
+
ComplianceReport,
|
|
233
|
+
ReportData,
|
|
234
|
+
ComplianceConfig,
|
|
235
|
+
CreateComplianceConfigParams,
|
|
236
|
+
RegisterAuditorParams,
|
|
237
|
+
GenerateReportParams,
|
|
238
|
+
DisclosureRequest,
|
|
239
|
+
AuditLogEntry,
|
|
181
240
|
} from '@sip-protocol/types'
|
|
182
241
|
|
|
183
242
|
// Network Adapters
|
|
@@ -275,6 +334,40 @@ export type {
|
|
|
275
334
|
ZcashNetworkInfo,
|
|
276
335
|
} from '@sip-protocol/types'
|
|
277
336
|
|
|
337
|
+
// Private Payments
|
|
338
|
+
export {
|
|
339
|
+
PaymentBuilder,
|
|
340
|
+
createShieldedPayment,
|
|
341
|
+
decryptMemo,
|
|
342
|
+
trackPayment,
|
|
343
|
+
isPaymentExpired,
|
|
344
|
+
getPaymentTimeRemaining,
|
|
345
|
+
serializePayment,
|
|
346
|
+
deserializePayment,
|
|
347
|
+
getPaymentSummary,
|
|
348
|
+
// Stablecoin registry
|
|
349
|
+
STABLECOIN_INFO,
|
|
350
|
+
STABLECOIN_ADDRESSES,
|
|
351
|
+
STABLECOIN_DECIMALS,
|
|
352
|
+
getStablecoin,
|
|
353
|
+
getStablecoinsForChain,
|
|
354
|
+
isStablecoin,
|
|
355
|
+
getStablecoinInfo,
|
|
356
|
+
getSupportedStablecoins,
|
|
357
|
+
isStablecoinOnChain,
|
|
358
|
+
getChainsForStablecoin,
|
|
359
|
+
toStablecoinUnits,
|
|
360
|
+
fromStablecoinUnits,
|
|
361
|
+
formatStablecoinAmount,
|
|
362
|
+
} from './payment'
|
|
363
|
+
export type { CreatePaymentOptions, StablecoinInfo } from './payment'
|
|
364
|
+
|
|
365
|
+
// DAO Treasury
|
|
366
|
+
export { Treasury } from './treasury'
|
|
367
|
+
|
|
368
|
+
// Enterprise Compliance
|
|
369
|
+
export { ComplianceManager } from './compliance'
|
|
370
|
+
|
|
278
371
|
// Wallet Adapters
|
|
279
372
|
export {
|
|
280
373
|
BaseWalletAdapter,
|
|
@@ -312,6 +405,23 @@ export {
|
|
|
312
405
|
normalizeAddress,
|
|
313
406
|
getDefaultRpcEndpoint,
|
|
314
407
|
EthereumChainId,
|
|
408
|
+
// Hardware wallets
|
|
409
|
+
HardwareErrorCode,
|
|
410
|
+
HardwareWalletError,
|
|
411
|
+
DerivationPath,
|
|
412
|
+
getDerivationPath,
|
|
413
|
+
supportsWebUSB,
|
|
414
|
+
supportsWebHID,
|
|
415
|
+
supportsWebBluetooth,
|
|
416
|
+
getAvailableTransports,
|
|
417
|
+
LedgerWalletAdapter,
|
|
418
|
+
createLedgerAdapter,
|
|
419
|
+
TrezorWalletAdapter,
|
|
420
|
+
createTrezorAdapter,
|
|
421
|
+
MockLedgerAdapter,
|
|
422
|
+
MockTrezorAdapter,
|
|
423
|
+
createMockLedgerAdapter,
|
|
424
|
+
createMockTrezorAdapter,
|
|
315
425
|
} from './wallet'
|
|
316
426
|
|
|
317
427
|
export type {
|
|
@@ -366,4 +476,21 @@ export type {
|
|
|
366
476
|
EthereumAdapterConfig,
|
|
367
477
|
EthereumChainIdType,
|
|
368
478
|
MockEthereumAdapterConfig,
|
|
479
|
+
// Hardware wallet types
|
|
480
|
+
HardwareWalletType,
|
|
481
|
+
LedgerModel,
|
|
482
|
+
TrezorModel,
|
|
483
|
+
HardwareConnectionStatus,
|
|
484
|
+
TransportType,
|
|
485
|
+
HardwareDeviceInfo,
|
|
486
|
+
HardwareWalletConfig,
|
|
487
|
+
LedgerConfig,
|
|
488
|
+
TrezorConfig,
|
|
489
|
+
HardwareSignRequest,
|
|
490
|
+
HardwareEthereumTx,
|
|
491
|
+
HardwareSignature,
|
|
492
|
+
HardwareAccount,
|
|
493
|
+
HardwareTransport,
|
|
494
|
+
HardwareErrorCodeType,
|
|
495
|
+
MockHardwareConfig,
|
|
369
496
|
} from './wallet'
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Private Payments Module for SIP Protocol
|
|
3
|
+
*
|
|
4
|
+
* Provides privacy-preserving stablecoin transfers and P2P payments.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import {
|
|
9
|
+
* PaymentBuilder,
|
|
10
|
+
* getStablecoin,
|
|
11
|
+
* toStablecoinUnits,
|
|
12
|
+
* } from '@sip-protocol/sdk/payment'
|
|
13
|
+
*
|
|
14
|
+
* // Create a shielded USDC payment
|
|
15
|
+
* const payment = await new PaymentBuilder()
|
|
16
|
+
* .token('USDC', 'ethereum')
|
|
17
|
+
* .amountHuman(100) // 100 USDC
|
|
18
|
+
* .recipient(recipientMetaAddress)
|
|
19
|
+
* .privacy('shielded')
|
|
20
|
+
* .build()
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
// Payment builder and functions
|
|
25
|
+
export {
|
|
26
|
+
PaymentBuilder,
|
|
27
|
+
createShieldedPayment,
|
|
28
|
+
decryptMemo,
|
|
29
|
+
trackPayment,
|
|
30
|
+
isPaymentExpired,
|
|
31
|
+
getPaymentTimeRemaining,
|
|
32
|
+
serializePayment,
|
|
33
|
+
deserializePayment,
|
|
34
|
+
getPaymentSummary,
|
|
35
|
+
} from './payment'
|
|
36
|
+
export type { CreatePaymentOptions } from './payment'
|
|
37
|
+
|
|
38
|
+
// Stablecoin registry
|
|
39
|
+
export {
|
|
40
|
+
STABLECOIN_INFO,
|
|
41
|
+
STABLECOIN_ADDRESSES,
|
|
42
|
+
STABLECOIN_DECIMALS,
|
|
43
|
+
getStablecoin,
|
|
44
|
+
getStablecoinsForChain,
|
|
45
|
+
isStablecoin,
|
|
46
|
+
getStablecoinInfo,
|
|
47
|
+
getSupportedStablecoins,
|
|
48
|
+
isStablecoinOnChain,
|
|
49
|
+
getChainsForStablecoin,
|
|
50
|
+
toStablecoinUnits,
|
|
51
|
+
fromStablecoinUnits,
|
|
52
|
+
formatStablecoinAmount,
|
|
53
|
+
} from './stablecoins'
|
|
54
|
+
export type { StablecoinInfo } from './stablecoins'
|