@hashgraphonline/standards-sdk 0.1.102 → 0.1.103-canary.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 (73) hide show
  1. package/dist/cjs/hcs-10/connections-manager.d.ts +1 -1
  2. package/dist/cjs/hcs-10/connections-manager.d.ts.map +1 -1
  3. package/dist/cjs/hcs-11/client.d.ts +55 -55
  4. package/dist/cjs/hcs-11/client.d.ts.map +1 -1
  5. package/dist/cjs/hcs-12/validation/schemas.d.ts +8 -8
  6. package/dist/cjs/hcs-16/base-client.d.ts +18 -2
  7. package/dist/cjs/hcs-16/base-client.d.ts.map +1 -1
  8. package/dist/cjs/hcs-16/browser.d.ts +65 -5
  9. package/dist/cjs/hcs-16/browser.d.ts.map +1 -1
  10. package/dist/cjs/hcs-16/sdk.d.ts +52 -4
  11. package/dist/cjs/hcs-16/sdk.d.ts.map +1 -1
  12. package/dist/cjs/hcs-16/tx.d.ts +25 -36
  13. package/dist/cjs/hcs-16/tx.d.ts.map +1 -1
  14. package/dist/cjs/hcs-16/types.d.ts +1 -3
  15. package/dist/cjs/hcs-16/types.d.ts.map +1 -1
  16. package/dist/cjs/hcs-18/tx.d.ts +6 -6
  17. package/dist/cjs/hcs-18/tx.d.ts.map +1 -1
  18. package/dist/cjs/hcs-18/types.d.ts +1 -1
  19. package/dist/cjs/hcs-18/types.d.ts.map +1 -1
  20. package/dist/cjs/standards-sdk.cjs +16 -16
  21. package/dist/cjs/standards-sdk.cjs.map +1 -1
  22. package/dist/cjs/utils/logger.d.ts.map +1 -1
  23. package/dist/es/hcs-10/connections-manager.d.ts +1 -1
  24. package/dist/es/hcs-10/connections-manager.d.ts.map +1 -1
  25. package/dist/es/hcs-11/client.d.ts +55 -55
  26. package/dist/es/hcs-11/client.d.ts.map +1 -1
  27. package/dist/es/hcs-12/validation/schemas.d.ts +8 -8
  28. package/dist/es/hcs-16/base-client.d.ts +18 -2
  29. package/dist/es/hcs-16/base-client.d.ts.map +1 -1
  30. package/dist/es/hcs-16/browser.d.ts +65 -5
  31. package/dist/es/hcs-16/browser.d.ts.map +1 -1
  32. package/dist/es/hcs-16/sdk.d.ts +52 -4
  33. package/dist/es/hcs-16/sdk.d.ts.map +1 -1
  34. package/dist/es/hcs-16/tx.d.ts +25 -36
  35. package/dist/es/hcs-16/tx.d.ts.map +1 -1
  36. package/dist/es/hcs-16/types.d.ts +1 -3
  37. package/dist/es/hcs-16/types.d.ts.map +1 -1
  38. package/dist/es/hcs-18/tx.d.ts +6 -6
  39. package/dist/es/hcs-18/tx.d.ts.map +1 -1
  40. package/dist/es/hcs-18/types.d.ts +1 -1
  41. package/dist/es/hcs-18/types.d.ts.map +1 -1
  42. package/dist/es/standards-sdk.es.js +4 -4
  43. package/dist/es/standards-sdk.es112.js +1 -1
  44. package/dist/es/standards-sdk.es122.js +15 -54
  45. package/dist/es/standards-sdk.es122.js.map +1 -1
  46. package/dist/es/standards-sdk.es123.js +201 -14
  47. package/dist/es/standards-sdk.es123.js.map +1 -1
  48. package/dist/es/standards-sdk.es124.js +53 -201
  49. package/dist/es/standards-sdk.es124.js.map +1 -1
  50. package/dist/es/standards-sdk.es16.js.map +1 -1
  51. package/dist/es/standards-sdk.es22.js +28 -36
  52. package/dist/es/standards-sdk.es22.js.map +1 -1
  53. package/dist/es/standards-sdk.es51.js +1 -1
  54. package/dist/es/standards-sdk.es53.js +1 -1
  55. package/dist/es/standards-sdk.es59.js +1 -1
  56. package/dist/es/standards-sdk.es60.js +1 -1
  57. package/dist/es/standards-sdk.es78.js +1 -3
  58. package/dist/es/standards-sdk.es78.js.map +1 -1
  59. package/dist/es/standards-sdk.es79.js +37 -45
  60. package/dist/es/standards-sdk.es79.js.map +1 -1
  61. package/dist/es/standards-sdk.es80.js +77 -4
  62. package/dist/es/standards-sdk.es80.js.map +1 -1
  63. package/dist/es/standards-sdk.es81.js +94 -5
  64. package/dist/es/standards-sdk.es81.js.map +1 -1
  65. package/dist/es/standards-sdk.es82.js +43 -0
  66. package/dist/es/standards-sdk.es82.js.map +1 -1
  67. package/dist/es/standards-sdk.es88.js.map +1 -1
  68. package/dist/es/standards-sdk.es91.js +18 -1
  69. package/dist/es/standards-sdk.es91.js.map +1 -1
  70. package/dist/es/standards-sdk.es93.js +4 -2
  71. package/dist/es/standards-sdk.es93.js.map +1 -1
  72. package/dist/es/utils/logger.d.ts.map +1 -1
  73. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"standards-sdk.es22.js","sources":["../../src/hcs-11/client.ts"],"sourcesContent":["import {\n AccountId,\n AccountUpdateTransaction,\n Client,\n PrivateKey,\n Status,\n Transaction,\n} from '@hashgraph/sdk';\nimport {\n inscribe,\n inscribeWithSigner,\n InscriptionInput,\n InscriptionOptions,\n InscriptionResult,\n} from '../inscribe';\nimport { Logger, ILogger, detectKeyTypeFromString, getTopicId } from '../utils';\nimport * as mime from 'mime-types';\nimport { z, ZodIssue } from 'zod';\nimport type { DAppSigner } from '@hashgraph/hedera-wallet-connect';\nimport { ProgressReporter } from '../utils/progress-reporter';\nimport { HederaMirrorNode } from '../services';\nimport { isHederaNetwork, toHederaCaip10 } from '../hcs-14/caip';\nimport { TopicInfo } from '../services/types';\nimport {\n ProfileType,\n AIAgentType,\n AIAgentCapability,\n SocialLink,\n PersonalProfile,\n AIAgentProfile,\n HCS11Profile,\n HCS11Auth,\n HCS11ClientConfig,\n TransactionResult,\n InscribeProfileResponse,\n InscribeImageResponse,\n AgentMetadata,\n InscribeImageOptions,\n InscribeProfileOptions,\n capabilityNameToCapabilityMap,\n MCPServerDetails,\n MCPServerProfile,\n MCPServerCapability,\n VerificationType,\n} from './types';\n\nexport const SocialLinkSchema = z.object({\n platform: z.string().min(1),\n handle: z.string().min(1),\n});\n\nexport const AIAgentDetailsSchema = z.object({\n type: z.nativeEnum(AIAgentType),\n capabilities: z.array(z.nativeEnum(AIAgentCapability)).min(1),\n model: z.string().min(1),\n creator: z.string().optional(),\n});\n\nexport const MCPServerConnectionInfoSchema = z.object({\n url: z.string().min(1),\n transport: z.enum(['stdio', 'sse']),\n});\n\nexport const MCPServerVerificationSchema = z.object({\n type: z.nativeEnum(VerificationType),\n value: z.string(),\n dns_field: z.string().optional(),\n challenge_path: z.string().optional(),\n});\n\nexport const MCPServerHostSchema = z.object({\n minVersion: z.string().optional(),\n});\n\nexport const MCPServerResourceSchema = z.object({\n name: z.string().min(1),\n description: z.string().min(1),\n});\n\nexport const MCPServerToolSchema = z.object({\n name: z.string().min(1),\n description: z.string().min(1),\n});\n\nexport const MCPServerDetailsSchema = z.object({\n version: z.string().min(1),\n connectionInfo: MCPServerConnectionInfoSchema,\n services: z.array(z.nativeEnum(MCPServerCapability)).min(1),\n description: z.string().min(1),\n verification: MCPServerVerificationSchema.optional(),\n host: MCPServerHostSchema.optional(),\n capabilities: z.array(z.string()).optional(),\n resources: z.array(MCPServerResourceSchema).optional(),\n tools: z.array(MCPServerToolSchema).optional(),\n maintainer: z.string().optional(),\n repository: z.string().optional(),\n docs: z.string().optional(),\n});\n\nexport const BaseProfileSchema = z.object({\n version: z.string().min(1),\n type: z.nativeEnum(ProfileType),\n display_name: z.string().min(1),\n alias: z.string().optional(),\n bio: z.string().optional(),\n socials: z.array(SocialLinkSchema).optional(),\n profileImage: z.string().optional(),\n uaid: z.string().optional(),\n properties: z.record(z.any()).optional(),\n inboundTopicId: z.string().optional(),\n outboundTopicId: z.string().optional(),\n base_account: z.string().optional(),\n});\n\nexport const PersonalProfileSchema = BaseProfileSchema.extend({\n type: z.literal(ProfileType.PERSONAL),\n language: z.string().optional(),\n timezone: z.string().optional(),\n});\n\nexport const AIAgentProfileSchema = BaseProfileSchema.extend({\n type: z.literal(ProfileType.AI_AGENT),\n aiAgent: AIAgentDetailsSchema,\n});\n\nexport const MCPServerProfileSchema = BaseProfileSchema.extend({\n type: z.literal(ProfileType.MCP_SERVER),\n mcpServer: MCPServerDetailsSchema,\n});\n\nconst FloraProfileSchema = z.object({\n version: z.string(),\n type: z.literal(ProfileType.FLORA),\n display_name: z.string().min(1),\n members: z.array(\n z.object({\n accountId: z.string(),\n publicKey: z.string().optional(),\n weight: z.number().optional(),\n }),\n ),\n threshold: z.number().min(1),\n topics: z.object({\n communication: z.string(),\n transaction: z.string(),\n state: z.string(),\n }),\n inboundTopicId: z.string(),\n outboundTopicId: z.string(),\n bio: z.string().optional(),\n metadata: z.record(z.any()).optional(),\n policies: z.record(z.any()).optional(),\n});\n\nexport const HCS11ProfileSchema = z.union([\n PersonalProfileSchema,\n AIAgentProfileSchema,\n MCPServerProfileSchema,\n FloraProfileSchema,\n]);\n\nexport class HCS11Client {\n private client: Client;\n private auth: HCS11Auth;\n private network: string;\n private logger: ILogger;\n private mirrorNode: HederaMirrorNode;\n private keyType: 'ed25519' | 'ecdsa';\n private operatorId: string;\n\n constructor(config: HCS11ClientConfig) {\n this.client =\n config.network === 'mainnet' ? Client.forMainnet() : Client.forTestnet();\n this.auth = config.auth;\n this.network = config.network;\n this.operatorId = config.auth.operatorId;\n\n this.logger = Logger.getInstance({\n level: config.logLevel || 'info',\n module: 'HCS-11',\n silent: config.silent,\n });\n\n this.mirrorNode = new HederaMirrorNode(\n this.network as 'mainnet' | 'testnet',\n this.logger,\n );\n\n if (this.auth.privateKey) {\n if (config.keyType) {\n this.keyType = config.keyType;\n this.initializeOperatorWithKeyType();\n } else {\n try {\n const keyDetection = detectKeyTypeFromString(this.auth.privateKey);\n this.keyType = keyDetection.detectedType;\n\n if (keyDetection.warning) {\n this.logger.warn(keyDetection.warning);\n }\n\n this.client.setOperator(this.operatorId, keyDetection.privateKey);\n } catch (error) {\n this.logger.warn(\n 'Failed to detect key type from private key format, will query mirror node',\n );\n this.keyType = 'ecdsa';\n }\n\n this.initializeOperator();\n }\n }\n }\n\n public getClient(): Client {\n return this.client;\n }\n\n public getOperatorId(): string {\n return this.auth.operatorId;\n }\n\n public async initializeOperator() {\n const account = await this.mirrorNode.requestAccount(this.operatorId);\n const keyType = account?.key?._type;\n\n if (keyType && keyType.includes('ECDSA')) {\n this.keyType = 'ecdsa';\n } else if (keyType && keyType.includes('ED25519')) {\n this.keyType = 'ed25519';\n } else {\n this.keyType = 'ecdsa';\n }\n\n this.initializeOperatorWithKeyType();\n }\n\n private initializeOperatorWithKeyType() {\n if (!this.auth.privateKey) {\n return;\n }\n\n const PK =\n this.keyType === 'ecdsa'\n ? PrivateKey.fromStringECDSA(this.auth.privateKey)\n : PrivateKey.fromStringED25519(this.auth.privateKey);\n\n this.client.setOperator(this.operatorId, PK);\n }\n\n public createPersonalProfile(\n displayName: string,\n options?: {\n alias?: string;\n bio?: string;\n socials?: SocialLink[];\n profileImage?: string;\n language?: string;\n timezone?: string;\n properties?: Record<string, any>;\n inboundTopicId?: string;\n outboundTopicId?: string;\n baseAccount?: string;\n },\n ): PersonalProfile {\n return {\n version: '1.0',\n type: ProfileType.PERSONAL,\n display_name: displayName,\n alias: options?.alias,\n bio: options?.bio,\n socials: options?.socials,\n profileImage: options?.profileImage,\n properties: options?.properties,\n inboundTopicId: options?.inboundTopicId,\n outboundTopicId: options?.outboundTopicId,\n base_account: options?.baseAccount,\n };\n }\n\n public createAIAgentProfile(\n displayName: string,\n agentType: AIAgentType,\n capabilities: AIAgentCapability[],\n model: string,\n options?: {\n alias?: string;\n bio?: string;\n socials?: SocialLink[];\n profileImage?: string;\n properties?: Record<string, any>;\n inboundTopicId?: string;\n outboundTopicId?: string;\n creator?: string;\n baseAccount?: string;\n },\n ): AIAgentProfile {\n const validation = this.validateProfile({\n version: '1.0',\n type: ProfileType.AI_AGENT,\n display_name: displayName,\n alias: options?.alias,\n bio: options?.bio,\n socials: options?.socials,\n profileImage: options?.profileImage,\n properties: options?.properties,\n inboundTopicId: options?.inboundTopicId,\n outboundTopicId: options?.outboundTopicId,\n base_account: options?.baseAccount,\n aiAgent: {\n type: agentType,\n capabilities,\n model,\n creator: options?.creator,\n },\n });\n\n if (!validation.valid) {\n throw new Error(\n `Invalid AI Agent Profile: ${validation.errors.join(', ')}`,\n );\n }\n\n return {\n version: '1.0',\n type: ProfileType.AI_AGENT,\n display_name: displayName,\n alias: options?.alias,\n bio: options?.bio,\n socials: options?.socials,\n profileImage: options?.profileImage,\n properties: options?.properties,\n inboundTopicId: options?.inboundTopicId,\n outboundTopicId: options?.outboundTopicId,\n base_account: options?.baseAccount,\n aiAgent: {\n type: agentType,\n capabilities,\n model,\n creator: options?.creator,\n },\n };\n }\n\n /**\n * Creates an MCP server profile.\n *\n * @param displayName - The display name for the MCP server\n * @param serverDetails - The MCP server details\n * @param options - Additional profile options\n * @returns An MCPServerProfile object\n */\n public createMCPServerProfile(\n displayName: string,\n serverDetails: MCPServerDetails,\n options?: {\n alias?: string;\n bio?: string;\n socials?: SocialLink[];\n profileImage?: string;\n properties?: Record<string, any>;\n inboundTopicId?: string;\n outboundTopicId?: string;\n },\n ): MCPServerProfile {\n const validation = this.validateProfile({\n version: '1.0',\n type: ProfileType.MCP_SERVER,\n display_name: displayName,\n alias: options?.alias,\n bio: options?.bio,\n socials: options?.socials,\n profileImage: options?.profileImage,\n properties: options?.properties,\n inboundTopicId: options?.inboundTopicId,\n outboundTopicId: options?.outboundTopicId,\n mcpServer: serverDetails,\n });\n\n if (!validation.valid) {\n throw new Error(\n `Invalid MCP Server Profile: ${validation.errors.join(', ')}`,\n );\n }\n\n return {\n version: '1.0',\n type: ProfileType.MCP_SERVER,\n display_name: displayName,\n alias: options?.alias,\n bio: options?.bio,\n socials: options?.socials,\n profileImage: options?.profileImage,\n properties: options?.properties,\n inboundTopicId: options?.inboundTopicId,\n outboundTopicId: options?.outboundTopicId,\n mcpServer: serverDetails,\n };\n }\n\n public validateProfile(profile: unknown): {\n valid: boolean;\n errors: string[];\n } {\n const result = HCS11ProfileSchema.safeParse(profile);\n\n if (result.success) {\n return { valid: true, errors: [] };\n }\n\n const formattedErrors = result.error.errors.map((err: ZodIssue) => {\n const path = err.path.join('.');\n let message = err.message;\n\n if (err.code === 'invalid_type') {\n message = `Expected ${err.expected}, got ${err.received}`;\n } else if (err.code === 'invalid_enum_value') {\n const validOptions = err.options?.join(', ');\n message = `Invalid value. Valid options are: ${validOptions}`;\n } else if (err.code === 'too_small' && err.type === 'string') {\n message = 'Cannot be empty';\n }\n\n return `${path}: ${message}`;\n });\n\n return { valid: false, errors: formattedErrors };\n }\n\n public profileToJSONString(profile: HCS11Profile): string {\n return JSON.stringify(profile);\n }\n\n public parseProfileFromString(profileStr: string): HCS11Profile | null {\n try {\n const parsedProfile = JSON.parse(profileStr);\n const validation = this.validateProfile(parsedProfile);\n if (!validation.valid) {\n this.logger.error('Invalid profile format:', validation.errors);\n return null;\n }\n return parsedProfile as HCS11Profile;\n } catch (error) {\n this.logger.error('Error parsing profile:');\n return null;\n }\n }\n\n public setProfileForAccountMemo(\n topicId: string,\n topicStandard: 1 | 2 | 7 = 1,\n ): string {\n return `hcs-11:hcs://${topicStandard}/${topicId}`;\n }\n\n private async executeTransaction<T>(\n transaction: Transaction,\n ): Promise<TransactionResult<T>> {\n try {\n if (this.auth.privateKey) {\n const signedTx = await transaction.signWithOperator(this.client);\n const response = await signedTx.execute(this.client);\n const receipt = await response.getReceipt(this.client);\n\n if (receipt.status.toString() !== Status.Success.toString()) {\n return {\n success: false,\n error: `Transaction failed: ${receipt.status.toString()}`,\n };\n }\n\n return {\n success: true,\n result: receipt as T,\n };\n }\n\n if (!this.auth.signer) {\n throw new Error('No valid authentication method provided');\n }\n\n const signer = this.auth.signer;\n const frozenTransaction = await transaction.freezeWithSigner(signer);\n const response = await frozenTransaction.executeWithSigner(signer);\n const receipt = await response.getReceiptWithSigner(signer);\n\n if (receipt.status.toString() !== Status.Success.toString()) {\n return {\n success: false,\n error: `Transaction failed: ${receipt.status.toString()}: ${Status.Success.toString()}`,\n };\n }\n\n return {\n success: true,\n result: receipt as T,\n };\n } catch (error) {\n return {\n success: false,\n error:\n error instanceof Error\n ? error.message\n : 'Unknown error during transaction execution',\n };\n }\n }\n\n public async inscribeImage(\n buffer: Buffer,\n fileName: string,\n options?: InscribeImageOptions,\n ): Promise<InscribeImageResponse> {\n try {\n const progressCallback = options?.progressCallback;\n const progressReporter = new ProgressReporter({\n module: 'HCS11-Image',\n logger: this.logger,\n callback: progressCallback as any,\n });\n\n progressReporter.preparing('Preparing to inscribe image', 0);\n\n const mimeType = mime.lookup(fileName) || 'application/octet-stream';\n\n const waitForConfirmation = options?.waitForConfirmation ?? true;\n\n let inscriptionResponse;\n if (this.auth.signer) {\n if ('accountId' in this.auth.signer) {\n progressReporter.preparing('Using signer for inscription', 10);\n\n inscriptionResponse = await inscribeWithSigner(\n {\n type: 'buffer',\n buffer,\n fileName,\n mimeType,\n },\n this.auth.signer as DAppSigner,\n {\n network: this.network as 'mainnet' | 'testnet',\n waitForConfirmation,\n waitMaxAttempts: 150,\n waitIntervalMs: 4000,\n logging: {\n level: 'debug',\n },\n progressCallback: data => {\n const adjustedPercent = 10 + (data.progressPercent || 0) * 0.8;\n progressReporter.report({\n stage: data.stage,\n message: data.message,\n progressPercent: adjustedPercent,\n details: data.details,\n });\n },\n },\n );\n } else {\n progressReporter.failed(\n 'Signer must be a DAppSigner for inscription',\n );\n throw new Error('Signer must be a DAppSigner for inscription');\n }\n } else {\n if (!this.auth.privateKey) {\n progressReporter.failed('Private key is required for inscription');\n this.logger.error('Private key is required for inscription');\n throw new Error('Private key is required for inscription');\n }\n\n progressReporter.preparing('Using private key for inscription', 10);\n\n const PK =\n this.keyType === 'ecdsa'\n ? PrivateKey.fromStringECDSA(this.auth.privateKey)\n : PrivateKey.fromStringED25519(this.auth.privateKey);\n\n inscriptionResponse = await inscribe(\n {\n type: 'buffer',\n buffer,\n fileName,\n mimeType,\n },\n {\n accountId: this.auth.operatorId,\n privateKey: PK,\n network: this.network as 'mainnet' | 'testnet',\n },\n {\n waitForConfirmation,\n waitMaxAttempts: 150,\n waitIntervalMs: 2000,\n logging: {\n level: 'debug',\n },\n progressCallback: data => {\n const adjustedPercent = 10 + (data.progressPercent || 0) * 0.8;\n progressReporter.report({\n stage: data.stage,\n message: data.message,\n progressPercent: adjustedPercent,\n details: data.details,\n });\n },\n },\n );\n }\n\n if (inscriptionResponse.confirmed) {\n progressReporter.completed('Image inscription completed', {\n topicId: getTopicId(inscriptionResponse.inscription),\n });\n return {\n imageTopicId: getTopicId(inscriptionResponse.inscription) || '',\n transactionId: (inscriptionResponse.result as InscriptionResult)\n .jobId,\n success: true,\n };\n } else {\n const jobId = inscriptionResponse.quote\n ? 'quote-only'\n : (inscriptionResponse.result as InscriptionResult).jobId;\n progressReporter.verifying('Waiting for inscription confirmation', 50, {\n jobId,\n });\n return {\n imageTopicId: '',\n transactionId: jobId,\n success: false,\n error: 'Inscription not confirmed',\n };\n }\n } catch (error) {\n this.logger.error('Error inscribing image:', error);\n return {\n imageTopicId: '',\n transactionId: '',\n success: false,\n error:\n error instanceof Error ? error.message : 'Error inscribing image',\n };\n }\n }\n\n public async inscribeProfile(\n profile: HCS11Profile,\n options?: InscribeProfileOptions,\n ): Promise<InscribeProfileResponse> {\n this.logger.info('Inscribing HCS-11 profile');\n\n const progressCallback = options?.progressCallback;\n const progressReporter = new ProgressReporter({\n module: 'HCS11-Profile',\n logger: this.logger,\n callback: progressCallback,\n });\n\n await this.attachUaidIfMissing(profile);\n\n progressReporter.preparing('Validating profile data', 5);\n\n const validation = this.validateProfile(profile);\n if (!validation.valid) {\n progressReporter.failed(\n `Invalid profile: ${validation.errors.join(', ')}`,\n );\n return {\n profileTopicId: '',\n transactionId: '',\n success: false,\n error: `Invalid profile: ${validation.errors.join(', ')}`,\n };\n }\n\n progressReporter.preparing('Formatting profile for inscription', 15);\n\n const profileJson = this.profileToJSONString(profile);\n const fileName = `profile-${profile.display_name\n .toLowerCase()\n .replace(/\\s+/g, '-')}.json`;\n\n try {\n const contentBuffer = Buffer.from(profileJson, 'utf-8');\n const contentType = 'application/json';\n\n progressReporter.preparing('Preparing profile for inscription', 20);\n\n const input: InscriptionInput = {\n type: 'buffer',\n buffer: contentBuffer,\n fileName,\n mimeType: contentType,\n };\n\n const inscriptionOptions: InscriptionOptions = {\n waitForConfirmation: true,\n mode: 'file',\n network: this.network as 'mainnet' | 'testnet',\n waitMaxAttempts: 100,\n waitIntervalMs: 2000,\n progressCallback: data => {\n const adjustedPercent =\n 20 + Number(data?.progressPercent || 0) * 0.75;\n progressReporter?.report({\n stage: data.stage,\n message: data.message,\n progressPercent: adjustedPercent,\n details: data.details,\n });\n },\n };\n\n progressReporter.submitting('Submitting profile to Hedera network', 30);\n\n let inscriptionResponse;\n\n if (this.auth.privateKey) {\n const PK =\n this.keyType === 'ecdsa'\n ? PrivateKey.fromStringECDSA(this.auth.privateKey)\n : PrivateKey.fromStringED25519(this.auth.privateKey);\n\n inscriptionResponse = await inscribe(\n input,\n {\n accountId: this.auth.operatorId,\n privateKey: PK,\n network: this.network as 'mainnet' | 'testnet',\n },\n inscriptionOptions,\n );\n } else if (this.auth.signer) {\n inscriptionResponse = await inscribeWithSigner(\n input,\n this.auth.signer as DAppSigner,\n inscriptionOptions,\n );\n } else {\n throw new Error(\n 'No authentication method available - neither private key nor signer',\n );\n }\n\n if (\n !inscriptionResponse.confirmed ||\n !getTopicId(inscriptionResponse.inscription)\n ) {\n progressReporter.failed('Failed to inscribe profile content');\n return {\n profileTopicId: '',\n transactionId: '',\n success: false,\n error: 'Failed to inscribe profile content',\n };\n }\n const topicId = getTopicId(inscriptionResponse.inscription);\n\n progressReporter.completed('Profile inscription completed', {\n topicId,\n transactionId: (inscriptionResponse.result as InscriptionResult)\n .transactionId,\n });\n\n return {\n profileTopicId: topicId,\n transactionId: (inscriptionResponse.result as InscriptionResult)\n .transactionId,\n success: true,\n };\n } catch (error) {\n progressReporter.failed(\n `Error inscribing profile: ${error.message || 'Unknown error'}`,\n );\n return {\n profileTopicId: '',\n transactionId: '',\n success: false,\n error: error.message || 'Unknown error during inscription',\n };\n }\n }\n\n private async attachUaidIfMissing(profile: HCS11Profile): Promise<void> {\n if (profile.uaid) {\n return;\n }\n if (!isHederaNetwork(this.network)) return;\n try {\n const { HCS14Client } = await import('../hcs-14');\n const hcs14 = new HCS14Client({ client: this.client });\n const did = await hcs14.createDid({\n method: 'hedera',\n client: this.client,\n });\n const nativeId = toHederaCaip10(this.network, this.auth.operatorId);\n let uid = this.auth.operatorId;\n const inboundFromProfile = profile.inboundTopicId;\n if (inboundFromProfile && inboundFromProfile.trim().length > 0) {\n uid = `${inboundFromProfile}@${this.auth.operatorId}`;\n } else {\n try {\n const fetched = await this.fetchProfileByAccountId(\n this.auth.operatorId,\n this.network as 'mainnet' | 'testnet',\n );\n const inbound = fetched?.topicInfo?.inboundTopic;\n if (inbound && inbound.trim().length > 0) {\n uid = `${inbound}@${this.auth.operatorId}`;\n }\n } catch {}\n }\n\n const uaid = hcs14.createUaid(did, { proto: 'hcs-10', nativeId, uid });\n profile.uaid = uaid;\n } catch {\n this.logger.warn(\n 'Hiero registrar not available; skipping UAID generation for profile',\n );\n }\n }\n\n public async updateAccountMemoWithProfile(\n accountId: string | AccountId,\n profileTopicId: string,\n ): Promise<TransactionResult> {\n try {\n this.logger.info(\n `Updating account memo for ${accountId} with profile ${profileTopicId}`,\n );\n const memo = this.setProfileForAccountMemo(profileTopicId);\n\n const transaction = new AccountUpdateTransaction()\n .setAccountMemo(memo)\n .setAccountId(accountId);\n\n return this.executeTransaction(transaction);\n } catch (error) {\n this.logger.error(\n `Error updating account memo: ${\n error instanceof Error ? error.message : 'Unknown error'\n }`,\n );\n return {\n success: false,\n error:\n error instanceof Error\n ? error.message\n : 'Unknown error updating account memo',\n };\n }\n }\n\n /**\n * Creates and inscribes a profile.\n *\n * @param profile - The profile to create and inscribe.\n * @param updateAccountMemo - Whether to update the account memo with the profile.\n * @param options - Optional configuration options.\n * @returns A promise that resolves to the inscription result.\n */\n public async createAndInscribeProfile(\n profile: HCS11Profile,\n updateAccountMemo = true,\n options?: InscribeProfileOptions,\n ): Promise<InscribeProfileResponse> {\n const progressCallback = options?.progressCallback;\n const progressReporter = new ProgressReporter({\n module: 'HCS11-ProfileCreation',\n logger: this.logger,\n callback: progressCallback,\n });\n\n progressReporter.preparing('Starting profile creation process', 0);\n\n const inscriptionProgress = progressReporter.createSubProgress({\n minPercent: 0,\n maxPercent: 80,\n logPrefix: 'Inscription',\n });\n\n const inscriptionResult = await this.inscribeProfile(profile, {\n ...options,\n progressCallback: data => {\n inscriptionProgress.report({\n stage: data.stage,\n message: data.message,\n progressPercent: data.progressPercent,\n details: data.details,\n });\n },\n });\n\n if (!inscriptionResult?.success) {\n progressReporter.failed('Profile inscription failed', {\n error: inscriptionResult?.error,\n });\n return inscriptionResult;\n }\n\n progressReporter.confirming('Profile inscribed, updating account memo', 85);\n\n if (updateAccountMemo) {\n const memoResult = await this.updateAccountMemoWithProfile(\n this.auth.operatorId,\n inscriptionResult.profileTopicId,\n );\n\n if (!memoResult.success) {\n progressReporter.failed('Failed to update account memo', {\n error: memoResult?.error,\n });\n return {\n ...inscriptionResult,\n success: false,\n error: memoResult?.error,\n };\n }\n }\n\n progressReporter.completed('Profile creation completed successfully', {\n profileTopicId: inscriptionResult.profileTopicId,\n transactionId: inscriptionResult.transactionId,\n });\n\n return inscriptionResult;\n }\n\n /**\n * Gets the capabilities from the capability names.\n *\n * @param capabilityNames - The capability names to get the capabilities for.\n * @returns The capabilities.\n */\n public async getCapabilitiesFromTags(\n capabilityNames: string[],\n ): Promise<number[]> {\n const capabilities: number[] = [];\n\n if (capabilityNames.length === 0) {\n return [AIAgentCapability.TEXT_GENERATION];\n }\n\n for (const capabilityName of capabilityNames) {\n const capability =\n capabilityNameToCapabilityMap[capabilityName.toLowerCase()];\n if (capability !== undefined && !capabilities.includes(capability)) {\n capabilities.push(capability);\n }\n }\n\n if (capabilities.length === 0) {\n capabilities.push(AIAgentCapability.TEXT_GENERATION);\n }\n\n return capabilities;\n }\n\n /**\n * Gets the agent type from the metadata.\n *\n * @param metadata - The metadata of the agent.\n * @returns The agent type.\n */\n public getAgentTypeFromMetadata(metadata: AgentMetadata): AIAgentType {\n if (metadata.type === 'autonomous') {\n return AIAgentType.AUTONOMOUS;\n } else {\n return AIAgentType.MANUAL;\n }\n }\n\n /**\n * Fetches a profile from the account memo.\n *\n * @param accountId - The account ID of the agent to fetch the profile for.\n * @param network - The network to use for the fetch.\n * @returns A promise that resolves to the profile.\n */\n public async fetchProfileByAccountId(\n accountId: string | AccountId,\n network?: string,\n ): Promise<{\n success: boolean;\n profile?: HCS11Profile;\n error?: string;\n topicInfo?: TopicInfo;\n }> {\n try {\n this.logger.debug(\n `Fetching profile for account ${accountId.toString()} on ${this.network}`,\n );\n\n const memo = await this.mirrorNode.getAccountMemo(accountId.toString());\n\n this.logger.debug(`Got account memo: ${memo}`);\n\n if (!memo?.startsWith('hcs-11:')) {\n return {\n success: false,\n error: `Account ${accountId.toString()} does not have a valid HCS-11 memo. Current memo: ${memo || 'empty'}`,\n };\n }\n\n this.logger.debug(`Found HCS-11 memo: ${memo}`);\n\n const protocolReference = memo.substring(7);\n\n if (protocolReference?.startsWith('hcs://')) {\n const hcsFormat = protocolReference.match(/hcs:\\/\\/(\\d+)\\/(.+)/);\n\n if (!hcsFormat) {\n return {\n success: false,\n error: `Invalid HCS protocol reference format: ${protocolReference}`,\n };\n }\n\n const [_, protocolId, profileTopicId] = hcsFormat;\n const networkParam = network || this.network || 'mainnet';\n\n this.logger.debug(\n `Retrieving profile from Kiloscribe CDN: ${profileTopicId}`,\n );\n const cdnUrl = `https://kiloscribe.com/api/inscription-cdn/${profileTopicId}?network=${networkParam}`;\n\n try {\n const response = await fetch(cdnUrl);\n\n if (!response.ok) {\n return {\n success: false,\n error: `Failed to fetch profile from Kiloscribe CDN: ${response.statusText}`,\n };\n }\n\n const profileData = await response.json();\n\n if (!profileData) {\n return {\n success: false,\n error: `No profile data found for topic ${profileTopicId}`,\n };\n }\n\n const parsed = HCS11ProfileSchema.safeParse(profileData);\n if (!parsed.success) {\n return {\n success: false,\n error: `Invalid HCS-11 profile data for topic ${profileTopicId}`,\n };\n }\n\n return {\n success: true,\n profile: parsed.data as HCS11Profile,\n topicInfo: {\n inboundTopic: parsed.data.inboundTopicId || '',\n outboundTopic: parsed.data.outboundTopicId || '',\n profileTopicId,\n },\n };\n } catch (cdnError) {\n this.logger.error(\n `Error retrieving from Kiloscribe CDN: ${cdnError.message}`,\n );\n return {\n success: false,\n error: `Error retrieving from Kiloscribe CDN: ${cdnError.message}`,\n };\n }\n } else if (protocolReference.startsWith('ipfs://')) {\n this.logger.warn('IPFS protocol references are not fully supported');\n const response = await fetch(\n `https://ipfs.io/ipfs/${protocolReference.replace('ipfs://', '')}`,\n );\n const profileData = await response.json();\n const parsed = HCS11ProfileSchema.safeParse(profileData);\n if (!parsed.success) {\n return {\n success: false,\n error: `Invalid HCS-11 profile data from IPFS reference ${protocolReference}`,\n };\n }\n return {\n success: true,\n profile: parsed.data as HCS11Profile,\n topicInfo: {\n inboundTopic: parsed.data.inboundTopicId || '',\n outboundTopic: parsed.data.outboundTopicId || '',\n profileTopicId: '',\n },\n };\n } else if (protocolReference.startsWith('ar://')) {\n const arTxId = protocolReference.replace('ar://', '');\n const response = await fetch(`https://arweave.net/${arTxId}`);\n\n if (!response.ok) {\n return {\n success: false,\n error: `Failed to fetch profile from Arweave ${arTxId}: ${response.statusText}`,\n };\n }\n\n const profileData = await response.json();\n const parsed = HCS11ProfileSchema.safeParse(profileData);\n if (!parsed.success) {\n return {\n success: false,\n error: `Invalid HCS-11 profile data from Arweave reference ${arTxId}`,\n };\n }\n return {\n success: true,\n profile: parsed.data as HCS11Profile,\n topicInfo: {\n inboundTopic: parsed.data.inboundTopicId || '',\n outboundTopic: parsed.data.outboundTopicId || '',\n profileTopicId: '',\n },\n };\n } else {\n return {\n success: false,\n error: `Invalid protocol reference format: ${protocolReference}`,\n };\n }\n } catch (error) {\n this.logger.error(`Error fetching profile: ${error.message}`);\n return {\n success: false,\n error: `Error fetching profile: ${error.message}`,\n };\n }\n }\n}\n"],"names":["response","receipt"],"mappings":";;;;;;;;;;;;;;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":["import {\n AccountId,\n AccountUpdateTransaction,\n Client,\n PrivateKey,\n Status,\n Transaction,\n} from '@hashgraph/sdk';\nimport {\n inscribe,\n inscribeWithSigner,\n InscriptionInput,\n InscriptionOptions,\n InscriptionResult,\n} from '../inscribe';\nimport { Logger, ILogger, getTopicId } from '../utils';\nimport * as mime from 'mime-types';\nimport { z, ZodIssue } from 'zod';\nimport type { DAppSigner } from '@hashgraph/hedera-wallet-connect';\nimport { ProgressReporter } from '../utils/progress-reporter';\nimport { HederaMirrorNode } from '../services';\nimport { isHederaNetwork, toHederaCaip10 } from '../hcs-14/caip';\nimport { TopicInfo } from '../services/types';\nimport {\n createNodeOperatorContext,\n type NodeOperatorContext,\n} from '../common/node-operator-resolver';\nimport { NetworkType } from '../utils/types';\nimport {\n ProfileType,\n AIAgentType,\n AIAgentCapability,\n SocialLink,\n PersonalProfile,\n AIAgentProfile,\n HCS11Profile,\n HCS11Auth,\n HCS11ClientConfig,\n TransactionResult,\n InscribeProfileResponse,\n InscribeImageResponse,\n AgentMetadata,\n InscribeImageOptions,\n InscribeProfileOptions,\n capabilityNameToCapabilityMap,\n MCPServerDetails,\n MCPServerProfile,\n MCPServerCapability,\n VerificationType,\n} from './types';\n\nexport const SocialLinkSchema = z.object({\n platform: z.string().min(1),\n handle: z.string().min(1),\n});\n\nexport const AIAgentDetailsSchema = z.object({\n type: z.nativeEnum(AIAgentType),\n capabilities: z.array(z.nativeEnum(AIAgentCapability)).min(1),\n model: z.string().min(1),\n creator: z.string().optional(),\n});\n\nexport const MCPServerConnectionInfoSchema = z.object({\n url: z.string().min(1),\n transport: z.enum(['stdio', 'sse']),\n});\n\nexport const MCPServerVerificationSchema = z.object({\n type: z.nativeEnum(VerificationType),\n value: z.string(),\n dns_field: z.string().optional(),\n challenge_path: z.string().optional(),\n});\n\nexport const MCPServerHostSchema = z.object({\n minVersion: z.string().optional(),\n});\n\nexport const MCPServerResourceSchema = z.object({\n name: z.string().min(1),\n description: z.string().min(1),\n});\n\nexport const MCPServerToolSchema = z.object({\n name: z.string().min(1),\n description: z.string().min(1),\n});\n\nexport const MCPServerDetailsSchema = z.object({\n version: z.string().min(1),\n connectionInfo: MCPServerConnectionInfoSchema,\n services: z.array(z.nativeEnum(MCPServerCapability)).min(1),\n description: z.string().min(1),\n verification: MCPServerVerificationSchema.optional(),\n host: MCPServerHostSchema.optional(),\n capabilities: z.array(z.string()).optional(),\n resources: z.array(MCPServerResourceSchema).optional(),\n tools: z.array(MCPServerToolSchema).optional(),\n maintainer: z.string().optional(),\n repository: z.string().optional(),\n docs: z.string().optional(),\n});\n\nexport const BaseProfileSchema = z.object({\n version: z.string().min(1),\n type: z.nativeEnum(ProfileType),\n display_name: z.string().min(1),\n alias: z.string().optional(),\n bio: z.string().optional(),\n socials: z.array(SocialLinkSchema).optional(),\n profileImage: z.string().optional(),\n uaid: z.string().optional(),\n properties: z.record(z.any()).optional(),\n inboundTopicId: z.string().optional(),\n outboundTopicId: z.string().optional(),\n base_account: z.string().optional(),\n});\n\nexport const PersonalProfileSchema = BaseProfileSchema.extend({\n type: z.literal(ProfileType.PERSONAL),\n language: z.string().optional(),\n timezone: z.string().optional(),\n});\n\nexport const AIAgentProfileSchema = BaseProfileSchema.extend({\n type: z.literal(ProfileType.AI_AGENT),\n aiAgent: AIAgentDetailsSchema,\n});\n\nexport const MCPServerProfileSchema = BaseProfileSchema.extend({\n type: z.literal(ProfileType.MCP_SERVER),\n mcpServer: MCPServerDetailsSchema,\n});\n\nconst FloraProfileSchema = z.object({\n version: z.string(),\n type: z.literal(ProfileType.FLORA),\n display_name: z.string().min(1),\n members: z.array(\n z.object({\n accountId: z.string(),\n publicKey: z.string().optional(),\n weight: z.number().optional(),\n }),\n ),\n threshold: z.number().min(1),\n topics: z.object({\n communication: z.string(),\n transaction: z.string(),\n state: z.string(),\n }),\n inboundTopicId: z.string(),\n outboundTopicId: z.string(),\n bio: z.string().optional(),\n metadata: z.record(z.any()).optional(),\n policies: z.record(z.any()).optional(),\n});\n\nexport const HCS11ProfileSchema = z.union([\n PersonalProfileSchema,\n AIAgentProfileSchema,\n MCPServerProfileSchema,\n FloraProfileSchema,\n]);\n\nexport class HCS11Client {\n private client: Client;\n private auth: HCS11Auth;\n private network: string;\n private logger: ILogger;\n private mirrorNode: HederaMirrorNode;\n private keyType: 'ed25519' | 'ecdsa';\n private operatorId: string;\n private operatorCtx?: NodeOperatorContext;\n\n constructor(config: HCS11ClientConfig) {\n this.client =\n config.network === 'mainnet' ? Client.forMainnet() : Client.forTestnet();\n this.auth = config.auth;\n this.network = config.network;\n this.operatorId = config.auth.operatorId;\n\n this.logger = Logger.getInstance({\n level: config.logLevel || 'info',\n module: 'HCS-11',\n silent: config.silent,\n });\n\n this.mirrorNode = new HederaMirrorNode(\n this.network as 'mainnet' | 'testnet',\n this.logger,\n );\n\n if (this.auth.privateKey) {\n this.operatorCtx = createNodeOperatorContext({\n network: this.network as NetworkType,\n operatorId: this.operatorId,\n operatorKey: this.auth.privateKey,\n keyType: config.keyType,\n mirrorNode: this.mirrorNode,\n logger: this.logger,\n client: this.client,\n });\n this.client = this.operatorCtx.client;\n this.keyType = this.operatorCtx.keyType;\n void this.operatorCtx.ensureInitialized();\n this.client.setOperator(this.operatorId, this.operatorCtx.operatorKey);\n } else {\n this.keyType = config.keyType || 'ed25519';\n }\n }\n\n public getClient(): Client {\n return this.client;\n }\n\n public getOperatorId(): string {\n return this.auth.operatorId;\n }\n\n public async initializeOperator() {\n if (!this.operatorCtx) {\n return;\n }\n\n try {\n await this.operatorCtx.ensureInitialized();\n this.keyType = this.operatorCtx.keyType;\n this.client.setOperator(this.operatorId, this.operatorCtx.operatorKey);\n } catch (error) {\n this.logger.warn(\n `Failed to verify operator key with mirror node: ${\n (error as Error).message\n }`,\n );\n }\n }\n\n public createPersonalProfile(\n displayName: string,\n options?: {\n alias?: string;\n bio?: string;\n socials?: SocialLink[];\n profileImage?: string;\n language?: string;\n timezone?: string;\n properties?: Record<string, any>;\n inboundTopicId?: string;\n outboundTopicId?: string;\n baseAccount?: string;\n },\n ): PersonalProfile {\n return {\n version: '1.0',\n type: ProfileType.PERSONAL,\n display_name: displayName,\n alias: options?.alias,\n bio: options?.bio,\n socials: options?.socials,\n profileImage: options?.profileImage,\n properties: options?.properties,\n inboundTopicId: options?.inboundTopicId,\n outboundTopicId: options?.outboundTopicId,\n base_account: options?.baseAccount,\n };\n }\n\n public createAIAgentProfile(\n displayName: string,\n agentType: AIAgentType,\n capabilities: AIAgentCapability[],\n model: string,\n options?: {\n alias?: string;\n bio?: string;\n socials?: SocialLink[];\n profileImage?: string;\n properties?: Record<string, any>;\n inboundTopicId?: string;\n outboundTopicId?: string;\n creator?: string;\n baseAccount?: string;\n },\n ): AIAgentProfile {\n const validation = this.validateProfile({\n version: '1.0',\n type: ProfileType.AI_AGENT,\n display_name: displayName,\n alias: options?.alias,\n bio: options?.bio,\n socials: options?.socials,\n profileImage: options?.profileImage,\n properties: options?.properties,\n inboundTopicId: options?.inboundTopicId,\n outboundTopicId: options?.outboundTopicId,\n base_account: options?.baseAccount,\n aiAgent: {\n type: agentType,\n capabilities,\n model,\n creator: options?.creator,\n },\n });\n\n if (!validation.valid) {\n throw new Error(\n `Invalid AI Agent Profile: ${validation.errors.join(', ')}`,\n );\n }\n\n return {\n version: '1.0',\n type: ProfileType.AI_AGENT,\n display_name: displayName,\n alias: options?.alias,\n bio: options?.bio,\n socials: options?.socials,\n profileImage: options?.profileImage,\n properties: options?.properties,\n inboundTopicId: options?.inboundTopicId,\n outboundTopicId: options?.outboundTopicId,\n base_account: options?.baseAccount,\n aiAgent: {\n type: agentType,\n capabilities,\n model,\n creator: options?.creator,\n },\n };\n }\n\n /**\n * Creates an MCP server profile.\n *\n * @param displayName - The display name for the MCP server\n * @param serverDetails - The MCP server details\n * @param options - Additional profile options\n * @returns An MCPServerProfile object\n */\n public createMCPServerProfile(\n displayName: string,\n serverDetails: MCPServerDetails,\n options?: {\n alias?: string;\n bio?: string;\n socials?: SocialLink[];\n profileImage?: string;\n properties?: Record<string, any>;\n inboundTopicId?: string;\n outboundTopicId?: string;\n },\n ): MCPServerProfile {\n const validation = this.validateProfile({\n version: '1.0',\n type: ProfileType.MCP_SERVER,\n display_name: displayName,\n alias: options?.alias,\n bio: options?.bio,\n socials: options?.socials,\n profileImage: options?.profileImage,\n properties: options?.properties,\n inboundTopicId: options?.inboundTopicId,\n outboundTopicId: options?.outboundTopicId,\n mcpServer: serverDetails,\n });\n\n if (!validation.valid) {\n throw new Error(\n `Invalid MCP Server Profile: ${validation.errors.join(', ')}`,\n );\n }\n\n return {\n version: '1.0',\n type: ProfileType.MCP_SERVER,\n display_name: displayName,\n alias: options?.alias,\n bio: options?.bio,\n socials: options?.socials,\n profileImage: options?.profileImage,\n properties: options?.properties,\n inboundTopicId: options?.inboundTopicId,\n outboundTopicId: options?.outboundTopicId,\n mcpServer: serverDetails,\n };\n }\n\n public validateProfile(profile: unknown): {\n valid: boolean;\n errors: string[];\n } {\n const result = HCS11ProfileSchema.safeParse(profile);\n\n if (result.success) {\n return { valid: true, errors: [] };\n }\n\n const formattedErrors = result.error.errors.map((err: ZodIssue) => {\n const path = err.path.join('.');\n let message = err.message;\n\n if (err.code === 'invalid_type') {\n message = `Expected ${err.expected}, got ${err.received}`;\n } else if (err.code === 'invalid_enum_value') {\n const validOptions = err.options?.join(', ');\n message = `Invalid value. Valid options are: ${validOptions}`;\n } else if (err.code === 'too_small' && err.type === 'string') {\n message = 'Cannot be empty';\n }\n\n return `${path}: ${message}`;\n });\n\n return { valid: false, errors: formattedErrors };\n }\n\n public profileToJSONString(profile: HCS11Profile): string {\n return JSON.stringify(profile);\n }\n\n public parseProfileFromString(profileStr: string): HCS11Profile | null {\n try {\n const parsedProfile = JSON.parse(profileStr);\n const validation = this.validateProfile(parsedProfile);\n if (!validation.valid) {\n this.logger.error('Invalid profile format:', validation.errors);\n return null;\n }\n return parsedProfile as HCS11Profile;\n } catch (error) {\n this.logger.error('Error parsing profile:');\n return null;\n }\n }\n\n public setProfileForAccountMemo(\n topicId: string,\n topicStandard: 1 | 2 | 7 = 1,\n ): string {\n return `hcs-11:hcs://${topicStandard}/${topicId}`;\n }\n\n private async executeTransaction<T>(\n transaction: Transaction,\n ): Promise<TransactionResult<T>> {\n try {\n if (this.auth.privateKey) {\n const signedTx = await transaction.signWithOperator(this.client);\n const response = await signedTx.execute(this.client);\n const receipt = await response.getReceipt(this.client);\n\n if (receipt.status.toString() !== Status.Success.toString()) {\n return {\n success: false,\n error: `Transaction failed: ${receipt.status.toString()}`,\n };\n }\n\n return {\n success: true,\n result: receipt as T,\n };\n }\n\n if (!this.auth.signer) {\n throw new Error('No valid authentication method provided');\n }\n\n const signer = this.auth.signer;\n const frozenTransaction = await transaction.freezeWithSigner(signer);\n const response = await frozenTransaction.executeWithSigner(signer);\n const receipt = await response.getReceiptWithSigner(signer);\n\n if (receipt.status.toString() !== Status.Success.toString()) {\n return {\n success: false,\n error: `Transaction failed: ${receipt.status.toString()}: ${Status.Success.toString()}`,\n };\n }\n\n return {\n success: true,\n result: receipt as T,\n };\n } catch (error) {\n return {\n success: false,\n error:\n error instanceof Error\n ? error.message\n : 'Unknown error during transaction execution',\n };\n }\n }\n\n public async inscribeImage(\n buffer: Buffer,\n fileName: string,\n options?: InscribeImageOptions,\n ): Promise<InscribeImageResponse> {\n try {\n const progressCallback = options?.progressCallback;\n const progressReporter = new ProgressReporter({\n module: 'HCS11-Image',\n logger: this.logger,\n callback: progressCallback as any,\n });\n\n progressReporter.preparing('Preparing to inscribe image', 0);\n\n const mimeType = mime.lookup(fileName) || 'application/octet-stream';\n\n const waitForConfirmation = options?.waitForConfirmation ?? true;\n\n let inscriptionResponse;\n if (this.auth.signer) {\n if ('accountId' in this.auth.signer) {\n progressReporter.preparing('Using signer for inscription', 10);\n\n inscriptionResponse = await inscribeWithSigner(\n {\n type: 'buffer',\n buffer,\n fileName,\n mimeType,\n },\n this.auth.signer as DAppSigner,\n {\n network: this.network as 'mainnet' | 'testnet',\n waitForConfirmation,\n waitMaxAttempts: 150,\n waitIntervalMs: 4000,\n logging: {\n level: 'debug',\n },\n progressCallback: data => {\n const adjustedPercent = 10 + (data.progressPercent || 0) * 0.8;\n progressReporter.report({\n stage: data.stage,\n message: data.message,\n progressPercent: adjustedPercent,\n details: data.details,\n });\n },\n },\n );\n } else {\n progressReporter.failed(\n 'Signer must be a DAppSigner for inscription',\n );\n throw new Error('Signer must be a DAppSigner for inscription');\n }\n } else {\n if (!this.auth.privateKey) {\n progressReporter.failed('Private key is required for inscription');\n this.logger.error('Private key is required for inscription');\n throw new Error('Private key is required for inscription');\n }\n\n progressReporter.preparing('Using private key for inscription', 10);\n\n const PK =\n this.keyType === 'ecdsa'\n ? PrivateKey.fromStringECDSA(this.auth.privateKey)\n : PrivateKey.fromStringED25519(this.auth.privateKey);\n\n inscriptionResponse = await inscribe(\n {\n type: 'buffer',\n buffer,\n fileName,\n mimeType,\n },\n {\n accountId: this.auth.operatorId,\n privateKey: PK,\n network: this.network as 'mainnet' | 'testnet',\n },\n {\n waitForConfirmation,\n waitMaxAttempts: 150,\n waitIntervalMs: 2000,\n logging: {\n level: 'debug',\n },\n progressCallback: data => {\n const adjustedPercent = 10 + (data.progressPercent || 0) * 0.8;\n progressReporter.report({\n stage: data.stage,\n message: data.message,\n progressPercent: adjustedPercent,\n details: data.details,\n });\n },\n },\n );\n }\n\n if (inscriptionResponse.confirmed) {\n progressReporter.completed('Image inscription completed', {\n topicId: getTopicId(inscriptionResponse.inscription),\n });\n return {\n imageTopicId: getTopicId(inscriptionResponse.inscription) || '',\n transactionId: (inscriptionResponse.result as InscriptionResult)\n .jobId,\n success: true,\n };\n } else {\n const jobId = inscriptionResponse.quote\n ? 'quote-only'\n : (inscriptionResponse.result as InscriptionResult).jobId;\n progressReporter.verifying('Waiting for inscription confirmation', 50, {\n jobId,\n });\n return {\n imageTopicId: '',\n transactionId: jobId,\n success: false,\n error: 'Inscription not confirmed',\n };\n }\n } catch (error) {\n this.logger.error('Error inscribing image:', error);\n return {\n imageTopicId: '',\n transactionId: '',\n success: false,\n error:\n error instanceof Error ? error.message : 'Error inscribing image',\n };\n }\n }\n\n public async inscribeProfile(\n profile: HCS11Profile,\n options?: InscribeProfileOptions,\n ): Promise<InscribeProfileResponse> {\n this.logger.info('Inscribing HCS-11 profile');\n\n const progressCallback = options?.progressCallback;\n const progressReporter = new ProgressReporter({\n module: 'HCS11-Profile',\n logger: this.logger,\n callback: progressCallback,\n });\n\n await this.attachUaidIfMissing(profile);\n\n progressReporter.preparing('Validating profile data', 5);\n\n const validation = this.validateProfile(profile);\n if (!validation.valid) {\n progressReporter.failed(\n `Invalid profile: ${validation.errors.join(', ')}`,\n );\n return {\n profileTopicId: '',\n transactionId: '',\n success: false,\n error: `Invalid profile: ${validation.errors.join(', ')}`,\n };\n }\n\n progressReporter.preparing('Formatting profile for inscription', 15);\n\n const profileJson = this.profileToJSONString(profile);\n const fileName = `profile-${profile.display_name\n .toLowerCase()\n .replace(/\\s+/g, '-')}.json`;\n\n try {\n const contentBuffer = Buffer.from(profileJson, 'utf-8');\n const contentType = 'application/json';\n\n progressReporter.preparing('Preparing profile for inscription', 20);\n\n const input: InscriptionInput = {\n type: 'buffer',\n buffer: contentBuffer,\n fileName,\n mimeType: contentType,\n };\n\n const inscriptionOptions: InscriptionOptions = {\n waitForConfirmation: true,\n mode: 'file',\n network: this.network as 'mainnet' | 'testnet',\n waitMaxAttempts: 100,\n waitIntervalMs: 2000,\n progressCallback: data => {\n const adjustedPercent =\n 20 + Number(data?.progressPercent || 0) * 0.75;\n progressReporter?.report({\n stage: data.stage,\n message: data.message,\n progressPercent: adjustedPercent,\n details: data.details,\n });\n },\n };\n\n progressReporter.submitting('Submitting profile to Hedera network', 30);\n\n let inscriptionResponse;\n\n if (this.auth.privateKey) {\n const PK =\n this.keyType === 'ecdsa'\n ? PrivateKey.fromStringECDSA(this.auth.privateKey)\n : PrivateKey.fromStringED25519(this.auth.privateKey);\n\n inscriptionResponse = await inscribe(\n input,\n {\n accountId: this.auth.operatorId,\n privateKey: PK,\n network: this.network as 'mainnet' | 'testnet',\n },\n inscriptionOptions,\n );\n } else if (this.auth.signer) {\n inscriptionResponse = await inscribeWithSigner(\n input,\n this.auth.signer as DAppSigner,\n inscriptionOptions,\n );\n } else {\n throw new Error(\n 'No authentication method available - neither private key nor signer',\n );\n }\n\n if (\n !inscriptionResponse.confirmed ||\n !getTopicId(inscriptionResponse.inscription)\n ) {\n progressReporter.failed('Failed to inscribe profile content');\n return {\n profileTopicId: '',\n transactionId: '',\n success: false,\n error: 'Failed to inscribe profile content',\n };\n }\n const topicId = getTopicId(inscriptionResponse.inscription);\n\n progressReporter.completed('Profile inscription completed', {\n topicId,\n transactionId: (inscriptionResponse.result as InscriptionResult)\n .transactionId,\n });\n\n return {\n profileTopicId: topicId,\n transactionId: (inscriptionResponse.result as InscriptionResult)\n .transactionId,\n success: true,\n };\n } catch (error) {\n progressReporter.failed(\n `Error inscribing profile: ${error.message || 'Unknown error'}`,\n );\n return {\n profileTopicId: '',\n transactionId: '',\n success: false,\n error: error.message || 'Unknown error during inscription',\n };\n }\n }\n\n private async attachUaidIfMissing(profile: HCS11Profile): Promise<void> {\n if (profile.uaid) {\n return;\n }\n if (!isHederaNetwork(this.network)) return;\n try {\n const { HCS14Client } = await import('../hcs-14');\n const hcs14 = new HCS14Client({ client: this.client });\n const did = await hcs14.createDid({\n method: 'hedera',\n client: this.client,\n });\n const nativeId = toHederaCaip10(this.network, this.auth.operatorId);\n let uid = this.auth.operatorId;\n const inboundFromProfile = profile.inboundTopicId;\n if (inboundFromProfile && inboundFromProfile.trim().length > 0) {\n uid = `${inboundFromProfile}@${this.auth.operatorId}`;\n } else {\n try {\n const fetched = await this.fetchProfileByAccountId(\n this.auth.operatorId,\n this.network as 'mainnet' | 'testnet',\n );\n const inbound = fetched?.topicInfo?.inboundTopic;\n if (inbound && inbound.trim().length > 0) {\n uid = `${inbound}@${this.auth.operatorId}`;\n }\n } catch {}\n }\n\n const uaid = hcs14.createUaid(did, { proto: 'hcs-10', nativeId, uid });\n profile.uaid = uaid;\n } catch {\n this.logger.warn(\n 'Hiero registrar not available; skipping UAID generation for profile',\n );\n }\n }\n\n public async updateAccountMemoWithProfile(\n accountId: string | AccountId,\n profileTopicId: string,\n ): Promise<TransactionResult> {\n try {\n this.logger.info(\n `Updating account memo for ${accountId} with profile ${profileTopicId}`,\n );\n const memo = this.setProfileForAccountMemo(profileTopicId);\n\n const transaction = new AccountUpdateTransaction()\n .setAccountMemo(memo)\n .setAccountId(accountId);\n\n return this.executeTransaction(transaction);\n } catch (error) {\n this.logger.error(\n `Error updating account memo: ${\n error instanceof Error ? error.message : 'Unknown error'\n }`,\n );\n return {\n success: false,\n error:\n error instanceof Error\n ? error.message\n : 'Unknown error updating account memo',\n };\n }\n }\n\n /**\n * Creates and inscribes a profile.\n *\n * @param profile - The profile to create and inscribe.\n * @param updateAccountMemo - Whether to update the account memo with the profile.\n * @param options - Optional configuration options.\n * @returns A promise that resolves to the inscription result.\n */\n public async createAndInscribeProfile(\n profile: HCS11Profile,\n updateAccountMemo = true,\n options?: InscribeProfileOptions,\n ): Promise<InscribeProfileResponse> {\n const progressCallback = options?.progressCallback;\n const progressReporter = new ProgressReporter({\n module: 'HCS11-ProfileCreation',\n logger: this.logger,\n callback: progressCallback,\n });\n\n progressReporter.preparing('Starting profile creation process', 0);\n\n const inscriptionProgress = progressReporter.createSubProgress({\n minPercent: 0,\n maxPercent: 80,\n logPrefix: 'Inscription',\n });\n\n const inscriptionResult = await this.inscribeProfile(profile, {\n ...options,\n progressCallback: data => {\n inscriptionProgress.report({\n stage: data.stage,\n message: data.message,\n progressPercent: data.progressPercent,\n details: data.details,\n });\n },\n });\n\n if (!inscriptionResult?.success) {\n progressReporter.failed('Profile inscription failed', {\n error: inscriptionResult?.error,\n });\n return inscriptionResult;\n }\n\n progressReporter.confirming('Profile inscribed, updating account memo', 85);\n\n if (updateAccountMemo) {\n const memoResult = await this.updateAccountMemoWithProfile(\n this.auth.operatorId,\n inscriptionResult.profileTopicId,\n );\n\n if (!memoResult.success) {\n progressReporter.failed('Failed to update account memo', {\n error: memoResult?.error,\n });\n return {\n ...inscriptionResult,\n success: false,\n error: memoResult?.error,\n };\n }\n }\n\n progressReporter.completed('Profile creation completed successfully', {\n profileTopicId: inscriptionResult.profileTopicId,\n transactionId: inscriptionResult.transactionId,\n });\n\n return inscriptionResult;\n }\n\n /**\n * Gets the capabilities from the capability names.\n *\n * @param capabilityNames - The capability names to get the capabilities for.\n * @returns The capabilities.\n */\n public async getCapabilitiesFromTags(\n capabilityNames: string[],\n ): Promise<number[]> {\n const capabilities: number[] = [];\n\n if (capabilityNames.length === 0) {\n return [AIAgentCapability.TEXT_GENERATION];\n }\n\n for (const capabilityName of capabilityNames) {\n const capability =\n capabilityNameToCapabilityMap[capabilityName.toLowerCase()];\n if (capability !== undefined && !capabilities.includes(capability)) {\n capabilities.push(capability);\n }\n }\n\n if (capabilities.length === 0) {\n capabilities.push(AIAgentCapability.TEXT_GENERATION);\n }\n\n return capabilities;\n }\n\n /**\n * Gets the agent type from the metadata.\n *\n * @param metadata - The metadata of the agent.\n * @returns The agent type.\n */\n public getAgentTypeFromMetadata(metadata: AgentMetadata): AIAgentType {\n if (metadata.type === 'autonomous') {\n return AIAgentType.AUTONOMOUS;\n } else {\n return AIAgentType.MANUAL;\n }\n }\n\n /**\n * Fetches a profile from the account memo.\n *\n * @param accountId - The account ID of the agent to fetch the profile for.\n * @param network - The network to use for the fetch.\n * @returns A promise that resolves to the profile.\n */\n public async fetchProfileByAccountId(\n accountId: string | AccountId,\n network?: string,\n ): Promise<{\n success: boolean;\n profile?: HCS11Profile;\n error?: string;\n topicInfo?: TopicInfo;\n }> {\n try {\n this.logger.debug(\n `Fetching profile for account ${accountId.toString()} on ${this.network}`,\n );\n\n const memo = await this.mirrorNode.getAccountMemo(accountId.toString());\n\n this.logger.debug(`Got account memo: ${memo}`);\n\n if (!memo?.startsWith('hcs-11:')) {\n return {\n success: false,\n error: `Account ${accountId.toString()} does not have a valid HCS-11 memo. Current memo: ${memo || 'empty'}`,\n };\n }\n\n this.logger.debug(`Found HCS-11 memo: ${memo}`);\n\n const protocolReference = memo.substring(7);\n\n if (protocolReference?.startsWith('hcs://')) {\n const hcsFormat = protocolReference.match(/hcs:\\/\\/(\\d+)\\/(.+)/);\n\n if (!hcsFormat) {\n return {\n success: false,\n error: `Invalid HCS protocol reference format: ${protocolReference}`,\n };\n }\n\n const [_, protocolId, profileTopicId] = hcsFormat;\n const networkParam = network || this.network || 'mainnet';\n\n this.logger.debug(\n `Retrieving profile from Kiloscribe CDN: ${profileTopicId}`,\n );\n const cdnUrl = `https://kiloscribe.com/api/inscription-cdn/${profileTopicId}?network=${networkParam}`;\n\n try {\n const response = await fetch(cdnUrl);\n\n if (!response.ok) {\n return {\n success: false,\n error: `Failed to fetch profile from Kiloscribe CDN: ${response.statusText}`,\n };\n }\n\n const profileData = await response.json();\n\n if (!profileData) {\n return {\n success: false,\n error: `No profile data found for topic ${profileTopicId}`,\n };\n }\n\n const parsed = HCS11ProfileSchema.safeParse(profileData);\n if (!parsed.success) {\n return {\n success: false,\n error: `Invalid HCS-11 profile data for topic ${profileTopicId}`,\n };\n }\n\n return {\n success: true,\n profile: parsed.data as HCS11Profile,\n topicInfo: {\n inboundTopic: parsed.data.inboundTopicId || '',\n outboundTopic: parsed.data.outboundTopicId || '',\n profileTopicId,\n },\n };\n } catch (cdnError) {\n this.logger.error(\n `Error retrieving from Kiloscribe CDN: ${cdnError.message}`,\n );\n return {\n success: false,\n error: `Error retrieving from Kiloscribe CDN: ${cdnError.message}`,\n };\n }\n } else if (protocolReference.startsWith('ipfs://')) {\n this.logger.warn('IPFS protocol references are not fully supported');\n const response = await fetch(\n `https://ipfs.io/ipfs/${protocolReference.replace('ipfs://', '')}`,\n );\n const profileData = await response.json();\n const parsed = HCS11ProfileSchema.safeParse(profileData);\n if (!parsed.success) {\n return {\n success: false,\n error: `Invalid HCS-11 profile data from IPFS reference ${protocolReference}`,\n };\n }\n return {\n success: true,\n profile: parsed.data as HCS11Profile,\n topicInfo: {\n inboundTopic: parsed.data.inboundTopicId || '',\n outboundTopic: parsed.data.outboundTopicId || '',\n profileTopicId: '',\n },\n };\n } else if (protocolReference.startsWith('ar://')) {\n const arTxId = protocolReference.replace('ar://', '');\n const response = await fetch(`https://arweave.net/${arTxId}`);\n\n if (!response.ok) {\n return {\n success: false,\n error: `Failed to fetch profile from Arweave ${arTxId}: ${response.statusText}`,\n };\n }\n\n const profileData = await response.json();\n const parsed = HCS11ProfileSchema.safeParse(profileData);\n if (!parsed.success) {\n return {\n success: false,\n error: `Invalid HCS-11 profile data from Arweave reference ${arTxId}`,\n };\n }\n return {\n success: true,\n profile: parsed.data as HCS11Profile,\n topicInfo: {\n inboundTopic: parsed.data.inboundTopicId || '',\n outboundTopic: parsed.data.outboundTopicId || '',\n profileTopicId: '',\n },\n };\n } else {\n return {\n success: false,\n error: `Invalid protocol reference format: ${protocolReference}`,\n };\n }\n } catch (error) {\n this.logger.error(`Error fetching profile: ${error.message}`);\n return {\n success: false,\n error: `Error fetching profile: ${error.message}`,\n };\n }\n }\n}\n"],"names":["response","receipt"],"mappings":";;;;;;;;;;;;;;;;;AAmDO,MAAM,mBAAmB,EAAE,OAAO;AAAA,EACvC,UAAU,EAAE,SAAS,IAAI,CAAC;AAAA,EAC1B,QAAQ,EAAE,OAAA,EAAS,IAAI,CAAC;AAC1B,CAAC;AAEM,MAAM,uBAAuB,EAAE,OAAO;AAAA,EAC3C,MAAM,EAAE,WAAW,WAAW;AAAA,EAC9B,cAAc,EAAE,MAAM,EAAE,WAAW,iBAAiB,CAAC,EAAE,IAAI,CAAC;AAAA,EAC5D,OAAO,EAAE,SAAS,IAAI,CAAC;AAAA,EACvB,SAAS,EAAE,OAAA,EAAS,SAAA;AACtB,CAAC;AAEM,MAAM,gCAAgC,EAAE,OAAO;AAAA,EACpD,KAAK,EAAE,SAAS,IAAI,CAAC;AA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L,SAAS;AAAA,UACT,SAAS,OAAO;AAAA,UAChB,WAAW;AAAA,YACT,cAAc,OAAO,KAAK,kBAAkB;AAAA,YAC5C,eAAe,OAAO,KAAK,mBAAmB;AAAA,YAC9C,gBAAgB;AAAA,UAAA;AAAA,QAClB;AAAA,MAEJ,OAAO;AACL,eAAO;AAAA,UACL,SAAS;AAAA,UACT,OAAO,sCAAsC,iBAAiB;AAAA,QAAA;AAAA,MAElE;AAAA,IACF,SAAS,OAAO;AACd,WAAK,OAAO,MAAM,2BAA2B,MAAM,OAAO,EAAE;AAC5D,aAAO;AAAA,QACL,SAAS;AAAA,QACT,OAAO,2BAA2B,MAAM,OAAO;AAAA,MAAA;AAAA,IAEnD;AAAA,EACF;AACF;"}
@@ -1,5 +1,5 @@
1
1
  import { getCryptoAdapter } from "./standards-sdk.es107.js";
2
- import { base58Encode } from "./standards-sdk.es122.js";
2
+ import { base58Encode } from "./standards-sdk.es124.js";
3
3
  import { canonicalizeAgentData } from "./standards-sdk.es50.js";
4
4
  function encodeMultibaseB58btc(input) {
5
5
  const bytes = Buffer.from(input, "utf8");
@@ -1,6 +1,6 @@
1
1
  import { HieroDidResolver } from "./standards-sdk.es54.js";
2
2
  import { parseHcs14Did } from "./standards-sdk.es51.js";
3
- import { multibaseB58btcDecode } from "./standards-sdk.es122.js";
3
+ import { multibaseB58btcDecode } from "./standards-sdk.es124.js";
4
4
  class ResolverRegistry {
5
5
  constructor() {
6
6
  this.resolvers = [];
@@ -1,4 +1,4 @@
1
- import { HCS5BaseClient } from "./standards-sdk.es123.js";
1
+ import { HCS5BaseClient } from "./standards-sdk.es122.js";
2
2
  import { buildHcs1Hrl } from "./standards-sdk.es58.js";
3
3
  import { PrivateKey } from "@hashgraph/sdk";
4
4
  import { inscribeWithSigner } from "./standards-sdk.es112.js";
@@ -1,4 +1,4 @@
1
- import { HCS5BaseClient } from "./standards-sdk.es123.js";
1
+ import { HCS5BaseClient } from "./standards-sdk.es122.js";
2
2
  import { buildHcs1Hrl } from "./standards-sdk.es58.js";
3
3
  import { AccountId } from "@hashgraph/sdk";
4
4
  import { inscribe } from "./standards-sdk.es112.js";
@@ -5,10 +5,8 @@ var FloraTopicType = /* @__PURE__ */ ((FloraTopicType2) => {
5
5
  return FloraTopicType2;
6
6
  })(FloraTopicType || {});
7
7
  var FloraOperation = /* @__PURE__ */ ((FloraOperation2) => {
8
- FloraOperation2["FLORA_CREATE_REQUEST"] = "flora_create_request";
9
- FloraOperation2["FLORA_CREATE_ACCEPTED"] = "flora_create_accepted";
10
8
  FloraOperation2["FLORA_CREATED"] = "flora_created";
11
- FloraOperation2["TX_PROPOSAL"] = "tx_proposal";
9
+ FloraOperation2["TRANSACTION"] = "transaction";
12
10
  FloraOperation2["STATE_UPDATE"] = "state_update";
13
11
  FloraOperation2["FLORA_JOIN_REQUEST"] = "flora_join_request";
14
12
  FloraOperation2["FLORA_JOIN_VOTE"] = "flora_join_vote";
@@ -1 +1 @@
1
- {"version":3,"file":"standards-sdk.es78.js","sources":["../../src/hcs-16/types.ts"],"sourcesContent":["import {\n AccountId,\n TopicId,\n PublicKey,\n Key,\n PrivateKey,\n KeyList,\n TokenId,\n} from '@hashgraph/sdk';\nimport { BaseProfile, SocialLink } from '../hcs-11/types';\n\n/**\n * HCS-16 Topic type enums\n */\nexport enum FloraTopicType {\n COMMUNICATION = 0,\n TRANSACTION = 1,\n STATE = 2,\n}\n\n/**\n * HCS-16 Flora member\n */\nexport interface FloraMember {\n accountId: string;\n publicKey?: PublicKey | string;\n privateKey?: string;\n weight?: number;\n}\n\n/**\n * HCS-16 Flora topics\n */\nexport interface FloraTopics {\n communication: TopicId;\n transaction: TopicId;\n state: TopicId;\n custom?: Array<{\n name: string;\n topicId: string;\n description?: string;\n }>;\n}\n\n/**\n * HCS-16 Flora configuration\n */\nexport interface FloraConfig {\n displayName: string;\n bio?: string;\n members: FloraMember[];\n threshold: number;\n initialBalance?: number;\n maxAutomaticTokenAssociations?: number;\n policies?: {\n membershipChange?: string;\n scheduleTxApproval?: string;\n };\n customFees?: {\n amount: number;\n feeCollectorAccountId: string;\n }[];\n metadata?: Record<string, any>;\n}\n\n/**\n * HCS-16 Flora creation result\n */\nexport interface FloraCreationResult {\n floraAccountId: AccountId;\n topics: FloraTopics;\n keyList: Key;\n transactionId: string;\n}\n\n/**\n * HCS-16 Message protocol operations\n */\nexport enum FloraOperation {\n FLORA_CREATE_REQUEST = 'flora_create_request',\n FLORA_CREATE_ACCEPTED = 'flora_create_accepted',\n FLORA_CREATED = 'flora_created',\n TX_PROPOSAL = 'tx_proposal',\n STATE_UPDATE = 'state_update',\n FLORA_JOIN_REQUEST = 'flora_join_request',\n FLORA_JOIN_VOTE = 'flora_join_vote',\n FLORA_JOIN_ACCEPTED = 'flora_join_accepted',\n}\n\n/**\n * HCS-16 Message envelope\n */\nexport interface FloraMessage {\n p: 'hcs-16';\n op: FloraOperation;\n operator_id: string;\n m?: string;\n [key: string]: unknown;\n}\n\n/**\n * HCS-16 Flora profile (extends HCS-11)\n */\nexport interface FloraProfile extends BaseProfile {\n version: string;\n type: 3;\n display_name: string;\n members: FloraMember[];\n threshold: number;\n topics: {\n communication: string;\n transaction: string;\n state: string;\n custom?: Array<{\n name: string;\n topicId: string;\n description?: string;\n }>;\n };\n alias?: string;\n bio?: string;\n socials?: SocialLink[];\n profileImage?: string;\n properties?: Record<string, unknown>;\n inboundTopicId: string;\n outboundTopicId: string;\n policies?: Record<string, string>;\n metadata?: Record<string, any>;\n}\n\n/**\n * HCS-16 errors\n */\nexport class FloraError extends Error {\n constructor(\n message: string,\n public readonly code: string,\n ) {\n super(message);\n this.name = 'FloraError';\n }\n}\n\n/**\n * Flora state update message\n */\nexport interface FloraStateUpdate {\n p: 'hcs-16';\n op: 'state_update';\n operator_id: string;\n hash: string;\n epoch?: number;\n members?: string[];\n timestamp: string;\n}\n\n/**\n * HIP-991 Custom fee configuration for transaction topics\n */\nexport interface TransactionTopicFee {\n amount: number;\n feeCollectorAccountId: string;\n denominatingTokenId?: string;\n}\n\n/**\n * Configuration for creating HCS-16 transaction topics with HIP-991 support\n */\nexport interface TransactionTopicConfig {\n memo: string;\n adminKey?: PrivateKey | KeyList;\n submitKey?: PrivateKey | KeyList;\n feeScheduleKey?: PrivateKey | KeyList;\n customFees?: TransactionTopicFee[];\n feeExemptKeys?: Key[];\n}\n\n/** credit_purchase not part of HCS-16 specification; no message type defined. */\n"],"names":["FloraTopicType","FloraOperation"],"mappings":"AAcO,IAAK,mCAAAA,oBAAL;AACLA,kBAAAA,gBAAA,mBAAgB,CAAA,IAAhB;AACAA,kBAAAA,gBAAA,iBAAc,CAAA,IAAd;AACAA,kBAAAA,gBAAA,WAAQ,CAAA,IAAR;AAHU,SAAAA;AAAA,GAAA,kBAAA,CAAA,CAAA;AAgEL,IAAK,mCAAAC,oBAAL;AACLA,kBAAA,sBAAA,IAAuB;AACvBA,kBAAA,uBAAA,IAAwB;AACxBA,kBAAA,eAAA,IAAgB;AAChBA,kBAAA,aAAA,IAAc;AACdA,kBAAA,cAAA,IAAe;AACfA,kBAAA,oBAAA,IAAqB;AACrBA,kBAAA,iBAAA,IAAkB;AAClBA,kBAAA,qBAAA,IAAsB;AARZ,SAAAA;AAAA,GAAA,kBAAA,CAAA,CAAA;AAuDL,MAAM,mBAAmB,MAAM;AAAA,EACpC,YACE,SACgB,MAChB;AACA,UAAM,OAAO;AAFG,SAAA,OAAA;AAGhB,SAAK,OAAO;AAAA,EACd;AACF;"}
1
+ {"version":3,"file":"standards-sdk.es78.js","sources":["../../src/hcs-16/types.ts"],"sourcesContent":["import {\n AccountId,\n TopicId,\n PublicKey,\n Key,\n PrivateKey,\n KeyList,\n TokenId,\n} from '@hashgraph/sdk';\nimport { BaseProfile, SocialLink } from '../hcs-11/types';\n\n/**\n * HCS-16 Topic type enums\n */\nexport enum FloraTopicType {\n COMMUNICATION = 0,\n TRANSACTION = 1,\n STATE = 2,\n}\n\n/**\n * HCS-16 Flora member\n */\nexport interface FloraMember {\n accountId: string;\n publicKey?: PublicKey | string;\n privateKey?: string;\n weight?: number;\n}\n\n/**\n * HCS-16 Flora topics\n */\nexport interface FloraTopics {\n communication: TopicId;\n transaction: TopicId;\n state: TopicId;\n custom?: Array<{\n name: string;\n topicId: string;\n description?: string;\n }>;\n}\n\n/**\n * HCS-16 Flora configuration\n */\nexport interface FloraConfig {\n displayName: string;\n bio?: string;\n members: FloraMember[];\n threshold: number;\n initialBalance?: number;\n maxAutomaticTokenAssociations?: number;\n policies?: {\n membershipChange?: string;\n scheduleTxApproval?: string;\n };\n customFees?: {\n amount: number;\n feeCollectorAccountId: string;\n }[];\n metadata?: Record<string, any>;\n}\n\n/**\n * HCS-16 Flora creation result\n */\nexport interface FloraCreationResult {\n floraAccountId: AccountId;\n topics: FloraTopics;\n keyList: Key;\n transactionId: string;\n}\n\n/**\n * HCS-16 Message protocol operations\n */\nexport enum FloraOperation {\n FLORA_CREATED = 'flora_created',\n TRANSACTION = 'transaction',\n STATE_UPDATE = 'state_update',\n FLORA_JOIN_REQUEST = 'flora_join_request',\n FLORA_JOIN_VOTE = 'flora_join_vote',\n FLORA_JOIN_ACCEPTED = 'flora_join_accepted',\n}\n\n/**\n * HCS-16 Message envelope\n */\nexport interface FloraMessage {\n p: 'hcs-16';\n op: FloraOperation;\n operator_id: string;\n m?: string;\n [key: string]: unknown;\n}\n\n/**\n * HCS-16 Flora profile (extends HCS-11)\n */\nexport interface FloraProfile extends BaseProfile {\n version: string;\n type: 3;\n display_name: string;\n members: FloraMember[];\n threshold: number;\n topics: {\n communication: string;\n transaction: string;\n state: string;\n custom?: Array<{\n name: string;\n topicId: string;\n description?: string;\n }>;\n };\n alias?: string;\n bio?: string;\n socials?: SocialLink[];\n profileImage?: string;\n properties?: Record<string, unknown>;\n inboundTopicId: string;\n outboundTopicId: string;\n policies?: Record<string, string>;\n metadata?: Record<string, any>;\n}\n\n/**\n * HCS-16 errors\n */\nexport class FloraError extends Error {\n constructor(\n message: string,\n public readonly code: string,\n ) {\n super(message);\n this.name = 'FloraError';\n }\n}\n\n/**\n * Flora state update message\n */\nexport interface FloraStateUpdate {\n p: 'hcs-16';\n op: 'state_update';\n operator_id: string;\n hash: string;\n epoch?: number;\n members?: string[];\n timestamp: string;\n}\n\n/**\n * HIP-991 Custom fee configuration for transaction topics\n */\nexport interface TransactionTopicFee {\n amount: number;\n feeCollectorAccountId: string;\n denominatingTokenId?: string;\n}\n\n/**\n * Configuration for creating HCS-16 transaction topics with HIP-991 support\n */\nexport interface TransactionTopicConfig {\n memo: string;\n adminKey?: PrivateKey | KeyList;\n submitKey?: PrivateKey | KeyList;\n feeScheduleKey?: PrivateKey | KeyList;\n customFees?: TransactionTopicFee[];\n feeExemptKeys?: Key[];\n}\n\n/** credit_purchase not part of HCS-16 specification; no message type defined. */\n"],"names":["FloraTopicType","FloraOperation"],"mappings":"AAcO,IAAK,mCAAAA,oBAAL;AACLA,kBAAAA,gBAAA,mBAAgB,CAAA,IAAhB;AACAA,kBAAAA,gBAAA,iBAAc,CAAA,IAAd;AACAA,kBAAAA,gBAAA,WAAQ,CAAA,IAAR;AAHU,SAAAA;AAAA,GAAA,kBAAA,CAAA,CAAA;AAgEL,IAAK,mCAAAC,oBAAL;AACLA,kBAAA,eAAA,IAAgB;AAChBA,kBAAA,aAAA,IAAc;AACdA,kBAAA,cAAA,IAAe;AACfA,kBAAA,oBAAA,IAAqB;AACrBA,kBAAA,iBAAA,IAAkB;AAClBA,kBAAA,qBAAA,IAAsB;AANZ,SAAAA;AAAA,GAAA,kBAAA,CAAA,CAAA;AAqDL,MAAM,mBAAmB,MAAM;AAAA,EACpC,YACE,SACgB,MAChB;AACA,UAAM,OAAO;AAFG,SAAA,OAAA;AAGhB,SAAK,OAAO;AAAA,EACd;AACF;"}
@@ -1,4 +1,4 @@
1
- import { AccountId, TopicCreateTransaction, CustomFixedFee, TokenId, AccountCreateTransaction, Hbar } from "@hashgraph/sdk";
1
+ import { AccountId, TopicCreateTransaction, CustomFixedFee, TokenId, AccountCreateTransaction, Hbar, AccountUpdateTransaction, ScheduleCreateTransaction, TopicUpdateTransaction } from "@hashgraph/sdk";
2
2
  import { buildTopicCreateTx, buildMessageTx } from "./standards-sdk.es121.js";
3
3
  import { FloraOperation } from "./standards-sdk.es78.js";
4
4
  function encodeHcs16FloraMemo(params) {
@@ -44,7 +44,7 @@ function buildHcs16CreateTransactionTopicTx(params) {
44
44
  tx.setCustomFees(fees);
45
45
  }
46
46
  if (params.feeExemptKeys && params.feeExemptKeys.length > 0) {
47
- tx.setFeeExemptKeyList(params.feeExemptKeys);
47
+ throw new Error("feeExemptKeys not supported by installed @hashgraph/sdk");
48
48
  }
49
49
  return tx;
50
50
  }
@@ -56,6 +56,26 @@ function buildHcs16CreateAccountTx(params) {
56
56
  tx.setMaxAutomaticTokenAssociations(maxAssoc);
57
57
  return tx;
58
58
  }
59
+ function buildHcs16ScheduleAccountKeyUpdateTx(params) {
60
+ const inner = new AccountUpdateTransaction().setAccountId(AccountId.fromString(params.floraAccountId)).setKey(params.newKeyList);
61
+ if (params.memo) {
62
+ inner.setTransactionMemo(params.memo);
63
+ }
64
+ return new ScheduleCreateTransaction().setScheduledTransaction(inner);
65
+ }
66
+ function buildHcs16ScheduleTopicKeyUpdateTx(params) {
67
+ const inner = new TopicUpdateTransaction().setTopicId(params.topicId);
68
+ if (params.adminKey) {
69
+ inner.setAdminKey(params.adminKey);
70
+ }
71
+ if (params.submitKey) {
72
+ inner.setSubmitKey(params.submitKey);
73
+ }
74
+ if (params.memo) {
75
+ inner.setTransactionMemo(params.memo);
76
+ }
77
+ return new ScheduleCreateTransaction().setScheduledTransaction(inner);
78
+ }
59
79
  function buildHcs16MessageTx(params) {
60
80
  const payload = {
61
81
  p: "hcs-16",
@@ -65,8 +85,7 @@ function buildHcs16MessageTx(params) {
65
85
  };
66
86
  return buildMessageTx({
67
87
  topicId: params.topicId,
68
- message: JSON.stringify(payload),
69
- transactionMemo: params.analyticsMemo
88
+ message: JSON.stringify(payload)
70
89
  });
71
90
  }
72
91
  function buildHcs16FloraCreatedTx(params) {
@@ -77,21 +96,19 @@ function buildHcs16FloraCreatedTx(params) {
77
96
  body: {
78
97
  flora_account_id: params.floraAccountId,
79
98
  topics: params.topics
80
- },
81
- analyticsMemo: params.analyticsMemo
99
+ }
82
100
  });
83
101
  }
84
- function buildHcs16TxProposalTx(params) {
102
+ function buildHcs16TransactionTx(params) {
85
103
  return buildHcs16MessageTx({
86
104
  topicId: params.topicId,
87
105
  operatorId: params.operatorId,
88
- op: FloraOperation.TX_PROPOSAL,
106
+ op: FloraOperation.TRANSACTION,
89
107
  body: {
90
- scheduled_tx_id: params.scheduledTxId,
91
- description: params.description,
92
- m: params.description
93
- },
94
- analyticsMemo: params.analyticsMemo
108
+ schedule_id: params.scheduleId,
109
+ data: params.data,
110
+ m: params.data
111
+ }
95
112
  });
96
113
  }
97
114
  function buildHcs16StateUpdateTx(params) {
@@ -103,29 +120,7 @@ function buildHcs16StateUpdateTx(params) {
103
120
  hash: params.hash,
104
121
  epoch: params.epoch,
105
122
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
106
- },
107
- analyticsMemo: params.analyticsMemo
108
- });
109
- }
110
- function buildHcs16FloraCreateRequestTx(params) {
111
- return buildHcs16MessageTx({
112
- topicId: params.topicId,
113
- operatorId: params.operatorId,
114
- op: FloraOperation.FLORA_CREATE_REQUEST,
115
- body: {
116
- members: params.members,
117
- threshold: params.threshold,
118
- seed_hbar: params.seedHbar
119
- },
120
- analyticsMemo: params.analyticsMemo
121
- });
122
- }
123
- function buildHcs16FloraCreateAcceptedTx(params) {
124
- return buildHcs16MessageTx({
125
- topicId: params.topicId,
126
- operatorId: params.operatorId,
127
- op: FloraOperation.FLORA_CREATE_ACCEPTED,
128
- analyticsMemo: params.analyticsMemo
123
+ }
129
124
  });
130
125
  }
131
126
  function buildHcs16FloraJoinRequestTx(params) {
@@ -135,8 +130,7 @@ function buildHcs16FloraJoinRequestTx(params) {
135
130
  op: FloraOperation.FLORA_JOIN_REQUEST,
136
131
  body: {
137
132
  candidate_account_id: params.candidateAccountId
138
- },
139
- analyticsMemo: params.analyticsMemo
133
+ }
140
134
  });
141
135
  }
142
136
  function buildHcs16FloraJoinVoteTx(params) {
@@ -147,8 +141,7 @@ function buildHcs16FloraJoinVoteTx(params) {
147
141
  body: {
148
142
  candidate_account_id: params.candidateAccountId,
149
143
  approve: params.approve
150
- },
151
- analyticsMemo: params.analyticsMemo
144
+ }
152
145
  });
153
146
  }
154
147
  function buildHcs16FloraJoinAcceptedTx(params) {
@@ -159,22 +152,21 @@ function buildHcs16FloraJoinAcceptedTx(params) {
159
152
  body: {
160
153
  members: params.members,
161
154
  epoch: params.epoch
162
- },
163
- analyticsMemo: params.analyticsMemo
155
+ }
164
156
  });
165
157
  }
166
158
  export {
167
159
  buildHcs16CreateAccountTx,
168
160
  buildHcs16CreateFloraTopicTx,
169
161
  buildHcs16CreateTransactionTopicTx,
170
- buildHcs16FloraCreateAcceptedTx,
171
- buildHcs16FloraCreateRequestTx,
172
162
  buildHcs16FloraCreatedTx,
173
163
  buildHcs16FloraJoinAcceptedTx,
174
164
  buildHcs16FloraJoinRequestTx,
175
165
  buildHcs16FloraJoinVoteTx,
176
166
  buildHcs16MessageTx,
167
+ buildHcs16ScheduleAccountKeyUpdateTx,
168
+ buildHcs16ScheduleTopicKeyUpdateTx,
177
169
  buildHcs16StateUpdateTx,
178
- buildHcs16TxProposalTx
170
+ buildHcs16TransactionTx
179
171
  };
180
172
  //# sourceMappingURL=standards-sdk.es79.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"standards-sdk.es79.js","sources":["../../src/hcs-16/tx.ts"],"sourcesContent":["import {\n TopicCreateTransaction,\n TopicMessageSubmitTransaction,\n AccountCreateTransaction,\n Hbar,\n PublicKey,\n KeyList,\n AccountId,\n CustomFixedFee,\n TokenId,\n} from '@hashgraph/sdk';\nimport {\n buildTopicCreateTx,\n buildMessageTx,\n type MaybeKey,\n} from '../common/tx/tx-utils';\nimport { FloraOperation, FloraTopicType, type FloraMessage } from './types';\n\nfunction encodeHcs16FloraMemo(params: {\n floraAccountId: string;\n topicType: FloraTopicType;\n}): string {\n return `hcs-16:${params.floraAccountId}:${params.topicType}`;\n}\n\n/**\n * Build a TopicCreateTransaction for HCS‑16 Flora topics (communication/transaction/state).\n */\nexport function buildHcs16CreateFloraTopicTx(params: {\n floraAccountId: string;\n topicType: FloraTopicType;\n adminKey?: MaybeKey;\n submitKey?: MaybeKey;\n operatorPublicKey?: PublicKey;\n autoRenewAccountId?: string;\n}): TopicCreateTransaction {\n const memo = encodeHcs16FloraMemo({\n floraAccountId: params.floraAccountId,\n topicType: params.topicType,\n });\n const tx = buildTopicCreateTx({\n memo,\n adminKey: params.adminKey,\n submitKey: params.submitKey,\n operatorPublicKey: params.operatorPublicKey,\n });\n if (params.autoRenewAccountId) {\n tx.setAutoRenewAccountId(AccountId.fromString(params.autoRenewAccountId));\n }\n return tx;\n}\n\n/**\n * Build a TopicCreateTransaction for a generic HCS‑16 transaction topic with HIP‑991 fees.\n */\nexport function buildHcs16CreateTransactionTopicTx(params: {\n memo: string;\n adminKey?: KeyList | PublicKey;\n submitKey?: KeyList | PublicKey;\n feeScheduleKey?: KeyList | PublicKey;\n customFees?: Array<{\n amount: number;\n feeCollectorAccountId: string;\n denominatingTokenId?: string;\n }>;\n feeExemptKeys?: PublicKey[];\n}): TopicCreateTransaction {\n const tx = new TopicCreateTransaction().setTopicMemo(params.memo);\n if (params.adminKey) {\n tx.setAdminKey(params.adminKey);\n }\n if (params.submitKey) {\n tx.setSubmitKey(params.submitKey);\n }\n if (params.feeScheduleKey) {\n tx.setFeeScheduleKey(params.feeScheduleKey);\n }\n if (params.customFees && params.customFees.length > 0) {\n const fees = params.customFees.map(fee => {\n const cf = new CustomFixedFee()\n .setAmount(fee.amount)\n .setFeeCollectorAccountId(\n AccountId.fromString(fee.feeCollectorAccountId),\n );\n if (fee.denominatingTokenId) {\n cf.setDenominatingTokenId(TokenId.fromString(fee.denominatingTokenId));\n }\n return cf;\n });\n tx.setCustomFees(fees);\n }\n if (params.feeExemptKeys && params.feeExemptKeys.length > 0) {\n (tx as any).setFeeExemptKeyList(params.feeExemptKeys);\n }\n return tx;\n}\n\n/**\n * Build an AccountCreateTransaction for a Flora account given a KeyList and optional params.\n */\nexport function buildHcs16CreateAccountTx(params: {\n keyList: KeyList;\n initialBalanceHbar?: number;\n maxAutomaticTokenAssociations?: number;\n}): AccountCreateTransaction {\n const tx = new AccountCreateTransaction().setKey(params.keyList);\n const initial =\n typeof params.initialBalanceHbar === 'number'\n ? params.initialBalanceHbar\n : 1;\n tx.setInitialBalance(new Hbar(initial));\n const maxAssoc =\n typeof params.maxAutomaticTokenAssociations === 'number'\n ? params.maxAutomaticTokenAssociations\n : -1;\n tx.setMaxAutomaticTokenAssociations(maxAssoc);\n return tx;\n}\n\n/**\n * Build a TopicMessageSubmitTransaction for generic HCS‑16 messages.\n * Body fields are merged into the envelope `{ p: 'hcs-16', op, operator_id }`.\n */\nexport function buildHcs16MessageTx(params: {\n topicId: string;\n operatorId: string;\n op: FloraOperation | string;\n body?: Record<string, unknown>;\n analyticsMemo?: string;\n}): TopicMessageSubmitTransaction {\n const payload: FloraMessage = {\n p: 'hcs-16',\n op: params.op as FloraOperation,\n operator_id: params.operatorId,\n ...(params.body || {}),\n } as FloraMessage;\n\n return buildMessageTx({\n topicId: params.topicId,\n message: JSON.stringify(payload),\n transactionMemo: params.analyticsMemo,\n });\n}\n\n/**\n * Build HCS‑16 flora_created message.\n */\nexport function buildHcs16FloraCreatedTx(params: {\n topicId: string;\n operatorId: string;\n floraAccountId: string;\n topics: { communication: string; transaction: string; state: string };\n analyticsMemo?: string;\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.FLORA_CREATED,\n body: {\n flora_account_id: params.floraAccountId,\n topics: params.topics,\n },\n analyticsMemo: params.analyticsMemo,\n });\n}\n\n/**\n * Build HCS‑16 tx_proposal message.\n */\nexport function buildHcs16TxProposalTx(params: {\n topicId: string;\n operatorId: string;\n scheduledTxId: string;\n description?: string;\n analyticsMemo?: string;\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.TX_PROPOSAL,\n body: {\n scheduled_tx_id: params.scheduledTxId,\n description: params.description,\n m: params.description,\n },\n analyticsMemo: params.analyticsMemo,\n });\n}\n\n/**\n * Build HCS‑16 state_update message.\n */\nexport function buildHcs16StateUpdateTx(params: {\n topicId: string;\n operatorId: string;\n hash: string;\n epoch?: number;\n analyticsMemo?: string;\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.STATE_UPDATE,\n body: {\n hash: params.hash,\n epoch: params.epoch,\n timestamp: new Date().toISOString(),\n },\n analyticsMemo: params.analyticsMemo,\n });\n}\n\n/**\n * Build HCS‑16 credit_purchase message.\n */\n/** credit_purchase is not part of HCS-16 specification; intentionally omitted. */\n\n/**\n * Build HCS‑16 flora_create_request message.\n */\nexport function buildHcs16FloraCreateRequestTx(params: {\n topicId: string;\n operatorId: string;\n members: string[];\n threshold: number;\n seedHbar?: number;\n analyticsMemo?: string;\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.FLORA_CREATE_REQUEST,\n body: {\n members: params.members,\n threshold: params.threshold,\n seed_hbar: params.seedHbar,\n },\n analyticsMemo: params.analyticsMemo,\n });\n}\n\n/**\n * Build HCS‑16 flora_create_accepted message.\n */\nexport function buildHcs16FloraCreateAcceptedTx(params: {\n topicId: string;\n operatorId: string;\n analyticsMemo?: string;\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.FLORA_CREATE_ACCEPTED,\n analyticsMemo: params.analyticsMemo,\n });\n}\n\n/**\n * Build HCS‑16 flora_join_request message.\n */\nexport function buildHcs16FloraJoinRequestTx(params: {\n topicId: string;\n operatorId: string;\n candidateAccountId: string;\n analyticsMemo?: string;\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.FLORA_JOIN_REQUEST,\n body: {\n candidate_account_id: params.candidateAccountId,\n },\n analyticsMemo: params.analyticsMemo,\n });\n}\n\n/**\n * Build HCS‑16 flora_join_vote message.\n */\nexport function buildHcs16FloraJoinVoteTx(params: {\n topicId: string;\n operatorId: string;\n candidateAccountId: string;\n approve: boolean;\n analyticsMemo?: string;\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.FLORA_JOIN_VOTE,\n body: {\n candidate_account_id: params.candidateAccountId,\n approve: params.approve,\n },\n analyticsMemo: params.analyticsMemo,\n });\n}\n\n/**\n * Build HCS‑16 flora_join_accepted message.\n */\nexport function buildHcs16FloraJoinAcceptedTx(params: {\n topicId: string;\n operatorId: string;\n members: string[];\n epoch?: number;\n analyticsMemo?: string;\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.FLORA_JOIN_ACCEPTED,\n body: {\n members: params.members,\n epoch: params.epoch,\n },\n analyticsMemo: params.analyticsMemo,\n });\n}\n"],"names":[],"mappings":";;;AAkBA,SAAS,qBAAqB,QAGnB;AACT,SAAO,UAAU,OAAO,cAAc,IAAI,OAAO,SAAS;AAC5D;AAKO,SAAS,6BAA6B,QAOlB;AACzB,QAAM,OAAO,qBAAqB;AAAA,IAChC,gBAAgB,OAAO;AAAA,IACvB,WAAW,OAAO;AAAA,EAAA,CACnB;AACD,QAAM,KAAK,mBAAmB;AAAA,IAC5B;AAAA,IACA,UAAU,OAAO;AAAA,IACjB,WAAW,OAAO;AAAA,IAClB,mBAAmB,OAAO;A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B,WAAW,OAAO;AAAA,IAAA;AAAA,IAEpB,eAAe,OAAO;AAAA,EAAA,CACvB;AACH;AAKO,SAAS,gCAAgC,QAId;AAChC,SAAO,oBAAoB;AAAA,IACzB,SAAS,OAAO;AAAA,IAChB,YAAY,OAAO;AAAA,IACnB,IAAI,eAAe;AAAA,IACnB,eAAe,OAAO;AAAA,EAAA,CACvB;AACH;AAKO,SAAS,6BAA6B,QAKX;AAChC,SAAO,oBAAoB;AAAA,IACzB,SAAS,OAAO;AAAA,IAChB,YAAY,OAAO;AAAA,IACnB,IAAI,eAAe;AAAA,IACnB,MAAM;AAAA,MACJ,sBAAsB,OAAO;AAAA,IAAA;AAAA,IAE/B,eAAe,OAAO;AAAA,EAAA,CACvB;AACH;AAKO,SAAS,0BAA0B,QAMR;AAChC,SAAO,oBAAoB;AAAA,IACzB,SAAS,OAAO;AAAA,IAChB,YAAY,OAAO;AAAA,IACnB,IAAI,eAAe;AAAA,IACnB,MAAM;AAAA,MACJ,sBAAsB,OAAO;AAAA,MAC7B,SAAS,OAAO;AAAA,IAAA;AAAA,IAElB,eAAe,OAAO;AAAA,EAAA,CACvB;AACH;AAKO,SAAS,8BAA8B,QAMZ;AAChC,SAAO,oBAAoB;AAAA,IACzB,SAAS,OAAO;AAAA,IAChB,YAAY,OAAO;AAAA,IACnB,IAAI,eAAe;AAAA,IACnB,MAAM;AAAA,MACJ,SAAS,OAAO;AAAA,MAChB,OAAO,OAAO;AAAA,IAAA;AAAA,IAEhB,eAAe,OAAO;AAAA,EAAA,CACvB;AACH;"}
1
+ {"version":3,"file":"standards-sdk.es79.js","sources":["../../src/hcs-16/tx.ts"],"sourcesContent":["import {\n TopicCreateTransaction,\n TopicMessageSubmitTransaction,\n TopicUpdateTransaction,\n AccountCreateTransaction,\n AccountUpdateTransaction,\n ScheduleCreateTransaction,\n Hbar,\n PublicKey,\n KeyList,\n AccountId,\n CustomFixedFee,\n TokenId,\n} from '@hashgraph/sdk';\nimport {\n buildTopicCreateTx,\n buildMessageTx,\n type MaybeKey,\n} from '../common/tx/tx-utils';\nimport { FloraOperation, FloraTopicType, type FloraMessage } from './types';\n\nfunction encodeHcs16FloraMemo(params: {\n floraAccountId: string;\n topicType: FloraTopicType;\n}): string {\n return `hcs-16:${params.floraAccountId}:${params.topicType}`;\n}\n\n/**\n * Build a TopicCreateTransaction for HCS‑16 Flora topics (communication/transaction/state).\n */\nexport function buildHcs16CreateFloraTopicTx(params: {\n floraAccountId: string;\n topicType: FloraTopicType;\n adminKey?: MaybeKey;\n submitKey?: MaybeKey;\n operatorPublicKey?: PublicKey;\n autoRenewAccountId?: string;\n}): TopicCreateTransaction {\n const memo = encodeHcs16FloraMemo({\n floraAccountId: params.floraAccountId,\n topicType: params.topicType,\n });\n const tx = buildTopicCreateTx({\n memo,\n adminKey: params.adminKey,\n submitKey: params.submitKey,\n operatorPublicKey: params.operatorPublicKey,\n });\n if (params.autoRenewAccountId) {\n tx.setAutoRenewAccountId(AccountId.fromString(params.autoRenewAccountId));\n }\n return tx;\n}\n\n/**\n * Build a TopicCreateTransaction for a generic HCS‑16 transaction topic with HIP‑991 fees.\n */\nexport function buildHcs16CreateTransactionTopicTx(params: {\n memo: string;\n adminKey?: KeyList | PublicKey;\n submitKey?: KeyList | PublicKey;\n feeScheduleKey?: KeyList | PublicKey;\n customFees?: Array<{\n amount: number;\n feeCollectorAccountId: string;\n denominatingTokenId?: string;\n }>;\n feeExemptKeys?: PublicKey[];\n}): TopicCreateTransaction {\n const tx = new TopicCreateTransaction().setTopicMemo(params.memo);\n if (params.adminKey) {\n tx.setAdminKey(params.adminKey);\n }\n if (params.submitKey) {\n tx.setSubmitKey(params.submitKey);\n }\n if (params.feeScheduleKey) {\n tx.setFeeScheduleKey(params.feeScheduleKey);\n }\n if (params.customFees && params.customFees.length > 0) {\n const fees = params.customFees.map(fee => {\n const cf = new CustomFixedFee()\n .setAmount(fee.amount)\n .setFeeCollectorAccountId(\n AccountId.fromString(fee.feeCollectorAccountId),\n );\n if (fee.denominatingTokenId) {\n cf.setDenominatingTokenId(TokenId.fromString(fee.denominatingTokenId));\n }\n return cf;\n });\n tx.setCustomFees(fees);\n }\n if (params.feeExemptKeys && params.feeExemptKeys.length > 0) {\n throw new Error('feeExemptKeys not supported by installed @hashgraph/sdk');\n }\n return tx;\n}\n\n/**\n * Build an AccountCreateTransaction for a Flora account given a KeyList and optional params.\n */\nexport function buildHcs16CreateAccountTx(params: {\n keyList: KeyList;\n initialBalanceHbar?: number;\n maxAutomaticTokenAssociations?: number;\n}): AccountCreateTransaction {\n const tx = new AccountCreateTransaction().setKey(params.keyList);\n const initial =\n typeof params.initialBalanceHbar === 'number'\n ? params.initialBalanceHbar\n : 1;\n tx.setInitialBalance(new Hbar(initial));\n const maxAssoc =\n typeof params.maxAutomaticTokenAssociations === 'number'\n ? params.maxAutomaticTokenAssociations\n : -1;\n tx.setMaxAutomaticTokenAssociations(maxAssoc);\n return tx;\n}\n\n/**\n * Build a ScheduleCreateTransaction that wraps an AccountUpdateTransaction to rotate the Flora account KeyList.\n * Members will sign this scheduled transaction until threshold is reached and it executes.\n */\nexport function buildHcs16ScheduleAccountKeyUpdateTx(params: {\n floraAccountId: string;\n newKeyList: KeyList;\n memo?: string;\n}): ScheduleCreateTransaction {\n const inner = new AccountUpdateTransaction()\n .setAccountId(AccountId.fromString(params.floraAccountId))\n .setKey(params.newKeyList);\n if (params.memo) {\n inner.setTransactionMemo(params.memo);\n }\n return new ScheduleCreateTransaction().setScheduledTransaction(inner);\n}\n\n/**\n * Build a ScheduleCreateTransaction that wraps a TopicUpdateTransaction to rotate topic admin/submit keys.\n * Repeat for CTopic, TTopic, and STopic as needed for membership changes.\n */\nexport function buildHcs16ScheduleTopicKeyUpdateTx(params: {\n topicId: string;\n adminKey?: KeyList | PublicKey;\n submitKey?: KeyList | PublicKey;\n memo?: string;\n}): ScheduleCreateTransaction {\n const inner = new TopicUpdateTransaction().setTopicId(params.topicId);\n if (params.adminKey) {\n inner.setAdminKey(params.adminKey);\n }\n if (params.submitKey) {\n inner.setSubmitKey(params.submitKey);\n }\n if (params.memo) {\n inner.setTransactionMemo(params.memo);\n }\n return new ScheduleCreateTransaction().setScheduledTransaction(inner);\n}\n\n/**\n * Build a TopicMessageSubmitTransaction for generic HCS‑16 messages.\n * Body fields are merged into the envelope `{ p: 'hcs-16', op, operator_id }`.\n */\nexport function buildHcs16MessageTx(params: {\n topicId: string;\n operatorId: string;\n op: FloraOperation;\n body?: Record<string, unknown>;\n}): TopicMessageSubmitTransaction {\n const payload: FloraMessage = {\n p: 'hcs-16',\n op: params.op,\n operator_id: params.operatorId,\n ...(params.body || {}),\n } as FloraMessage;\n\n return buildMessageTx({\n topicId: params.topicId,\n message: JSON.stringify(payload),\n });\n}\n\n/**\n * Build HCS‑16 flora_created message.\n */\nexport function buildHcs16FloraCreatedTx(params: {\n topicId: string;\n operatorId: string;\n floraAccountId: string;\n topics: { communication: string; transaction: string; state: string };\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.FLORA_CREATED,\n body: {\n flora_account_id: params.floraAccountId,\n topics: params.topics,\n },\n });\n}\n\n/**\n * Build HCS‑16 transaction message.\n */\nexport function buildHcs16TransactionTx(params: {\n topicId: string;\n operatorId: string;\n scheduleId: string;\n data?: string;\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.TRANSACTION,\n body: {\n schedule_id: params.scheduleId,\n data: params.data,\n m: params.data,\n },\n });\n}\n\n \n\n/**\n * Build HCS‑16 state_update message.\n */\nexport function buildHcs16StateUpdateTx(params: {\n topicId: string;\n operatorId: string;\n hash: string;\n epoch?: number;\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.STATE_UPDATE,\n body: {\n hash: params.hash,\n epoch: params.epoch,\n timestamp: new Date().toISOString(),\n },\n });\n}\n\n/**\n * Build HCS‑16 flora_join_request message.\n */\nexport function buildHcs16FloraJoinRequestTx(params: {\n topicId: string;\n operatorId: string;\n candidateAccountId: string;\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.FLORA_JOIN_REQUEST,\n body: {\n candidate_account_id: params.candidateAccountId,\n },\n });\n}\n\n/**\n * Build HCS‑16 flora_join_vote message.\n */\nexport function buildHcs16FloraJoinVoteTx(params: {\n topicId: string;\n operatorId: string;\n candidateAccountId: string;\n approve: boolean;\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.FLORA_JOIN_VOTE,\n body: {\n candidate_account_id: params.candidateAccountId,\n approve: params.approve,\n },\n });\n}\n\n/**\n * Build HCS‑16 flora_join_accepted message.\n */\nexport function buildHcs16FloraJoinAcceptedTx(params: {\n topicId: string;\n operatorId: string;\n members: string[];\n epoch?: number;\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.FLORA_JOIN_ACCEPTED,\n body: {\n members: params.members,\n epoch: params.epoch,\n },\n });\n}\n"],"names":[],"mappings":";;;AAqBA,SAAS,qBAAqB,QAGnB;AACT,SAAO,UAAU,OAAO,cAAc,IAAI,OAAO,SAAS;AAC5D;AAKO,SAAS,6BAA6B,QAOlB;AACzB,QAAM,OAAO,qBAAqB;AAAA,IAChC,gBAAgB,OAAO;AAAA,IACvB,WAAW,OAAO;AAAA,EAAA,CACnB;AACD,QAAM,KAAK,mBAAmB;AAAA,IAC5B;AAAA,IACA,UAAU,OAAO;AAAA,IACjB,WAAW,OAAO;AAAA,IAClB,mBAAmB,OAAO;AAAA,EAAA,CAC3B;AACD,MAAI,OAAO,oBAAoB;AAC7B,OAAG,sBAAsB,UAAU,WAAW,OAAO,kBAAkB,CAAC;AAAA,EA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