toss-expo-sdk 1.0.1 → 1.0.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.
Files changed (36) hide show
  1. package/README.md +58 -56
  2. package/lib/module/client/NonceAccountManager.js +2 -2
  3. package/lib/module/client/NonceAccountManager.js.map +1 -1
  4. package/lib/module/examples/enhancedFeaturesFlow.js +233 -0
  5. package/lib/module/examples/enhancedFeaturesFlow.js.map +1 -0
  6. package/lib/module/examples/offlinePaymentFlow.js +27 -27
  7. package/lib/module/examples/offlinePaymentFlow.js.map +1 -1
  8. package/lib/module/index.js +6 -0
  9. package/lib/module/index.js.map +1 -1
  10. package/lib/module/qr.js +2 -2
  11. package/lib/module/reconciliation.js +4 -4
  12. package/lib/module/reconciliation.js.map +1 -1
  13. package/lib/module/services/authService.js +3 -3
  14. package/lib/module/services/authService.js.map +1 -1
  15. package/lib/module/utils/compression.js +210 -0
  16. package/lib/module/utils/compression.js.map +1 -0
  17. package/lib/module/wifi.js +311 -0
  18. package/lib/module/wifi.js.map +1 -0
  19. package/lib/typescript/src/examples/enhancedFeaturesFlow.d.ts +45 -0
  20. package/lib/typescript/src/examples/enhancedFeaturesFlow.d.ts.map +1 -0
  21. package/lib/typescript/src/index.d.ts +2 -0
  22. package/lib/typescript/src/index.d.ts.map +1 -1
  23. package/lib/typescript/src/utils/compression.d.ts +52 -0
  24. package/lib/typescript/src/utils/compression.d.ts.map +1 -0
  25. package/lib/typescript/src/wifi.d.ts +116 -0
  26. package/lib/typescript/src/wifi.d.ts.map +1 -0
  27. package/package.json +1 -1
  28. package/src/client/NonceAccountManager.ts +2 -2
  29. package/src/examples/enhancedFeaturesFlow.ts +272 -0
  30. package/src/examples/offlinePaymentFlow.ts +27 -27
  31. package/src/index.tsx +12 -0
  32. package/src/qr.tsx +2 -2
  33. package/src/reconciliation.ts +4 -4
  34. package/src/services/authService.ts +3 -3
  35. package/src/utils/compression.ts +247 -0
  36. package/src/wifi.ts +401 -0
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  **Solana, extended.** TOSS introduces deterministic separation between transaction intent creation and onchain settlement, enabling applications to function seamlessly in disconnected environments while preserving Solana's security model.
9
9
 
10
- ## šŸš€ Features
10
+ ## Features
11
11
 
12
12
  ### Core Capabilities
13
13
 
@@ -20,12 +20,12 @@
20
20
 
21
21
  ### Security
22
22
 
23
- - āœ… Biometric-protected nonce accounts (mandatory)
24
- - āœ… Hardware-backed secure key storage (Secure Enclave / Keymaster)
25
- - āœ… Automatic replay protection with durable nonces
26
- - āœ… Noise Protocol encryption for BLE transmission
27
- - āœ… CRC32 checksums for fragment verification
28
- - āœ… Non-custodial by design - users maintain control of their keys
23
+ - Biometric-protected nonce accounts (mandatory)
24
+ - Hardware-backed secure key storage (Secure Enclave / Keymaster)
25
+ - Automatic replay protection with durable nonces
26
+ - Noise Protocol encryption for BLE transmission
27
+ - CRC32 checksums for fragment verification
28
+ - Non-custodial by design - users maintain control of their keys
29
29
 
30
30
  ### Developer Experience
31
31
 
@@ -35,7 +35,7 @@
35
35
  - Built-in retry mechanisms with exponential backoff
36
36
  - Automatic MTU negotiation and fragmentation
37
37
 
38
- ## šŸ“¦ Installation
38
+ ## Installation
39
39
 
40
40
  ```bash
41
41
  # Using npm
@@ -47,7 +47,7 @@ yarn add toss-expo-sdk
47
47
 
48
48
  All dependencies (Solana Web3.js, Arcium, Noise Protocol, etc.) are automatically included.
49
49
 
50
- ## šŸ“‹ System Model & Design Principles
50
+ ## System Model & Design Principles
51
51
 
52
52
  **TOSS operates under these assumptions:**
53
53
 
@@ -59,16 +59,16 @@ All dependencies (Solana Web3.js, Arcium, Noise Protocol, etc.) are automaticall
59
59
 
60
60
  **TOSS maintains these invariants:**
61
61
 
62
- - āœ… Onchain state is canonical
63
- - āœ… Offline execution never mutates global state
64
- - āœ… All offline artifacts are cryptographically verifiable onchain
65
- - āœ… No trusted relayers or delegated signing
66
- - āœ… Failure is deterministic and safe
67
- - āœ… Privacy is preserved prior to settlement
62
+ - Onchain state is canonical
63
+ - Offline execution never mutates global state
64
+ - All offline artifacts are cryptographically verifiable onchain
65
+ - No trusted relayers or delegated signing
66
+ - Failure is deterministic and safe
67
+ - Privacy is preserved prior to settlement
68
68
 
69
69
  **Violation of any invariant invalidates the offline model.**
70
70
 
71
- ## šŸ Quick Start
71
+ ## Quick Start
72
72
 
73
73
  ### Initialize the Client
74
74
 
@@ -244,7 +244,7 @@ TOSS follows a deterministic 4-phase model (Section 4.3 of Technical Paper):
244
244
 
245
245
  ---
246
246
 
247
- ## šŸ’¾ Local State Management & Reconciliation
247
+ ## Local State Management & Reconciliation
248
248
 
249
249
  TOSS maintains an **encrypted, append-only local intent store** that enables offline operation while waiting for network connectivity.
250
250
 
@@ -293,17 +293,17 @@ console.log(`Conflicts detected: ${syncResult.detectedConflicts.length}`);
293
293
 
294
294
  **Reconciliation Steps:**
295
295
 
296
- 1. āœ… Retrieve all pending intents from local storage
297
- 2. āœ… Submit to Solana
298
- 3. āœ… Verify signatures and state constraints onchain
299
- 4. āœ… Deterministically reject invalid or conflicting intents
300
- 5. āœ… Update local state with finality
296
+ 1. Retrieve all pending intents from local storage
297
+ 2. Submit to Solana
298
+ 3. Verify signatures and state constraints onchain
299
+ 4. Deterministically reject invalid or conflicting intents
300
+ 5. Update local state with finality
301
301
 
302
302
  **No offline state is treated as final.** Solana's verdict is authoritative.
303
303
 
304
304
  ---
305
305
 
306
- ## šŸ” Confidential Execution via Arcium (Optional)
306
+ ## Confidential Execution via Arcium (Optional)
307
307
 
308
308
  TOSS integrates **Arcium** for confidential computation in pre-settlement stages, protecting sensitive transaction parameters before onchain execution.
309
309
 
@@ -409,28 +409,28 @@ console.log(`Sent ${result.sentFragments}/${result.totalFragments} fragments`);
409
409
 
410
410
  **Biometric Protection**
411
411
 
412
- - āœ… All nonce operations require biometric authentication
413
- - āœ… Private keys stored in device's secure enclave (iOS Secure Enclave / Android Keymaster)
414
- - āœ… User cannot export or backup private keys
412
+ - All nonce operations require biometric authentication
413
+ - Private keys stored in device's secure enclave (iOS Secure Enclave / Android Keymaster)
414
+ - User cannot export or backup private keys
415
415
 
416
416
  **Replay Protection**
417
417
 
418
- - āœ… Each transaction uses a unique, incrementing nonce from the blockchain
419
- - āœ… Nonce values automatically validated before transaction execution
420
- - āœ… Expired nonces automatically detected and rejected
418
+ - Each transaction uses a unique, incrementing nonce from the blockchain
419
+ - Nonce values automatically validated before transaction execution
420
+ - Expired nonces automatically detected and rejected
421
421
 
422
422
  **BLE Transmission**
423
423
 
424
- - āœ… Automatic MTU-aware message fragmentation
425
- - āœ… CRC32 checksum verification for each fragment
426
- - āœ… Automatic retry with exponential backoff
427
- - āœ… Noise Protocol encryption support
424
+ - Automatic MTU-aware message fragmentation
425
+ - CRC32 checksum verification for each fragment
426
+ - Automatic retry with exponential backoff
427
+ - Noise Protocol encryption support
428
428
 
429
429
  **Storage & Renewal**
430
430
 
431
- - āœ… Nonce accounts cached efficiently in memory
432
- - āœ… Automatic renewal from blockchain
433
- - āœ… Graceful expiry handling with status tracking
431
+ - Nonce accounts cached efficiently in memory
432
+ - Automatic renewal from blockchain
433
+ - Graceful expiry handling with status tracking
434
434
 
435
435
  ### Detailed Guide
436
436
 
@@ -449,7 +449,7 @@ Topics covered:
449
449
 
450
450
  ---
451
451
 
452
- ## šŸ”’ Security
452
+ ## Security
453
453
 
454
454
  ### TOSS Security Guarantees
455
455
 
@@ -548,7 +548,7 @@ All errors have the following structure:
548
548
  }
549
549
  ```
550
550
 
551
- ## šŸ”„ Synchronisation and Settlement
551
+ ## Synchronisation and Settlement
552
552
 
553
553
  TOSS implements deterministic synchronisation (Section 9 of the technical paper) when devices reconnect to the network.
554
554
 
@@ -633,31 +633,31 @@ const activePeers = discovery.getActivePeers();
633
633
  console.log(`${activePeers.length} active peers nearby`);
634
634
  ```
635
635
 
636
- ## āš ļø Understanding TOSS Limitations
636
+ ## ļø Understanding TOSS Limitations
637
637
 
638
638
  TOSS is designed to fail safely. The following limitations are **by design** and fundamental to any offline system:
639
639
 
640
640
  ### What TOSS Does NOT Do
641
641
 
642
- āŒ **Does not resolve offline double-spend**
642
+ **Does not resolve offline double-spend**
643
643
 
644
644
  - Multiple devices can create conflicting intents offline
645
645
  - Conflicts are resolved deterministically onchain (first valid intent wins)
646
646
  - You must verify transaction details before committing to offline transfer
647
647
 
648
- āŒ **Does not guarantee settlement success**
648
+ **Does not guarantee settlement success**
649
649
 
650
650
  - Intents may fail onchain due to insufficient balance, nonce violations, or expired intents
651
651
  - Settlement is deterministic but failures can occur
652
652
  - Always check sync results for failed intents
653
653
 
654
- āŒ **Does not replace Solana consensus**
654
+ **Does not replace Solana consensus**
655
655
 
656
656
  - TOSS extends operational boundaries but does not modify Solana's execution semantics
657
657
  - All final state transitions occur exclusively on Solana
658
658
  - Transaction validity is determined by Solana's runtime, not TOSS
659
659
 
660
- āŒ **Does not eliminate finality dependency on network**
660
+ **Does not eliminate finality dependency on network**
661
661
 
662
662
  - Finality still requires network connectivity to Solana
663
663
  - Offline operation defers settlement, not finality
@@ -667,31 +667,31 @@ TOSS is designed to fail safely. The following limitations are **by design** and
667
667
 
668
668
  TOSS **guarantees**:
669
669
 
670
- - āœ… Signatures cannot be forged (Ed25519 cryptography)
671
- - āœ… Offline state never mutates global state (local-only storage)
672
- - āœ… All artifacts are verifiable onchain (deterministic settlement)
673
- - āœ… Conflicts resolve deterministically (based on nonce and timestamp)
674
- - āœ… Pre-settlement confidentiality via Arcium (optional)
670
+ - Signatures cannot be forged (Ed25519 cryptography)
671
+ - Offline state never mutates global state (local-only storage)
672
+ - All artifacts are verifiable onchain (deterministic settlement)
673
+ - Conflicts resolve deterministically (based on nonce and timestamp)
674
+ - Pre-settlement confidentiality via Arcium (optional)
675
675
 
676
676
  But TOSS **does not guarantee**:
677
677
 
678
- - āŒ That your intent will successfully settle (dependent on onchain state)
679
- - āŒ Prevention of offline double-spend (conflicts detected onchain)
680
- - āŒ Immediate finality (requires network connectivity)
678
+ - That your intent will successfully settle (dependent on onchain state)
679
+ - Prevention of offline double-spend (conflicts detected onchain)
680
+ - Immediate finality (requires network connectivity)
681
681
 
682
682
  **The distinction:** TOSS guarantees **protocol correctness**, not **settlement success**. These are different requirements.
683
683
 
684
684
  ---
685
685
 
686
- ## 🌐 Network Support
686
+ ## Network Support
687
687
 
688
688
  | Network | Status | RPC Endpoint |
689
689
  | ------- | ------- | ----------------------------------- |
690
- | Devnet | āœ… Live | https://api.devnet.solana.com |
691
- | Testnet | āœ… Live | https://api.testnet.solana.com |
692
- | Mainnet | āœ… Live | https://api.mainnet-beta.solana.com |
690
+ | Devnet | Live | https://api.devnet.solana.com |
691
+ | Testnet | Live | https://api.testnet.solana.com |
692
+ | Mainnet | Live | https://api.mainnet-beta.solana.com |
693
693
 
694
- ## šŸ“š Complete Documentation
694
+ ## Complete Documentation
695
695
 
696
696
  For comprehensive information, see:
697
697
 
@@ -699,3 +699,5 @@ For comprehensive information, see:
699
699
  - [TOSS_PAPER_IMPLEMENTATION_VERIFICATION.md](./TOSS_PAPER_IMPLEMENTATION_VERIFICATION.md) - TOSS paper compliance
700
700
  - [PAPER_VS_IMPLEMENTATION_AUDIT.md](./PAPER_VS_IMPLEMENTATION_AUDIT.md) - Detailed technical audit
701
701
  - [USER_SECURITY_AND_KEY_MANAGEMENT.md](./USER_SECURITY_AND_KEY_MANAGEMENT.md) - Security model and biometric protection
702
+ # toss-expo-sdk
703
+ # toss-expo-sdk
@@ -23,7 +23,7 @@ export class NonceAccountManager {
23
23
  persistToSecureStorage = true
24
24
  } = options;
25
25
  if (requireBiometric !== true) {
26
- throw new Error('āŒ SECURITY ERROR: Biometric protection is mandatory for nonce accounts');
26
+ throw new Error(' SECURITY ERROR: Biometric protection is mandatory for nonce accounts');
27
27
  }
28
28
 
29
29
  // Generate nonce account keypair
@@ -283,7 +283,7 @@ export class NonceAccountManager {
283
283
  transaction.feePayer = payer;
284
284
  transaction.recentBlockhash = blockhash;
285
285
  transaction.lastValidBlockHeight = lastValidBlockHeight;
286
- console.log('āœ… Durable nonce account initialized: ', nonceAccountKeypair.publicKey.toBase58());
286
+ console.log(' Durable nonce account initialized: ', nonceAccountKeypair.publicKey.toBase58());
287
287
  return nonceAccountKeypair.publicKey.toBase58();
288
288
  } catch (error) {
289
289
  throw new Error(`Failed to initialize nonce account: ${error instanceof Error ? error.message : String(error)}`);
@@ -1 +1 @@
1
- {"version":3,"names":["PublicKey","Keypair","SystemProgram","NONCE_ACCOUNT_LENGTH","NonceAccount","SecureStore","NonceAccountManager","cache","Map","constructor","connection","createNonceAccount","user","nonceAuthorityKeypair","owner","options","requireBiometric","persistToSecureStorage","Error","nonceAccountKeypair","generate","nonceAccountAddress","publicKey","minRentLamports","getMinimumBalanceForRentExemption","blockhash","getLatestBlockhash","nonceAccountInfo","address","toBase58","authorizedSigner","currentNonce","lastUsedNonce","isBiometricProtected","createdAt","Math","floor","Date","now","lastModified","isStoredSecurely","storeNonceAccountSecurely","userId","cacheNonceAccount","storageKey","secureData","info","keypair","secretKey","Array","from","storedAt","encryptionMethod","biometricRequired","setItemAsync","JSON","stringify","getNonceAccountSecure","authenticator","stored","getItemAsync","parse","error","console","cacheEntry","accountInfo","nonces","expiresAt","set","getCachedNonceAccount","cached","get","delete","prepareOfflineTransaction","_instructions","tossFeatures","nonceAccountEnabled","nonceAccount","offlineTransaction","id","random","toString","substr","nonce","transaction","status","metadata","security","nonceAccountRequiresBiometric","renewNonceAccount","_nonceAccountAddress","getAccountInfo","warn","fromAccountData","data","updatedInfo","revokeNonceAccount","cleanupExpiredCache","entry","entries","isNonceAccountValid","maxAge","age","initializeDurableNonceAccountOnchain","authority","payer","fundInstruction","transfer","fromPubkey","toPubkey","lamports","nonceInitInstruction","nonceInitialize","noncePubkey","authorizedPubkey","lastValidBlockHeight","Transaction","add","feePayer","recentBlockhash","log","message","String","consumeNonceAccount","nonceAuthority","nonceAdvance","validateNonceAccountOnchain","_expectedAuthority","valid","SYSTEM_PROGRAM_ID","equals","length","getCurrentNonceFromChain","nonceData","slice","readBigUInt64LE"],"sourceRoot":"../../../src","sources":["client/NonceAccountManager.ts"],"mappings":";;AAAA,SACEA,SAAS,EACTC,OAAO,EAEPC,aAAa,EACbC,oBAAoB,EACpBC,YAAY,QAEP,iBAAiB;AACxB,OAAO,KAAKC,WAAW,MAAM,mBAAmB;AAShD;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,CAAC;EACvBC,KAAK,GAAwC,IAAIC,GAAG,CAAC,CAAC;EAG9DC,WAAWA,CAACC,UAAsB,EAAE;IAClC,IAAI,CAACA,UAAU,GAAGA,UAAU;EAC9B;;EAEA;AACF;AACA;AACA;EACE,MAAMC,kBAAkBA,CACtBC,IAAc,EACdC,qBAA8B,EAC9BC,KAAgB,EAChBC,OAAkC,GAAG,CAAC,CAAC,EACZ;IAC3B,MAAM;MAAEC,gBAAgB,GAAG,IAAI;MAAEC,sBAAsB,GAAG;IAAK,CAAC,GAAGF,OAAO;IAE1E,IAAIC,gBAAgB,KAAK,IAAI,EAAE;MAC7B,MAAM,IAAIE,KAAK,CACb,wEACF,CAAC;IACH;;IAEA;IACA,MAAMC,mBAAmB,GAAGlB,OAAO,CAACmB,QAAQ,CAAC,CAAC;IAC9C,MAAMC,mBAAmB,GAAGF,mBAAmB,CAACG,SAAS;;IAEzD;IACA;IACA,MAAMC,eAAe,GACnB,MAAM,IAAI,CAACb,UAAU,CAACc,iCAAiC,CACrDrB,oBACF,CAAC;;IAEH;IACA,MAAM;MAAEsB;IAAU,CAAC,GAAG,MAAM,IAAI,CAACf,UAAU,CAACgB,kBAAkB,CAAC,CAAC;IAEhE,MAAMC,gBAAkC,GAAG;MACzCC,OAAO,EAAEP,mBAAmB,CAACQ,QAAQ,CAAC,CAAC;MACvCf,KAAK,EAAEA,KAAK,CAACe,QAAQ,CAAC,CAAC;MACvBC,gBAAgB,EAAEjB,qBAAqB,CAACS,SAAS,CAACO,QAAQ,CAAC,CAAC;MAC5DE,YAAY,EAA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/G,mBAA8B,EACb;IACjB,IAAI;MACF,MAAMwD,YAAY,GAChB,MAAM,IAAI,CAACnE,UAAU,CAACiF,cAAc,CAACtE,mBAAmB,CAAC;MAE3D,IAAI,CAACwD,YAAY,IAAIA,YAAY,CAACiB,IAAI,CAACqC,MAAM,GAAG,EAAE,EAAE;QAClD,OAAO,CAAC;MACV;;MAEA;MACA,MAAME,SAAS,GAAGxD,YAAY,CAACiB,IAAI,CAACwC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC;MACjD,OAAOD,SAAS,CAACE,eAAe,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC,OAAOzE,KAAK,EAAE;MACdC,OAAO,CAAC6B,IAAI,CAAC,iCAAiC,EAAE9B,KAAK,CAAC;MACtD,OAAO,CAAC;IACV;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"names":["PublicKey","Keypair","SystemProgram","NONCE_ACCOUNT_LENGTH","NonceAccount","SecureStore","NonceAccountManager","cache","Map","constructor","connection","createNonceAccount","user","nonceAuthorityKeypair","owner","options","requireBiometric","persistToSecureStorage","Error","nonceAccountKeypair","generate","nonceAccountAddress","publicKey","minRentLamports","getMinimumBalanceForRentExemption","blockhash","getLatestBlockhash","nonceAccountInfo","address","toBase58","authorizedSigner","currentNonce","lastUsedNonce","isBiometricProtected","createdAt","Math","floor","Date","now","lastModified","isStoredSecurely","storeNonceAccountSecurely","userId","cacheNonceAccount","storageKey","secureData","info","keypair","secretKey","Array","from","storedAt","encryptionMethod","biometricRequired","setItemAsync","JSON","stringify","getNonceAccountSecure","authenticator","stored","getItemAsync","parse","error","console","cacheEntry","accountInfo","nonces","expiresAt","set","getCachedNonceAccount","cached","get","delete","prepareOfflineTransaction","_instructions","tossFeatures","nonceAccountEnabled","nonceAccount","offlineTransaction","id","random","toString","substr","nonce","transaction","status","metadata","security","nonceAccountRequiresBiometric","renewNonceAccount","_nonceAccountAddress","getAccountInfo","warn","fromAccountData","data","updatedInfo","revokeNonceAccount","cleanupExpiredCache","entry","entries","isNonceAccountValid","maxAge","age","initializeDurableNonceAccountOnchain","authority","payer","fundInstruction","transfer","fromPubkey","toPubkey","lamports","nonceInitInstruction","nonceInitialize","noncePubkey","authorizedPubkey","lastValidBlockHeight","Transaction","add","feePayer","recentBlockhash","log","message","String","consumeNonceAccount","nonceAuthority","nonceAdvance","validateNonceAccountOnchain","_expectedAuthority","valid","SYSTEM_PROGRAM_ID","equals","length","getCurrentNonceFromChain","nonceData","slice","readBigUInt64LE"],"sourceRoot":"../../../src","sources":["client/NonceAccountManager.ts"],"mappings":";;AAAA,SACEA,SAAS,EACTC,OAAO,EAEPC,aAAa,EACbC,oBAAoB,EACpBC,YAAY,QAEP,iBAAiB;AACxB,OAAO,KAAKC,WAAW,MAAM,mBAAmB;AAShD;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,CAAC;EACvBC,KAAK,GAAwC,IAAIC,GAAG,CAAC,CAAC;EAG9DC,WAAWA,CAACC,UAAsB,EAAE;IAClC,IAAI,CAACA,UAAU,GAAGA,UAAU;EAC9B;;EAEA;AACF;AACA;AACA;EACE,MAAMC,kBAAkBA,CACtBC,IAAc,EACdC,qBAA8B,EAC9BC,KAAgB,EAChBC,OAAkC,GAAG,CAAC,CAAC,EACZ;IAC3B,MAAM;MAAEC,gBAAgB,GAAG,IAAI;MAAEC,sBAAsB,GAAG;IAAK,CAAC,GAAGF,OAAO;IAE1E,IAAIC,gBAAgB,KAAK,IAAI,EAAE;MAC7B,MAAM,IAAIE,KAAK,CACb,uEACF,CAAC;IACH;;IAEA;IACA,MAAMC,mBAAmB,GAAGlB,OAAO,CAACmB,QAAQ,CAAC,CAAC;IAC9C,MAAMC,mBAAmB,GAAGF,mBAAmB,CAACG,SAAS;;IAEzD;IACA;IACA,MAAMC,eAAe,GACnB,MAAM,IAAI,CAACb,UAAU,CAACc,iCAAiC,CACrDrB,oBACF,CAAC;;IAEH;IACA,MAAM;MAAEsB;IAAU,CAAC,GAAG,MAAM,IAAI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CAAC;IACxB,CAAC,CAAC,OAAOlE,KAAK,EAAE;MACd,OAAO;QACLkE,KAAK,EAAE,KAAK;QACZlE,KAAK,EAAE,oCAAoCA,KAAK,YAAY5C,KAAK,GAAG4C,KAAK,CAAC2D,OAAO,GAAGC,MAAM,CAAC5D,KAAK,CAAC;MACnG,CAAC;IACH;EACF;;EAEA;AACF;AACA;AACA;EACE,MAAMsE,wBAAwBA,CAC5B/G,mBAA8B,EACb;IACjB,IAAI;MACF,MAAMwD,YAAY,GAChB,MAAM,IAAI,CAACnE,UAAU,CAACiF,cAAc,CAACtE,mBAAmB,CAAC;MAE3D,IAAI,CAACwD,YAAY,IAAIA,YAAY,CAACiB,IAAI,CAACqC,MAAM,GAAG,EAAE,EAAE;QAClD,OAAO,CAAC;MACV;;MAEA;MACA,MAAME,SAAS,GAAGxD,YAAY,CAACiB,IAAI,CAACwC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC;MACjD,OAAOD,SAAS,CAACE,eAAe,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC,OAAOzE,KAAK,EAAE;MACdC,OAAO,CAAC6B,IAAI,CAAC,iCAAiC,EAAE9B,KAAK,CAAC;MACtD,OAAO,CAAC;IACV;EACF;AACF","ignoreList":[]}
@@ -0,0 +1,233 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Complete Example: Enhanced TOSS Flow with Compression, Incentives & WiFi
5
+ *
6
+ * Demonstrates:
7
+ * 1. Compression of intent metadata
8
+ * 2. Smart transport selection (WiFi > BLE)
9
+ * 3. Relay incentive tracking
10
+ * 4. Mesh clustering for optimal routing
11
+ */
12
+
13
+ import { Keypair } from '@solana/web3.js';
14
+ import { createIntent, SmartTransportSelector, compressIntentMetadata, decompressIntentMetadata } from 'toss-expo-sdk';
15
+
16
+ /**
17
+ * Example 1: Metadata Compression Flow
18
+ *
19
+ * Compress large memo text before transmission
20
+ */
21
+ export async function exampleCompressedIntentFlow(sender, recipient, amount, connection) {
22
+ console.log('\nExample 1: Compressed Intent Flow\n');
23
+
24
+ // Step 1: Create intent
25
+ const intent = await createIntent(sender, recipient, amount, connection);
26
+
27
+ // Step 2: Create metadata with long memo
28
+ const metadata = {
29
+ memo: 'Payment for services rendered during Q4 2025. This is a longer memo that benefits from compression',
30
+ recipientName: 'Alice Smith',
31
+ transactionType: 'service-payment'
32
+ };
33
+
34
+ // Step 3: Compress metadata
35
+ const {
36
+ compressed,
37
+ savings
38
+ } = await compressIntentMetadata(metadata);
39
+ console.log(`Compressed metadata: ${savings}% smaller`);
40
+ console.log(` Original size: ${JSON.stringify(metadata).length} bytes`);
41
+ console.log(` Compressed size: ${JSON.stringify(compressed).length} bytes`);
42
+
43
+ // Step 4: Store/transmit compressed version
44
+ const transmissionPayload = {
45
+ intent,
46
+ metadata: compressed
47
+ };
48
+ console.log(`\n Transmission payload:`, {
49
+ intentSize: JSON.stringify(intent).length,
50
+ metadataSize: JSON.stringify(compressed).length,
51
+ total: JSON.stringify(transmissionPayload).length
52
+ });
53
+
54
+ // Step 5: On receive, decompress
55
+ const received = await decompressIntentMetadata(compressed);
56
+ console.log(`\nDecompressed metadata:`, received);
57
+ console.log(' Verification: Matches original:', JSON.stringify(received) === JSON.stringify(metadata));
58
+ }
59
+
60
+ /**
61
+ * Example 2: Smart Transport Selection
62
+ *
63
+ * Automatically choose WiFi Direct if available, fallback to BLE
64
+ */
65
+ export async function exampleSmartTransportFlow() {
66
+ console.log('\n Example 2: Smart Transport Selection\n');
67
+ const selector = new SmartTransportSelector();
68
+ const selectedTransport = await selector.selectTransport();
69
+ console.log(`Selected transport: ${selectedTransport}`);
70
+ if (selectedTransport === 'wifi') {
71
+ console.log(' Benefits:');
72
+ console.log(' • MTU: 1200 bytes (vs BLE 480 bytes)');
73
+ console.log(' • Speed: ~2.5x faster');
74
+ console.log(' • Ideal for bulk transfers');
75
+ } else {
76
+ console.log(' Benefits:');
77
+ console.log(' • Widely compatible');
78
+ console.log(' • Lower power than WiFi');
79
+ console.log(' • Sufficient for most intents');
80
+ }
81
+ const shouldUseWiFi = await selector.shouldUseWiFi(false);
82
+ console.log(`\nWiFi Direct recommended: ${shouldUseWiFi}`);
83
+ }
84
+
85
+ /**
86
+ * Example 3: Relay Incentive Tracking
87
+ *
88
+ * Calculate and track rewards for devices relaying transactions
89
+ */
90
+ export async function exampleRelayIncentiveFlow() {
91
+ console.log('\nExample 3: Relay Incentive Tracking\n');
92
+
93
+ // Simulate relay path: Device A → Device B → Device C → Gateway
94
+ const relayPath = ['deviceB_address_here', 'deviceC_address_here', 'gateway_address_here'];
95
+
96
+ // Step 1: Calculate rewards for each relay (in production)
97
+ // const rewards = calculateRelayRewards(relayPath);
98
+ const rewardPerRelay = 1000; // 1000 lamports per relay per hop
99
+
100
+ console.log('Relay reward structure:');
101
+ for (let i = 0; i < relayPath.length; i++) {
102
+ console.log(` ${relayPath[i]}: ${rewardPerRelay * (relayPath.length - i)} lamports`);
103
+ }
104
+
105
+ // Step 2: Track which relays contributed
106
+ const totalReward = relayPath.length * rewardPerRelay;
107
+ console.log(`\nTotal rewards distributed: ${totalReward} lamports`);
108
+
109
+ // Step 3: In production, after successful settlement:
110
+ // await trackRelayContribution('intent-id', relayPath, connection, feePayer);
111
+ console.log('\nRelay contributions tracked for future settlement');
112
+ console.log(' (In production, rewards would be transferred onchain)');
113
+ }
114
+
115
+ /**
116
+ * Example 4: Mesh Clustering & Smart Routing
117
+ *
118
+ * Use signal strength to form clusters and find optimal paths
119
+ */
120
+ export async function exampleMeshClusteringFlow() {
121
+ console.log('\nExample 4: Mesh Clustering & Smart Routing\n');
122
+
123
+ // Step 1: Detect clusters (in production, would use actual device discovery)
124
+ console.log('Detected 3 clusters:');
125
+ console.log(' Cluster A: 5 devices');
126
+ console.log(' Cluster B: 3 devices');
127
+ console.log(' Cluster C: 2 devices');
128
+
129
+ // Step 2: Find optimal route to target
130
+ const targetDeviceId = 'target-device-123';
131
+ console.log(`\nOptimal route to ${targetDeviceId}:`);
132
+ console.log(' Multi-hop path (2 hops):');
133
+ console.log(' 0: relay-1');
134
+ console.log(' 1: target-device-123');
135
+
136
+ // Step 3: Track relay performance (in production)
137
+ console.log('\nRelay performance tracking:');
138
+ console.log(' Relay 1 score: 95/100 (fast & reliable)');
139
+ console.log(' Relay 2 score: 72/100 (slower)');
140
+ console.log(' Relay 3 score: 45/100 (failed recently)');
141
+
142
+ // Step 4: Select best relay
143
+ console.log('\nBest relay selected: relay-1');
144
+ }
145
+
146
+ /**
147
+ * Example 5: Complete Production Flow
148
+ *
149
+ * Integrates compression + WiFi transport + incentives + optimal routing
150
+ */
151
+ export async function exampleCompleteEnhancedFlow(sender, recipient, amount, connection, _feePayer) {
152
+ console.log('\n Example 5: Complete Enhanced TOSS Flow\n');
153
+
154
+ // Phase 1: Creation (offline)
155
+ console.log('Phase 1: Intent Creation (Offline)\n');
156
+ const intent = await createIntent(sender, recipient, amount, connection);
157
+ console.log(' Intent created and signed');
158
+ const metadata = {
159
+ memo: 'Complete flow demonstration',
160
+ timestamp: new Date().toISOString()
161
+ };
162
+ const {
163
+ compressed,
164
+ savings
165
+ } = await compressIntentMetadata(metadata);
166
+ console.log(` Metadata compressed (${savings}% savings)`);
167
+
168
+ // Phase 2: Transport (intelligent selection)
169
+ console.log('\nPhase 2: Intelligent Transport Selection\n');
170
+ const selector = new SmartTransportSelector();
171
+ const transport = await selector.selectTransport();
172
+ console.log(` Selected transport: ${transport.toUpperCase()}`);
173
+
174
+ // Phase 3: Routing (cluster-based optimization)
175
+ console.log('\nPhase 3: Optimal Path Finding\n');
176
+ const clusterCount = 3;
177
+ console.log(` Found ${clusterCount} network clusters`);
178
+ const relayPath = ['relay-1', 'relay-2'];
179
+ console.log(` Route: ${relayPath.length} hops to destination`);
180
+
181
+ // Phase 4: Incentive tracking
182
+ console.log('\nPhase 4: Relay Incentive Setup\n');
183
+ const rewardPerRelay = 1000;
184
+ const totalReward = relayPath.length * rewardPerRelay;
185
+ console.log(` Reward pool: ${totalReward} lamports for ${relayPath.length} relays`);
186
+
187
+ // Phase 5: Transmission
188
+ console.log('\nPhase 5: Intent Transmission\n');
189
+ const payloadSize = JSON.stringify({
190
+ intent,
191
+ metadata: compressed
192
+ }).length;
193
+ console.log(` Payload size: ${payloadSize} bytes`);
194
+ console.log(` MTU: ${transport === 'wifi' ? '1200' : '480'} bytes`);
195
+ const fragments = Math.ceil(payloadSize / (transport === 'wifi' ? 1200 : 480));
196
+ console.log(` Fragments: ${fragments} (optimized)`);
197
+
198
+ // Phase 6: Settlement (when online)
199
+ console.log('\nPhase 6: Settlement (When Online)\n');
200
+ console.log(' Intent ready for settlement');
201
+ console.log(' • Signature verified: YES');
202
+ console.log(' • Metadata decompressed: YES');
203
+ console.log(' • Relayers identified: YES');
204
+ console.log(` • Rewards tracked: ${totalReward} lamports`);
205
+ console.log('\n Complete flow ready for production deployment');
206
+ }
207
+
208
+ /**
209
+ * Run all examples
210
+ */
211
+ export async function runAllExamples(connection) {
212
+ console.log('═══════════════════════════════════════════════════════════');
213
+ console.log(' TOSS Enhanced Features - Complete Examples');
214
+ console.log('═══════════════════════════════════════════════════════════');
215
+
216
+ // Create test keypairs
217
+ const sender = Keypair.generate();
218
+ const recipient = Keypair.generate().publicKey;
219
+ const feePayer = Keypair.generate().publicKey;
220
+ try {
221
+ await exampleCompressedIntentFlow(sender, recipient, 1000000, connection);
222
+ await exampleSmartTransportFlow();
223
+ await exampleRelayIncentiveFlow();
224
+ await exampleMeshClusteringFlow();
225
+ await exampleCompleteEnhancedFlow(sender, recipient, 1000000, connection, feePayer);
226
+ console.log('\n═══════════════════════════════════════════════════════════');
227
+ console.log(' All examples completed successfully!');
228
+ console.log('═══════════════════════════════════════════════════════════\n');
229
+ } catch (error) {
230
+ console.error(' Example failed:', error);
231
+ }
232
+ }
233
+ //# sourceMappingURL=enhancedFeaturesFlow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Keypair","createIntent","SmartTransportSelector","compressIntentMetadata","decompressIntentMetadata","exampleCompressedIntentFlow","sender","recipient","amount","connection","console","log","intent","metadata","memo","recipientName","transactionType","compressed","savings","JSON","stringify","length","transmissionPayload","intentSize","metadataSize","total","received","exampleSmartTransportFlow","selector","selectedTransport","selectTransport","shouldUseWiFi","exampleRelayIncentiveFlow","relayPath","rewardPerRelay","i","totalReward","exampleMeshClusteringFlow","targetDeviceId","exampleCompleteEnhancedFlow","_feePayer","timestamp","Date","toISOString","transport","toUpperCase","clusterCount","payloadSize","fragments","Math","ceil","runAllExamples","generate","publicKey","feePayer","error"],"sourceRoot":"../../../src","sources":["examples/enhancedFeaturesFlow.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAqBA,OAAO,QAAmB,iBAAiB;AAChE,SACEC,YAAY,EACZC,sBAAsB,EACtBC,sBAAsB,EACtBC,wBAAwB,QACnB,eAAe;;AAEtB;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,2BAA2BA,CAC/CC,MAAe,EACfC,SAAoB,EACpBC,MAAc,EACdC,UAAsB,EACP;EACfC,OAAO,CAACC,GAAG,CAAC,uCAAuC,CAAC;;EAEpD;EACA,MAAMC,MAAM,GAAG,MAAMX,YAAY,CAACK,MAAM,EAAEC,SAAS,EAAEC,MAAM,EAAEC,UAAU,CAAC;;EAExE;EACA,MAAMI,QAAQ,GAAG;IACfC,IAAI,EAAE,oGAAoG;IAC1GC,aAAa,EAAE,aAAa;IAC5BC,eAAe,EAAE;EACnB,CAAC;;EAED;EACA,MAAM;IAAEC,UAAU;IAAEC;EAAQ,CAAC,GAAG,MAAMf,sBAAsB,CAACU,QAAQ,CAAC;EACtEH,OAAO,CAACC,GAAG,CAAC,wBAAwBO,OAAO,WAAW,CAAC;EACvDR,OAAO,CAACC,GAAG,CAAC,qBAAqBQ,IAAI,CAACC,SAAS,CAACP,QAAQ,CAAC,CAACQ,MAAM,QAAQ,CAAC;EACzEX,OAAO,CAACC,GAAG,CAAC,uBAAuBQ,IAAI,CAACC,SAAS,CAACH,UAAU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