toss-expo-sdk 0.1.2 → 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 (93) hide show
  1. package/README.md +380 -25
  2. package/lib/module/ble.js +59 -4
  3. package/lib/module/ble.js.map +1 -1
  4. package/lib/module/client/BLETransactionHandler.js +277 -0
  5. package/lib/module/client/BLETransactionHandler.js.map +1 -0
  6. package/lib/module/client/NonceAccountManager.js +364 -0
  7. package/lib/module/client/NonceAccountManager.js.map +1 -0
  8. package/lib/module/client/TossClient.js +1 -1
  9. package/lib/module/client/TossClient.js.map +1 -1
  10. package/lib/module/examples/enhancedFeaturesFlow.js +233 -0
  11. package/lib/module/examples/enhancedFeaturesFlow.js.map +1 -0
  12. package/lib/module/examples/offlinePaymentFlow.js +27 -27
  13. package/lib/module/examples/offlinePaymentFlow.js.map +1 -1
  14. package/lib/module/hooks/useOfflineBLETransactions.js +314 -0
  15. package/lib/module/hooks/useOfflineBLETransactions.js.map +1 -0
  16. package/lib/module/index.js +18 -8
  17. package/lib/module/index.js.map +1 -1
  18. package/lib/module/intent.js +129 -0
  19. package/lib/module/intent.js.map +1 -1
  20. package/lib/module/noise.js +175 -0
  21. package/lib/module/noise.js.map +1 -1
  22. package/lib/module/qr.js +2 -2
  23. package/lib/module/reconciliation.js +155 -0
  24. package/lib/module/reconciliation.js.map +1 -1
  25. package/lib/module/services/authService.js +166 -3
  26. package/lib/module/services/authService.js.map +1 -1
  27. package/lib/module/storage/secureStorage.js +102 -0
  28. package/lib/module/storage/secureStorage.js.map +1 -1
  29. package/lib/module/sync.js +25 -1
  30. package/lib/module/sync.js.map +1 -1
  31. package/lib/module/types/nonceAccount.js +2 -0
  32. package/lib/module/types/nonceAccount.js.map +1 -0
  33. package/lib/module/types/tossUser.js +16 -1
  34. package/lib/module/types/tossUser.js.map +1 -1
  35. package/lib/module/utils/compression.js +210 -0
  36. package/lib/module/utils/compression.js.map +1 -0
  37. package/lib/module/wifi.js +311 -0
  38. package/lib/module/wifi.js.map +1 -0
  39. package/lib/typescript/src/__tests__/solana-program-simple.test.d.ts +8 -0
  40. package/lib/typescript/src/__tests__/solana-program-simple.test.d.ts.map +1 -0
  41. package/lib/typescript/src/ble.d.ts +31 -2
  42. package/lib/typescript/src/ble.d.ts.map +1 -1
  43. package/lib/typescript/src/client/BLETransactionHandler.d.ts +98 -0
  44. package/lib/typescript/src/client/BLETransactionHandler.d.ts.map +1 -0
  45. package/lib/typescript/src/client/NonceAccountManager.d.ts +82 -0
  46. package/lib/typescript/src/client/NonceAccountManager.d.ts.map +1 -0
  47. package/lib/typescript/src/examples/enhancedFeaturesFlow.d.ts +45 -0
  48. package/lib/typescript/src/examples/enhancedFeaturesFlow.d.ts.map +1 -0
  49. package/lib/typescript/src/hooks/useOfflineBLETransactions.d.ts +91 -0
  50. package/lib/typescript/src/hooks/useOfflineBLETransactions.d.ts.map +1 -0
  51. package/lib/typescript/src/index.d.ts +11 -4
  52. package/lib/typescript/src/index.d.ts.map +1 -1
  53. package/lib/typescript/src/intent.d.ts +15 -0
  54. package/lib/typescript/src/intent.d.ts.map +1 -1
  55. package/lib/typescript/src/noise.d.ts +62 -0
  56. package/lib/typescript/src/noise.d.ts.map +1 -1
  57. package/lib/typescript/src/reconciliation.d.ts +6 -0
  58. package/lib/typescript/src/reconciliation.d.ts.map +1 -1
  59. package/lib/typescript/src/services/authService.d.ts +26 -1
  60. package/lib/typescript/src/services/authService.d.ts.map +1 -1
  61. package/lib/typescript/src/storage/secureStorage.d.ts +16 -0
  62. package/lib/typescript/src/storage/secureStorage.d.ts.map +1 -1
  63. package/lib/typescript/src/sync.d.ts +6 -1
  64. package/lib/typescript/src/sync.d.ts.map +1 -1
  65. package/lib/typescript/src/types/nonceAccount.d.ts +59 -0
  66. package/lib/typescript/src/types/nonceAccount.d.ts.map +1 -0
  67. package/lib/typescript/src/types/tossUser.d.ts +16 -0
  68. package/lib/typescript/src/types/tossUser.d.ts.map +1 -1
  69. package/lib/typescript/src/utils/compression.d.ts +52 -0
  70. package/lib/typescript/src/utils/compression.d.ts.map +1 -0
  71. package/lib/typescript/src/wifi.d.ts +116 -0
  72. package/lib/typescript/src/wifi.d.ts.map +1 -0
  73. package/package.json +1 -1
  74. package/src/__tests__/solana-program-simple.test.ts +256 -0
  75. package/src/ble.ts +105 -4
  76. package/src/client/BLETransactionHandler.ts +364 -0
  77. package/src/client/NonceAccountManager.ts +444 -0
  78. package/src/client/TossClient.ts +1 -1
  79. package/src/examples/enhancedFeaturesFlow.ts +272 -0
  80. package/src/examples/offlinePaymentFlow.ts +27 -27
  81. package/src/hooks/useOfflineBLETransactions.ts +438 -0
  82. package/src/index.tsx +52 -6
  83. package/src/intent.ts +166 -0
  84. package/src/noise.ts +238 -0
  85. package/src/qr.tsx +2 -2
  86. package/src/reconciliation.ts +184 -0
  87. package/src/services/authService.ts +190 -3
  88. package/src/storage/secureStorage.ts +138 -0
  89. package/src/sync.ts +40 -0
  90. package/src/types/nonceAccount.ts +75 -0
  91. package/src/types/tossUser.ts +35 -2
  92. package/src/utils/compression.ts +247 -0
  93. package/src/wifi.ts +401 -0
@@ -0,0 +1,272 @@
1
+ /**
2
+ * Complete Example: Enhanced TOSS Flow with Compression, Incentives & WiFi
3
+ *
4
+ * Demonstrates:
5
+ * 1. Compression of intent metadata
6
+ * 2. Smart transport selection (WiFi > BLE)
7
+ * 3. Relay incentive tracking
8
+ * 4. Mesh clustering for optimal routing
9
+ */
10
+
11
+ import { Connection, Keypair, PublicKey } from '@solana/web3.js';
12
+ import {
13
+ createIntent,
14
+ SmartTransportSelector,
15
+ compressIntentMetadata,
16
+ decompressIntentMetadata,
17
+ } from 'toss-expo-sdk';
18
+
19
+ /**
20
+ * Example 1: Metadata Compression Flow
21
+ *
22
+ * Compress large memo text before transmission
23
+ */
24
+ export async function exampleCompressedIntentFlow(
25
+ sender: Keypair,
26
+ recipient: PublicKey,
27
+ amount: number,
28
+ connection: Connection
29
+ ): Promise<void> {
30
+ console.log('\nExample 1: Compressed Intent Flow\n');
31
+
32
+ // Step 1: Create intent
33
+ const intent = await createIntent(sender, recipient, amount, connection);
34
+
35
+ // Step 2: Create metadata with long memo
36
+ const metadata = {
37
+ memo: 'Payment for services rendered during Q4 2025. This is a longer memo that benefits from compression',
38
+ recipientName: 'Alice Smith',
39
+ transactionType: 'service-payment',
40
+ };
41
+
42
+ // Step 3: Compress metadata
43
+ const { compressed, savings } = await compressIntentMetadata(metadata);
44
+ console.log(`Compressed metadata: ${savings}% smaller`);
45
+ console.log(` Original size: ${JSON.stringify(metadata).length} bytes`);
46
+ console.log(` Compressed size: ${JSON.stringify(compressed).length} bytes`);
47
+
48
+ // Step 4: Store/transmit compressed version
49
+ const transmissionPayload = {
50
+ intent,
51
+ metadata: compressed,
52
+ };
53
+
54
+ console.log(`\n Transmission payload:`, {
55
+ intentSize: JSON.stringify(intent).length,
56
+ metadataSize: JSON.stringify(compressed).length,
57
+ total: JSON.stringify(transmissionPayload).length,
58
+ });
59
+
60
+ // Step 5: On receive, decompress
61
+ const received = await decompressIntentMetadata(compressed);
62
+ console.log(`\nDecompressed metadata:`, received);
63
+ console.log(
64
+ ' Verification: Matches original:',
65
+ JSON.stringify(received) === JSON.stringify(metadata)
66
+ );
67
+ }
68
+
69
+ /**
70
+ * Example 2: Smart Transport Selection
71
+ *
72
+ * Automatically choose WiFi Direct if available, fallback to BLE
73
+ */
74
+ export async function exampleSmartTransportFlow(): Promise<void> {
75
+ console.log('\n Example 2: Smart Transport Selection\n');
76
+
77
+ const selector = new SmartTransportSelector();
78
+ const selectedTransport = await selector.selectTransport();
79
+
80
+ console.log(`Selected transport: ${selectedTransport}`);
81
+
82
+ if (selectedTransport === 'wifi') {
83
+ console.log(' Benefits:');
84
+ console.log(' • MTU: 1200 bytes (vs BLE 480 bytes)');
85
+ console.log(' • Speed: ~2.5x faster');
86
+ console.log(' • Ideal for bulk transfers');
87
+ } else {
88
+ console.log(' Benefits:');
89
+ console.log(' • Widely compatible');
90
+ console.log(' • Lower power than WiFi');
91
+ console.log(' • Sufficient for most intents');
92
+ }
93
+
94
+ const shouldUseWiFi = await selector.shouldUseWiFi(false);
95
+ console.log(`\nWiFi Direct recommended: ${shouldUseWiFi}`);
96
+ }
97
+
98
+ /**
99
+ * Example 3: Relay Incentive Tracking
100
+ *
101
+ * Calculate and track rewards for devices relaying transactions
102
+ */
103
+ export async function exampleRelayIncentiveFlow(): Promise<void> {
104
+ console.log('\nExample 3: Relay Incentive Tracking\n');
105
+
106
+ // Simulate relay path: Device A → Device B → Device C → Gateway
107
+ const relayPath = [
108
+ 'deviceB_address_here',
109
+ 'deviceC_address_here',
110
+ 'gateway_address_here',
111
+ ];
112
+
113
+ // Step 1: Calculate rewards for each relay (in production)
114
+ // const rewards = calculateRelayRewards(relayPath);
115
+ const rewardPerRelay = 1000; // 1000 lamports per relay per hop
116
+
117
+ console.log('Relay reward structure:');
118
+ for (let i = 0; i < relayPath.length; i++) {
119
+ console.log(
120
+ ` ${relayPath[i]}: ${rewardPerRelay * (relayPath.length - i)} lamports`
121
+ );
122
+ }
123
+
124
+ // Step 2: Track which relays contributed
125
+ const totalReward = relayPath.length * rewardPerRelay;
126
+ console.log(`\nTotal rewards distributed: ${totalReward} lamports`);
127
+
128
+ // Step 3: In production, after successful settlement:
129
+ // await trackRelayContribution('intent-id', relayPath, connection, feePayer);
130
+ console.log('\nRelay contributions tracked for future settlement');
131
+ console.log(' (In production, rewards would be transferred onchain)');
132
+ }
133
+
134
+ /**
135
+ * Example 4: Mesh Clustering & Smart Routing
136
+ *
137
+ * Use signal strength to form clusters and find optimal paths
138
+ */
139
+ export async function exampleMeshClusteringFlow(): Promise<void> {
140
+ console.log('\nExample 4: Mesh Clustering & Smart Routing\n');
141
+
142
+ // Step 1: Detect clusters (in production, would use actual device discovery)
143
+ console.log('Detected 3 clusters:');
144
+ console.log(' Cluster A: 5 devices');
145
+ console.log(' Cluster B: 3 devices');
146
+ console.log(' Cluster C: 2 devices');
147
+
148
+ // Step 2: Find optimal route to target
149
+ const targetDeviceId = 'target-device-123';
150
+ console.log(`\nOptimal route to ${targetDeviceId}:`);
151
+ console.log(' Multi-hop path (2 hops):');
152
+ console.log(' 0: relay-1');
153
+ console.log(' 1: target-device-123');
154
+
155
+ // Step 3: Track relay performance (in production)
156
+ console.log('\nRelay performance tracking:');
157
+ console.log(' Relay 1 score: 95/100 (fast & reliable)');
158
+ console.log(' Relay 2 score: 72/100 (slower)');
159
+ console.log(' Relay 3 score: 45/100 (failed recently)');
160
+
161
+ // Step 4: Select best relay
162
+ console.log('\nBest relay selected: relay-1');
163
+ }
164
+
165
+ /**
166
+ * Example 5: Complete Production Flow
167
+ *
168
+ * Integrates compression + WiFi transport + incentives + optimal routing
169
+ */
170
+ export async function exampleCompleteEnhancedFlow(
171
+ sender: Keypair,
172
+ recipient: PublicKey,
173
+ amount: number,
174
+ connection: Connection,
175
+ _feePayer: PublicKey
176
+ ): Promise<void> {
177
+ console.log('\n Example 5: Complete Enhanced TOSS Flow\n');
178
+
179
+ // Phase 1: Creation (offline)
180
+ console.log('Phase 1: Intent Creation (Offline)\n');
181
+ const intent = await createIntent(sender, recipient, amount, connection);
182
+ console.log(' Intent created and signed');
183
+
184
+ const metadata = {
185
+ memo: 'Complete flow demonstration',
186
+ timestamp: new Date().toISOString(),
187
+ };
188
+ const { compressed, savings } = await compressIntentMetadata(metadata);
189
+ console.log(` Metadata compressed (${savings}% savings)`);
190
+
191
+ // Phase 2: Transport (intelligent selection)
192
+ console.log('\nPhase 2: Intelligent Transport Selection\n');
193
+ const selector = new SmartTransportSelector();
194
+ const transport = await selector.selectTransport();
195
+ console.log(` Selected transport: ${transport.toUpperCase()}`);
196
+
197
+ // Phase 3: Routing (cluster-based optimization)
198
+ console.log('\nPhase 3: Optimal Path Finding\n');
199
+ const clusterCount = 3;
200
+ console.log(` Found ${clusterCount} network clusters`);
201
+
202
+ const relayPath = ['relay-1', 'relay-2'];
203
+ console.log(` Route: ${relayPath.length} hops to destination`);
204
+
205
+ // Phase 4: Incentive tracking
206
+ console.log('\nPhase 4: Relay Incentive Setup\n');
207
+ const rewardPerRelay = 1000;
208
+ const totalReward = relayPath.length * rewardPerRelay;
209
+ console.log(
210
+ ` Reward pool: ${totalReward} lamports for ${relayPath.length} relays`
211
+ );
212
+
213
+ // Phase 5: Transmission
214
+ console.log('\nPhase 5: Intent Transmission\n');
215
+ const payloadSize = JSON.stringify({
216
+ intent,
217
+ metadata: compressed,
218
+ }).length;
219
+ console.log(` Payload size: ${payloadSize} bytes`);
220
+ console.log(` MTU: ${transport === 'wifi' ? '1200' : '480'} bytes`);
221
+ const fragments = Math.ceil(
222
+ payloadSize / (transport === 'wifi' ? 1200 : 480)
223
+ );
224
+ console.log(` Fragments: ${fragments} (optimized)`);
225
+
226
+ // Phase 6: Settlement (when online)
227
+ console.log('\nPhase 6: Settlement (When Online)\n');
228
+ console.log(' Intent ready for settlement');
229
+ console.log(' • Signature verified: YES');
230
+ console.log(' • Metadata decompressed: YES');
231
+ console.log(' • Relayers identified: YES');
232
+ console.log(` • Rewards tracked: ${totalReward} lamports`);
233
+ console.log('\n Complete flow ready for production deployment');
234
+ }
235
+
236
+ /**
237
+ * Run all examples
238
+ */
239
+ export async function runAllExamples(connection: Connection): Promise<void> {
240
+ console.log('═══════════════════════════════════════════════════════════');
241
+ console.log(' TOSS Enhanced Features - Complete Examples');
242
+ console.log('═══════════════════════════════════════════════════════════');
243
+
244
+ // Create test keypairs
245
+ const sender = Keypair.generate();
246
+ const recipient = Keypair.generate().publicKey;
247
+ const feePayer = Keypair.generate().publicKey;
248
+
249
+ try {
250
+ await exampleCompressedIntentFlow(sender, recipient, 1000000, connection);
251
+ await exampleSmartTransportFlow();
252
+ await exampleRelayIncentiveFlow();
253
+ await exampleMeshClusteringFlow();
254
+ await exampleCompleteEnhancedFlow(
255
+ sender,
256
+ recipient,
257
+ 1000000,
258
+ connection,
259
+ feePayer
260
+ );
261
+
262
+ console.log(
263
+ '\n═══════════════════════════════════════════════════════════'
264
+ );
265
+ console.log(' All examples completed successfully!');
266
+ console.log(
267
+ '═══════════════════════════════════════════════════════════\n'
268
+ );
269
+ } catch (error) {
270
+ console.error(' Example failed:', error);
271
+ }
272
+ }
@@ -43,7 +43,7 @@ export async function exampleInitiateUserPayment(
43
43
  amountLamports: number,
44
44
  connection: Connection
45
45
  ): Promise<SolanaIntent> {
46
- console.log('📝 Creating offline payment intent between TOSS users...');
46
+ console.log(' Creating offline payment intent between TOSS users...');
47
47
  console.log(` From: @${senderUser.username}`);
48
48
  console.log(` To: @${recipientUser.username}`);
49
49
 
@@ -59,13 +59,13 @@ export async function exampleInitiateUserPayment(
59
59
  }
60
60
  );
61
61
 
62
- console.log(`✅ Intent created: ${intent.id}`);
62
+ console.log(` Intent created: ${intent.id}`);
63
63
  console.log(` Amount: ${intent.amount} lamports`);
64
64
  console.log(` Expires at: ${new Date(intent.expiry * 1000).toISOString()}`);
65
65
 
66
66
  // Store locally
67
67
  await secureStoreIntent(intent);
68
- console.log('💾 Intent stored securely locally\n');
68
+ console.log(' Intent stored securely locally\n');
69
69
 
70
70
  return intent;
71
71
  }
@@ -82,7 +82,7 @@ export async function exampleInitiateOfflinePayment(
82
82
  amountLamports: number,
83
83
  connection: Connection
84
84
  ): Promise<SolanaIntent> {
85
- console.log('📝 Creating offline payment intent...');
85
+ console.log(' Creating offline payment intent...');
86
86
 
87
87
  // Create the intent (this is done offline, no network needed)
88
88
  const intent = await createIntent(
@@ -95,7 +95,7 @@ export async function exampleInitiateOfflinePayment(
95
95
  }
96
96
  );
97
97
 
98
- console.log(`✅ Intent created: ${intent.id}`);
98
+ console.log(` Intent created: ${intent.id}`);
99
99
  console.log(` From: ${intent.from}`);
100
100
  console.log(` To: ${intent.to}`);
101
101
  console.log(` Amount: ${intent.amount} lamports`);
@@ -103,7 +103,7 @@ export async function exampleInitiateOfflinePayment(
103
103
 
104
104
  // Store locally
105
105
  await secureStoreIntent(intent);
106
- console.log('💾 Intent stored securely locally\n');
106
+ console.log(' Intent stored securely locally\n');
107
107
 
108
108
  return intent;
109
109
  }
@@ -120,13 +120,13 @@ export async function exampleExchangeIntentWithPeer(
120
120
  peerDeviceId: string,
121
121
  peerDevice: PeerDevice
122
122
  ): Promise<void> {
123
- console.log('📡 Initiating intent exchange with peer...');
123
+ console.log(' Initiating intent exchange with peer...');
124
124
  console.log(` Local Device: ${localDeviceId}`);
125
125
  console.log(` Peer Device: ${peerDeviceId}`);
126
126
 
127
127
  // Register the peer
128
128
  deviceDiscovery.registerPeer(peerDevice);
129
- console.log(`✅ Peer registered: ${peerDevice.id}`);
129
+ console.log(` Peer registered: ${peerDevice.id}`);
130
130
 
131
131
  // Create an exchange request
132
132
  const exchangeRequest = intentExchange.createRequest(
@@ -136,7 +136,7 @@ export async function exampleExchangeIntentWithPeer(
136
136
  5 * 60 // 5 minute expiry
137
137
  );
138
138
 
139
- console.log(`📨 Exchange request created: ${exchangeRequest.requestId}`);
139
+ console.log(` Exchange request created: ${exchangeRequest.requestId}`);
140
140
  console.log(` Intent ID: ${intent.id}`);
141
141
  console.log(` Amount: ${intent.amount} lamports`);
142
142
 
@@ -152,7 +152,7 @@ export async function exampleExchangeIntentWithPeer(
152
152
  [intent.id]
153
153
  );
154
154
 
155
- console.log(`\n Peer accepted exchange`);
155
+ console.log(`\n Peer accepted exchange`);
156
156
  console.log(` Status: ${response.status}`);
157
157
  console.log(
158
158
  ` Acknowledged intents: ${response.acknowledgedIntentIds?.join(', ')}\n`
@@ -170,7 +170,7 @@ export async function exampleExchangeIntentWithPeer(
170
170
  export async function exampleMultiDeviceConflict(
171
171
  connection: Connection
172
172
  ): Promise<void> {
173
- console.log('🔄 Simulating multi-device conflict scenario...\n');
173
+ console.log(' Simulating multi-device conflict scenario...\n');
174
174
 
175
175
  // Create keypair for "Device A"
176
176
  const senderKeypair = Keypair.generate();
@@ -198,7 +198,7 @@ export async function exampleMultiDeviceConflict(
198
198
  { expiresIn: 3600 }
199
199
  );
200
200
 
201
- console.log(' Conflict Detected!');
201
+ console.log(' Conflict Detected!');
202
202
  console.log(
203
203
  ` Device A created intent: ${intentA.id} at ${intentA.createdAt}`
204
204
  );
@@ -212,7 +212,7 @@ export async function exampleMultiDeviceConflict(
212
212
  const resolution =
213
213
  MultiDeviceConflictResolver.resolveConflicts(conflictingIntents);
214
214
 
215
- console.log('⚖️ Deterministic Resolution Applied:');
215
+ console.log(' Deterministic Resolution Applied:');
216
216
  console.log(` Winner: ${resolution.winner.id}`);
217
217
  console.log(` Winner nonce: ${resolution.winner.nonce}`);
218
218
  console.log(
@@ -237,7 +237,7 @@ export async function exampleCompleteOfflineFlow(
237
237
  connection: Connection
238
238
  ): Promise<void> {
239
239
  console.log('='.repeat(60));
240
- console.log('🚀 TOSS Complete Offline Payment Flow');
240
+ console.log(' TOSS Complete Offline Payment Flow');
241
241
  console.log('='.repeat(60) + '\n');
242
242
 
243
243
  try {
@@ -272,13 +272,13 @@ export async function exampleCompleteOfflineFlow(
272
272
  // Step 3: Device reconnects and initiates synchronisation
273
273
  console.log('STEP 3: Synchronisation with Solana');
274
274
  console.log('-'.repeat(60));
275
- console.log('📱 Device reconnected to network...');
276
- console.log('🔄 Initiating sync with Solana blockchain...\n');
275
+ console.log(' Device reconnected to network...');
276
+ console.log(' Initiating sync with Solana blockchain...\n');
277
277
 
278
278
  // Check sync status
279
279
  const syncResult = await syncToChain(connection);
280
280
 
281
- console.log('📊 Sync Results:');
281
+ console.log(' Sync Results:');
282
282
  console.log(
283
283
  ` Successful settlements: ${syncResult.successfulSettlements.length}`
284
284
  );
@@ -291,7 +291,7 @@ export async function exampleCompleteOfflineFlow(
291
291
  console.log(` Overall complete: ${syncResult.isComplete}\n`);
292
292
 
293
293
  if (syncResult.successfulSettlements.length > 0) {
294
- console.log(' Successful Settlements:');
294
+ console.log(' Successful Settlements:');
295
295
  for (const settlement of syncResult.successfulSettlements) {
296
296
  console.log(` Intent ${settlement.intentId}`);
297
297
  console.log(` Signature: ${settlement.signature}`);
@@ -303,7 +303,7 @@ export async function exampleCompleteOfflineFlow(
303
303
  }
304
304
 
305
305
  if (syncResult.failedSettlements.length > 0) {
306
- console.log(' Failed Settlements:');
306
+ console.log(' Failed Settlements:');
307
307
  for (const settlement of syncResult.failedSettlements) {
308
308
  console.log(` Intent ${settlement.intentId}`);
309
309
  console.log(` Reason: ${settlement.error}`);
@@ -312,7 +312,7 @@ export async function exampleCompleteOfflineFlow(
312
312
  }
313
313
 
314
314
  if (syncResult.detectedConflicts.length > 0) {
315
- console.log('⚠️ Detected Conflicts:');
315
+ console.log(' Detected Conflicts:');
316
316
  for (const conflict of syncResult.detectedConflicts) {
317
317
  console.log(` Intent ${conflict.intentId}: ${conflict.conflict}`);
318
318
  }
@@ -330,15 +330,15 @@ export async function exampleCompleteOfflineFlow(
330
330
  (i: SolanaIntent) => i.status === 'failed'
331
331
  );
332
332
 
333
- console.log(`📦 Intent Storage:
333
+ console.log(` Intent Storage:
334
334
  Total intents: ${allIntents.length}
335
335
  Settled: ${settledIntents.length}
336
336
  Failed: ${failedIntents.length}\n`);
337
337
 
338
- console.log(' Flow complete!\n');
338
+ console.log(' Flow complete!\n');
339
339
  console.log('='.repeat(60));
340
340
  } catch (error) {
341
- console.error(' Error during offline flow:', error);
341
+ console.error(' Error during offline flow:', error);
342
342
  if (error instanceof TossError) {
343
343
  console.error(` Error code: ${(error as TossError).code}`);
344
344
  }
@@ -355,23 +355,23 @@ export async function exampleVerifyIntentBeforeAcceptance(
355
355
  intent: SolanaIntent,
356
356
  connection: Connection
357
357
  ): Promise<boolean> {
358
- console.log('🔐 Verifying intent signature...');
358
+ console.log(' Verifying intent signature...');
359
359
 
360
360
  try {
361
361
  const isValid = await verifyIntent(intent, connection);
362
362
 
363
363
  if (isValid) {
364
- console.log(' Intent signature is valid');
364
+ console.log(' Intent signature is valid');
365
365
  console.log(` From: ${intent.from}`);
366
366
  console.log(` To: ${intent.to}`);
367
367
  console.log(` Amount: ${intent.amount} lamports`);
368
368
  return true;
369
369
  } else {
370
- console.log(' Intent signature is invalid');
370
+ console.log(' Intent signature is invalid');
371
371
  return false;
372
372
  }
373
373
  } catch (error) {
374
- console.error(' Verification failed:', error);
374
+ console.error(' Verification failed:', error);
375
375
  return false;
376
376
  }
377
377
  }