| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -42,7 +42,6 @@ import { createPeerDid } from "../libs/crypto/vc/didPeer"; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import { registerCredential } from "../libs/crypto/vc/passkeyDidPeer"; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import { logger } from "../utils/logger"; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import { PlatformServiceFactory } from "@/services/PlatformServiceFactory"; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import OfferDetailsView from "@/views/OfferDetailsView.vue"; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					export interface GiverReceiverInputInfo { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  did?: string; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -81,18 +80,21 @@ export const UNIT_LONG: Record<string, string> = { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					}; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					/* eslint-enable prettier/prettier */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					const UNIT_CODES: Record<string, Record<string, string>> = { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					const UNIT_CODES: Record<string, { name: string; faIcon: string; decimals: number }> = { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  BTC: { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    name: "Bitcoin", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    faIcon: "bitcoin-sign", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    decimals: 4, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  }, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  HUR: { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    name: "hours", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    faIcon: "clock", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    decimals: 0, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  }, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  USD: { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    name: "US Dollars", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    faIcon: "dollar", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    decimals: 2, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  }, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					}; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -100,6 +102,13 @@ export function iconForUnitCode(unitCode: string) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  return UNIT_CODES[unitCode]?.faIcon || "question"; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					export function formattedAmount(amount: number, unitCode: string) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  const unit = UNIT_CODES[unitCode]; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  const amountStr = amount.toFixed(unit?.decimals ?? 4); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  const unitName = unit?.name || "?"; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  return amountStr + " " + unitName; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					// from https://stackoverflow.com/a/175787/845494
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					// ... though it appears even this isn't precisely right so keep doing "|| 0" or something in sensitive places
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					//
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |