@hsuite/native-connect-angular 2.1.0 → 2.1.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 (277) hide show
  1. package/LICENSE +146 -0
  2. package/dist/fesm2022/hsuite-native-connect-angular.mjs +854 -308
  3. package/dist/fesm2022/hsuite-native-connect-angular.mjs.map +1 -1
  4. package/dist/index.d.ts +456 -30
  5. package/package.json +30 -13
  6. package/USAGE_EXAMPLES.md +0 -476
  7. package/assets/wallets/extension.svg +0 -7
  8. package/assets/wallets/hashpack.svg +0 -6
  9. package/assets/wallets/hsuite.svg +0 -11
  10. package/assets/wallets/kabila.svg +0 -11
  11. package/assets/wallets/walletconnect.svg +0 -13
  12. package/coverage/base.css +0 -224
  13. package/coverage/block-navigation.js +0 -87
  14. package/coverage/coverage-summary.json +0 -50
  15. package/coverage/favicon.png +0 -0
  16. package/coverage/index.html +0 -476
  17. package/coverage/lcov-report/base.css +0 -224
  18. package/coverage/lcov-report/block-navigation.js +0 -87
  19. package/coverage/lcov-report/favicon.png +0 -0
  20. package/coverage/lcov-report/index.html +0 -476
  21. package/coverage/lcov-report/lib/components/account-selector/account-actions/account-actions.component.ts.html +0 -868
  22. package/coverage/lcov-report/lib/components/account-selector/account-actions/index.html +0 -116
  23. package/coverage/lcov-report/lib/components/account-selector/account-filter/account-filter.component.ts.html +0 -1288
  24. package/coverage/lcov-report/lib/components/account-selector/account-filter/index.html +0 -116
  25. package/coverage/lcov-report/lib/components/account-selector/account-formatting.service.ts.html +0 -685
  26. package/coverage/lcov-report/lib/components/account-selector/account-grouping.service.ts.html +0 -766
  27. package/coverage/lcov-report/lib/components/account-selector/account-list/account-list.component.ts.html +0 -1495
  28. package/coverage/lcov-report/lib/components/account-selector/account-list/index.html +0 -116
  29. package/coverage/lcov-report/lib/components/account-selector/account-selector.component.ts.html +0 -1495
  30. package/coverage/lcov-report/lib/components/account-selector/account-selector.service.ts.html +0 -1588
  31. package/coverage/lcov-report/lib/components/account-selector/index.html +0 -161
  32. package/coverage/lcov-report/lib/components/wallet-account-display/index.html +0 -116
  33. package/coverage/lcov-report/lib/components/wallet-account-display/wallet-account-display.component.ts.html +0 -505
  34. package/coverage/lcov-report/lib/components/wallet-connect-button/index.html +0 -116
  35. package/coverage/lcov-report/lib/components/wallet-connect-button/wallet-connect-button.component.ts.html +0 -829
  36. package/coverage/lcov-report/lib/components/wallet-connect-prompt/index.html +0 -116
  37. package/coverage/lcov-report/lib/components/wallet-connect-prompt/wallet-connect-prompt.component.ts.html +0 -409
  38. package/coverage/lcov-report/lib/components/wallet-connected-guard/index.html +0 -116
  39. package/coverage/lcov-report/lib/components/wallet-connected-guard/wallet-connected-guard.component.ts.html +0 -304
  40. package/coverage/lcov-report/lib/components/wallet-connection-modal/connection-method-step/connection-method-step.component.ts.html +0 -436
  41. package/coverage/lcov-report/lib/components/wallet-connection-modal/connection-method-step/index.html +0 -116
  42. package/coverage/lcov-report/lib/components/wallet-connection-modal/index.html +0 -116
  43. package/coverage/lcov-report/lib/components/wallet-connection-modal/qr-pairing-step/index.html +0 -116
  44. package/coverage/lcov-report/lib/components/wallet-connection-modal/qr-pairing-step/qr-pairing-step.component.ts.html +0 -2287
  45. package/coverage/lcov-report/lib/components/wallet-connection-modal/wallet-connection-modal.component.ts.html +0 -2470
  46. package/coverage/lcov-report/lib/components/wallet-session-display/index.html +0 -116
  47. package/coverage/lcov-report/lib/components/wallet-session-display/wallet-session-display.component.ts.html +0 -676
  48. package/coverage/lcov-report/lib/components/wallet-transaction-status/index.html +0 -116
  49. package/coverage/lcov-report/lib/components/wallet-transaction-status/wallet-transaction-status.component.ts.html +0 -703
  50. package/coverage/lcov-report/lib/directives/index.html +0 -146
  51. package/coverage/lcov-report/lib/directives/wallet-connected.directive.ts.html +0 -670
  52. package/coverage/lcov-report/lib/directives/wallet-context.directive.ts.html +0 -547
  53. package/coverage/lcov-report/lib/directives/wallet-events.directive.ts.html +0 -781
  54. package/coverage/lcov-report/lib/hsuite-wallet.module.ts.html +0 -715
  55. package/coverage/lcov-report/lib/index.html +0 -116
  56. package/coverage/lcov-report/lib/models/connection-config.model.ts.html +0 -280
  57. package/coverage/lcov-report/lib/models/index.html +0 -131
  58. package/coverage/lcov-report/lib/models/provider-types.ts.html +0 -577
  59. package/coverage/lcov-report/lib/providers/base-wallet-provider.ts.html +0 -1138
  60. package/coverage/lcov-report/lib/providers/hsuite-native/channel-client.service.ts.html +0 -2671
  61. package/coverage/lcov-report/lib/providers/hsuite-native/index.html +0 -116
  62. package/coverage/lcov-report/lib/providers/hsuite-native-provider.ts.html +0 -2347
  63. package/coverage/lcov-report/lib/providers/index.html +0 -146
  64. package/coverage/lcov-report/lib/providers/p2p-native/index.html +0 -131
  65. package/coverage/lcov-report/lib/providers/p2p-native/p2p-native.provider.ts.html +0 -2254
  66. package/coverage/lcov-report/lib/providers/p2p-native/p2p-session-manager.ts.html +0 -2170
  67. package/coverage/lcov-report/lib/providers/wallet-error-handler.ts.html +0 -1132
  68. package/coverage/lcov-report/lib/providers/walletconnect/core/index.html +0 -176
  69. package/coverage/lcov-report/lib/providers/walletconnect/core/session-health.ts.html +0 -673
  70. package/coverage/lcov-report/lib/providers/walletconnect/core/walletconnect-client-manager.ts.html +0 -1177
  71. package/coverage/lcov-report/lib/providers/walletconnect/core/walletconnect-provider.ts.html +0 -2563
  72. package/coverage/lcov-report/lib/providers/walletconnect/core/walletconnect-session-store.ts.html +0 -904
  73. package/coverage/lcov-report/lib/providers/walletconnect/core/walletconnect-signing-orchestrator.ts.html +0 -982
  74. package/coverage/lcov-report/lib/providers/walletconnect/signers/hedera-signer.ts.html +0 -1915
  75. package/coverage/lcov-report/lib/providers/walletconnect/signers/index.html +0 -146
  76. package/coverage/lcov-report/lib/providers/walletconnect/signers/signer-factory.ts.html +0 -445
  77. package/coverage/lcov-report/lib/providers/walletconnect/signers/xrpl-signer.ts.html +0 -1519
  78. package/coverage/lcov-report/lib/services/index.html +0 -191
  79. package/coverage/lcov-report/lib/services/logger.service.ts.html +0 -463
  80. package/coverage/lcov-report/lib/services/transaction-builders/base-transaction-builder.service.ts.html +0 -1840
  81. package/coverage/lcov-report/lib/services/transaction-builders/hedera-amount-utils.ts.html +0 -337
  82. package/coverage/lcov-report/lib/services/transaction-builders/hedera-transaction-builder.service.ts.html +0 -3940
  83. package/coverage/lcov-report/lib/services/transaction-builders/index.html +0 -161
  84. package/coverage/lcov-report/lib/services/transaction-builders/xrpl-transaction-builder.service.ts.html +0 -2581
  85. package/coverage/lcov-report/lib/services/transaction.service.ts.html +0 -1120
  86. package/coverage/lcov-report/lib/services/unified-wallet.service.ts.html +0 -2638
  87. package/coverage/lcov-report/lib/services/wallet-context.service.ts.html +0 -637
  88. package/coverage/lcov-report/lib/services/wallet-event-bus.service.ts.html +0 -643
  89. package/coverage/lcov-report/lib/services/wallet-providers.service.ts.html +0 -493
  90. package/coverage/lcov-report/lib/transports/chrome-extension-transport.ts.html +0 -823
  91. package/coverage/lcov-report/lib/transports/index.html +0 -116
  92. package/coverage/lcov-report/lib/utils/index.html +0 -116
  93. package/coverage/lcov-report/lib/utils/ledger-icons.util.ts.html +0 -319
  94. package/coverage/lcov-report/prettify.css +0 -1
  95. package/coverage/lcov-report/prettify.js +0 -2
  96. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  97. package/coverage/lcov-report/sorter.js +0 -210
  98. package/coverage/lcov.info +0 -18695
  99. package/coverage/lib/components/account-selector/account-actions/account-actions.component.ts.html +0 -868
  100. package/coverage/lib/components/account-selector/account-actions/index.html +0 -116
  101. package/coverage/lib/components/account-selector/account-filter/account-filter.component.ts.html +0 -1288
  102. package/coverage/lib/components/account-selector/account-filter/index.html +0 -116
  103. package/coverage/lib/components/account-selector/account-formatting.service.ts.html +0 -685
  104. package/coverage/lib/components/account-selector/account-grouping.service.ts.html +0 -766
  105. package/coverage/lib/components/account-selector/account-list/account-list.component.ts.html +0 -1495
  106. package/coverage/lib/components/account-selector/account-list/index.html +0 -116
  107. package/coverage/lib/components/account-selector/account-selector.component.ts.html +0 -1495
  108. package/coverage/lib/components/account-selector/account-selector.service.ts.html +0 -1588
  109. package/coverage/lib/components/account-selector/index.html +0 -161
  110. package/coverage/lib/components/wallet-account-display/index.html +0 -116
  111. package/coverage/lib/components/wallet-account-display/wallet-account-display.component.ts.html +0 -505
  112. package/coverage/lib/components/wallet-connect-button/index.html +0 -116
  113. package/coverage/lib/components/wallet-connect-button/wallet-connect-button.component.ts.html +0 -829
  114. package/coverage/lib/components/wallet-connect-prompt/index.html +0 -116
  115. package/coverage/lib/components/wallet-connect-prompt/wallet-connect-prompt.component.ts.html +0 -409
  116. package/coverage/lib/components/wallet-connected-guard/index.html +0 -116
  117. package/coverage/lib/components/wallet-connected-guard/wallet-connected-guard.component.ts.html +0 -304
  118. package/coverage/lib/components/wallet-connection-modal/connection-method-step/connection-method-step.component.ts.html +0 -436
  119. package/coverage/lib/components/wallet-connection-modal/connection-method-step/index.html +0 -116
  120. package/coverage/lib/components/wallet-connection-modal/index.html +0 -116
  121. package/coverage/lib/components/wallet-connection-modal/qr-pairing-step/index.html +0 -116
  122. package/coverage/lib/components/wallet-connection-modal/qr-pairing-step/qr-pairing-step.component.ts.html +0 -2287
  123. package/coverage/lib/components/wallet-connection-modal/wallet-connection-modal.component.ts.html +0 -2470
  124. package/coverage/lib/components/wallet-session-display/index.html +0 -116
  125. package/coverage/lib/components/wallet-session-display/wallet-session-display.component.ts.html +0 -676
  126. package/coverage/lib/components/wallet-transaction-status/index.html +0 -116
  127. package/coverage/lib/components/wallet-transaction-status/wallet-transaction-status.component.ts.html +0 -703
  128. package/coverage/lib/directives/index.html +0 -146
  129. package/coverage/lib/directives/wallet-connected.directive.ts.html +0 -670
  130. package/coverage/lib/directives/wallet-context.directive.ts.html +0 -547
  131. package/coverage/lib/directives/wallet-events.directive.ts.html +0 -781
  132. package/coverage/lib/hsuite-wallet.module.ts.html +0 -715
  133. package/coverage/lib/index.html +0 -116
  134. package/coverage/lib/models/connection-config.model.ts.html +0 -280
  135. package/coverage/lib/models/index.html +0 -131
  136. package/coverage/lib/models/provider-types.ts.html +0 -577
  137. package/coverage/lib/providers/base-wallet-provider.ts.html +0 -1138
  138. package/coverage/lib/providers/hsuite-native/channel-client.service.ts.html +0 -2671
  139. package/coverage/lib/providers/hsuite-native/index.html +0 -116
  140. package/coverage/lib/providers/hsuite-native-provider.ts.html +0 -2347
  141. package/coverage/lib/providers/index.html +0 -146
  142. package/coverage/lib/providers/p2p-native/index.html +0 -131
  143. package/coverage/lib/providers/p2p-native/p2p-native.provider.ts.html +0 -2254
  144. package/coverage/lib/providers/p2p-native/p2p-session-manager.ts.html +0 -2170
  145. package/coverage/lib/providers/wallet-error-handler.ts.html +0 -1132
  146. package/coverage/lib/providers/walletconnect/core/index.html +0 -176
  147. package/coverage/lib/providers/walletconnect/core/session-health.ts.html +0 -673
  148. package/coverage/lib/providers/walletconnect/core/walletconnect-client-manager.ts.html +0 -1177
  149. package/coverage/lib/providers/walletconnect/core/walletconnect-provider.ts.html +0 -2563
  150. package/coverage/lib/providers/walletconnect/core/walletconnect-session-store.ts.html +0 -904
  151. package/coverage/lib/providers/walletconnect/core/walletconnect-signing-orchestrator.ts.html +0 -982
  152. package/coverage/lib/providers/walletconnect/signers/hedera-signer.ts.html +0 -1915
  153. package/coverage/lib/providers/walletconnect/signers/index.html +0 -146
  154. package/coverage/lib/providers/walletconnect/signers/signer-factory.ts.html +0 -445
  155. package/coverage/lib/providers/walletconnect/signers/xrpl-signer.ts.html +0 -1519
  156. package/coverage/lib/services/index.html +0 -191
  157. package/coverage/lib/services/logger.service.ts.html +0 -463
  158. package/coverage/lib/services/transaction-builders/base-transaction-builder.service.ts.html +0 -1840
  159. package/coverage/lib/services/transaction-builders/hedera-amount-utils.ts.html +0 -337
  160. package/coverage/lib/services/transaction-builders/hedera-transaction-builder.service.ts.html +0 -3940
  161. package/coverage/lib/services/transaction-builders/index.html +0 -161
  162. package/coverage/lib/services/transaction-builders/xrpl-transaction-builder.service.ts.html +0 -2581
  163. package/coverage/lib/services/transaction.service.ts.html +0 -1120
  164. package/coverage/lib/services/unified-wallet.service.ts.html +0 -2638
  165. package/coverage/lib/services/wallet-context.service.ts.html +0 -637
  166. package/coverage/lib/services/wallet-event-bus.service.ts.html +0 -643
  167. package/coverage/lib/services/wallet-providers.service.ts.html +0 -493
  168. package/coverage/lib/transports/chrome-extension-transport.ts.html +0 -823
  169. package/coverage/lib/transports/index.html +0 -116
  170. package/coverage/lib/utils/index.html +0 -116
  171. package/coverage/lib/utils/ledger-icons.util.ts.html +0 -319
  172. package/coverage/prettify.css +0 -1
  173. package/coverage/prettify.js +0 -2
  174. package/coverage/sort-arrow-sprite.png +0 -0
  175. package/coverage/sorter.js +0 -210
  176. package/examples/minimal-connect.ts +0 -178
  177. package/examples/multi-protocol.ts +0 -495
  178. package/examples/transaction-signing.ts +0 -361
  179. package/jest.config.json +0 -45
  180. package/karma.conf.js +0 -42
  181. package/ng-package.json +0 -20
  182. package/src/index.ts +0 -203
  183. package/src/lib/components/account-selector/account-actions/account-actions.component.ts +0 -261
  184. package/src/lib/components/account-selector/account-filter/account-filter.component.ts +0 -401
  185. package/src/lib/components/account-selector/account-formatting.service.ts +0 -200
  186. package/src/lib/components/account-selector/account-grouping.service.ts +0 -227
  187. package/src/lib/components/account-selector/account-list/account-list.component.ts +0 -470
  188. package/src/lib/components/account-selector/account-selector.component.html +0 -135
  189. package/src/lib/components/account-selector/account-selector.component.scss +0 -2039
  190. package/src/lib/components/account-selector/account-selector.component.ts +0 -470
  191. package/src/lib/components/account-selector/account-selector.service.ts +0 -501
  192. package/src/lib/components/wallet-account-display/wallet-account-display.component.html +0 -34
  193. package/src/lib/components/wallet-account-display/wallet-account-display.component.scss +0 -99
  194. package/src/lib/components/wallet-account-display/wallet-account-display.component.ts +0 -140
  195. package/src/lib/components/wallet-connect-button/wallet-connect-button.component.html +0 -14
  196. package/src/lib/components/wallet-connect-button/wallet-connect-button.component.scss +0 -272
  197. package/src/lib/components/wallet-connect-button/wallet-connect-button.component.spec.ts +0 -89
  198. package/src/lib/components/wallet-connect-button/wallet-connect-button.component.ts +0 -248
  199. package/src/lib/components/wallet-connect-prompt/wallet-connect-prompt.component.html +0 -24
  200. package/src/lib/components/wallet-connect-prompt/wallet-connect-prompt.component.scss +0 -50
  201. package/src/lib/components/wallet-connect-prompt/wallet-connect-prompt.component.ts +0 -108
  202. package/src/lib/components/wallet-connected-guard/wallet-connected-guard.component.html +0 -24
  203. package/src/lib/components/wallet-connected-guard/wallet-connected-guard.component.ts +0 -73
  204. package/src/lib/components/wallet-connection-modal/connection-method-step/connection-method-step.component.html +0 -56
  205. package/src/lib/components/wallet-connection-modal/connection-method-step/connection-method-step.component.scss +0 -218
  206. package/src/lib/components/wallet-connection-modal/connection-method-step/connection-method-step.component.ts +0 -117
  207. package/src/lib/components/wallet-connection-modal/qr-pairing-step/qr-pairing-step.component.html +0 -94
  208. package/src/lib/components/wallet-connection-modal/qr-pairing-step/qr-pairing-step.component.scss +0 -272
  209. package/src/lib/components/wallet-connection-modal/qr-pairing-step/qr-pairing-step.component.ts +0 -734
  210. package/src/lib/components/wallet-connection-modal/wallet-connection-modal.component.html +0 -192
  211. package/src/lib/components/wallet-connection-modal/wallet-connection-modal.component.scss +0 -678
  212. package/src/lib/components/wallet-connection-modal/wallet-connection-modal.component.spec.ts +0 -173
  213. package/src/lib/components/wallet-connection-modal/wallet-connection-modal.component.ts +0 -795
  214. package/src/lib/components/wallet-session-display/wallet-session-display.component.html +0 -110
  215. package/src/lib/components/wallet-session-display/wallet-session-display.component.scss +0 -179
  216. package/src/lib/components/wallet-session-display/wallet-session-display.component.ts +0 -197
  217. package/src/lib/components/wallet-transaction-status/wallet-transaction-status.component.html +0 -65
  218. package/src/lib/components/wallet-transaction-status/wallet-transaction-status.component.scss +0 -254
  219. package/src/lib/components/wallet-transaction-status/wallet-transaction-status.component.ts +0 -206
  220. package/src/lib/directives/wallet-connected.directive.ts +0 -195
  221. package/src/lib/directives/wallet-context.directive.ts +0 -154
  222. package/src/lib/directives/wallet-events.directive.ts +0 -232
  223. package/src/lib/hsuite-wallet.module.ts +0 -210
  224. package/src/lib/models/connection-config.model.ts +0 -65
  225. package/src/lib/models/provider-types.ts +0 -164
  226. package/src/lib/models/unified-account.model.ts +0 -76
  227. package/src/lib/models/wallet-context.model.ts +0 -121
  228. package/src/lib/models/wallet-events.model.ts +0 -158
  229. package/src/lib/providers/base-wallet-provider.ts +0 -351
  230. package/src/lib/providers/hsuite-native/channel-client.service.spec.ts +0 -73
  231. package/src/lib/providers/hsuite-native/channel-client.service.ts +0 -862
  232. package/src/lib/providers/hsuite-native/index.ts +0 -8
  233. package/src/lib/providers/hsuite-native-provider.ts +0 -754
  234. package/src/lib/providers/mobile-native/mobile-native.provider.spec.ts +0 -19
  235. package/src/lib/providers/p2p-native/index.ts +0 -30
  236. package/src/lib/providers/p2p-native/p2p-native.provider.spec.ts +0 -523
  237. package/src/lib/providers/p2p-native/p2p-native.provider.ts +0 -723
  238. package/src/lib/providers/p2p-native/p2p-session-manager.ts +0 -695
  239. package/src/lib/providers/wallet-error-handler.ts +0 -349
  240. package/src/lib/providers/walletconnect/core/base-signer.interface.ts +0 -122
  241. package/src/lib/providers/walletconnect/core/session-health.ts +0 -196
  242. package/src/lib/providers/walletconnect/core/walletconnect-client-manager.ts +0 -364
  243. package/src/lib/providers/walletconnect/core/walletconnect-provider.integration.spec.ts +0 -348
  244. package/src/lib/providers/walletconnect/core/walletconnect-provider.ts +0 -826
  245. package/src/lib/providers/walletconnect/core/walletconnect-session-store.ts +0 -273
  246. package/src/lib/providers/walletconnect/core/walletconnect-signing-orchestrator.ts +0 -299
  247. package/src/lib/providers/walletconnect/core/walletconnect-types.ts +0 -48
  248. package/src/lib/providers/walletconnect/index.ts +0 -33
  249. package/src/lib/providers/walletconnect/signers/hedera-signer.spec.ts +0 -367
  250. package/src/lib/providers/walletconnect/signers/hedera-signer.ts +0 -610
  251. package/src/lib/providers/walletconnect/signers/signer-factory.spec.ts +0 -62
  252. package/src/lib/providers/walletconnect/signers/signer-factory.ts +0 -120
  253. package/src/lib/providers/walletconnect/signers/xrpl-signer.spec.ts +0 -296
  254. package/src/lib/providers/walletconnect/signers/xrpl-signer.ts +0 -478
  255. package/src/lib/services/logger.service.ts +0 -126
  256. package/src/lib/services/transaction-builders/base-transaction-builder.service.ts +0 -585
  257. package/src/lib/services/transaction-builders/hedera-amount-utils.ts +0 -84
  258. package/src/lib/services/transaction-builders/hedera-transaction-builder.service.spec.ts +0 -741
  259. package/src/lib/services/transaction-builders/hedera-transaction-builder.service.ts +0 -1285
  260. package/src/lib/services/transaction-builders/index.ts +0 -54
  261. package/src/lib/services/transaction-builders/xrpl-transaction-builder.service.spec.ts +0 -937
  262. package/src/lib/services/transaction-builders/xrpl-transaction-builder.service.ts +0 -832
  263. package/src/lib/services/transaction.service.ts +0 -345
  264. package/src/lib/services/unified-wallet.service.spec.ts +0 -1382
  265. package/src/lib/services/unified-wallet.service.ts +0 -851
  266. package/src/lib/services/wallet-context.service.ts +0 -184
  267. package/src/lib/services/wallet-event-bus.service.ts +0 -186
  268. package/src/lib/services/wallet-providers.service.ts +0 -136
  269. package/src/lib/transports/chrome-extension-transport.ts +0 -246
  270. package/src/lib/utils/index.ts +0 -14
  271. package/src/lib/utils/ledger-icons.util.ts +0 -78
  272. package/test/test-setup.ts +0 -21
  273. package/test-setup.ts +0 -63
  274. package/tsconfig.build.json +0 -11
  275. package/tsconfig.json +0 -29
  276. package/tsconfig.spec.json +0 -15
  277. package/vitest.config.ts +0 -48
@@ -1,832 +0,0 @@
1
- /**
2
- * HSuite Native Connect
3
- * Copyright 2024-2025 HSuite (https://hsuite.finance)
4
- *
5
- * SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
6
- *
7
- * This file is part of HSuite Native Connect. For commercial licensing,
8
- * visit https://hsuite.finance/licensing
9
- */
10
-
11
- /**
12
- * @file Service for building XRPL (Ripple) transactions using the xrpl package.
13
- *
14
- * @module services/transaction-builders/xrpl
15
- *
16
- * @description
17
- * XrplTransactionBuilderService provides methods to construct various XRPL transaction
18
- * types and serialize them to base64 payloads ready for signing. It supports all major
19
- * XRPL transaction types including payments, trust lines, DEX orders, escrows, payment
20
- * channels, checks, and NFTs.
21
- *
22
- * **Supported Transaction Types:**
23
- * - Payment - XRP and token transfers
24
- * - TrustSet - Trust line creation/modification
25
- * - OfferCreate/Cancel - DEX order management
26
- * - AccountSet - Account configuration
27
- * - EscrowCreate/Finish/Cancel - Escrow operations
28
- * - PaymentChannel operations - Payment channels
29
- * - Check operations - XRPL checks
30
- * - DepositPreauth - Deposit preauthorization
31
- * - SignerListSet - Multi-signature configuration
32
- * - TicketCreate - Ticket creation
33
- * - NFT operations - NFTokenMint, Burn, CreateOffer, etc.
34
- * - Batch transactions - Multiple operations atomically
35
- *
36
- * **Amount Format:**
37
- * - XRP amounts are in "drops" (1 XRP = 1,000,000 drops)
38
- * - Token amounts use the IssuedCurrency format { currency, issuer, value }
39
- */
40
-
41
- import { Injectable } from '@angular/core';
42
- import type {
43
- Payment,
44
- TrustSet,
45
- OfferCreate,
46
- OfferCancel,
47
- AccountSet,
48
- EscrowCreate,
49
- EscrowFinish,
50
- EscrowCancel,
51
- PaymentChannelCreate,
52
- PaymentChannelFund,
53
- PaymentChannelClaim,
54
- CheckCreate,
55
- CheckCash,
56
- CheckCancel,
57
- DepositPreauth,
58
- SignerListSet,
59
- TicketCreate,
60
- NFTokenMint,
61
- NFTokenBurn,
62
- NFTokenCreateOffer,
63
- NFTokenAcceptOffer,
64
- NFTokenCancelOffer,
65
- Transaction,
66
- } from 'xrpl';
67
-
68
- /**
69
- * Service for building XRPL (Ripple) transactions using the xrpl package.
70
- *
71
- * @service XrplTransactionBuilderService
72
- *
73
- * @description
74
- * Provides methods to construct various XRPL transaction types and serialize them
75
- * to base64 payloads ready for signing. All build methods return a base64-encoded
76
- * JSON representation of the transaction.
77
- *
78
- * Unlike Hedera transactions which are frozen with a client, XRPL transactions
79
- * are serialized as JSON and can be signed without network connection.
80
- *
81
- * @providedIn root
82
- *
83
- * @Component({ ... })
84
- * export class SendPage {
85
- * private builder = inject(XrplTransactionBuilderService);
86
- * private wallet = inject(UnifiedWalletService);
87
- *
88
- * async sendXrp(to: string, drops: string) {
89
- * const from = this.wallet.activeAccount()?.address;
90
- * const payload = await this.builder.buildPayment(from!, to, drops);
91
- * return this.wallet.submitTransaction({ payload });
92
- * }
93
- * }
94
- * ```
95
- */
96
- @Injectable({
97
- providedIn: 'root',
98
- })
99
- export class XrplTransactionBuilderService {
100
- /**
101
- * Builds a Payment transaction (XRP or token).
102
- *
103
- * @description
104
- * Creates a Payment transaction that sends XRP or issued currency tokens
105
- * from one account to another. For XRP, the amount is in drops (1 XRP = 1,000,000 drops).
106
- *
107
- * @param account - Source account address (r...)
108
- * @param destination - Destination account address (r...)
109
- * @param amount - Amount (XRP in drops, or token value string)
110
- * @param isToken - Whether this is a token payment (default: false)
111
- * @param currency - Token currency code (required if isToken)
112
- * @param issuer - Token issuer address (required if isToken)
113
- *
114
- * @returns Base64 encoded transaction JSON
115
- */
116
- async buildPayment(
117
- account: string,
118
- destination: string,
119
- amount: string,
120
- isToken = false,
121
- currency?: string,
122
- issuer?: string,
123
- ): Promise<string> {
124
- const tx: Payment = {
125
- TransactionType: 'Payment',
126
- Account: account,
127
- Destination: destination,
128
- Amount:
129
- isToken && currency && issuer
130
- ? {
131
- currency,
132
- issuer,
133
- value: amount,
134
- }
135
- : amount,
136
- };
137
-
138
- return this.serializeTransaction(tx);
139
- }
140
-
141
- /**
142
- * Builds a TrustSet transaction to establish or modify a trust line.
143
- *
144
- * @description
145
- * Creates a TrustSet transaction that establishes a trust line between
146
- * your account and a token issuer. Trust lines are required before you
147
- * can hold issued currency tokens on XRPL.
148
- *
149
- * @param account - Your account address (r...)
150
- * @param currency - Currency code (e.g., 'USD', 'EUR', or hex code)
151
- * @param issuer - Token issuer address (r...)
152
- * @param limit - Maximum amount willing to hold (e.g., '1000000')
153
- *
154
- * @returns Base64 encoded transaction JSON
155
- */
156
- async buildTrustSet(
157
- account: string,
158
- currency: string,
159
- issuer: string,
160
- limit: string,
161
- ): Promise<string> {
162
- const tx: TrustSet = {
163
- TransactionType: 'TrustSet',
164
- Account: account,
165
- LimitAmount: {
166
- currency,
167
- issuer,
168
- value: limit,
169
- },
170
- };
171
-
172
- return this.serializeTransaction(tx);
173
- }
174
-
175
- /**
176
- * Build an OfferCreate transaction (DEX order)
177
- * @param account - Account address
178
- * @param takerPays - What taker pays (amount object or XRP drops)
179
- * @param takerGets - What taker gets (amount object or XRP drops)
180
- * @returns Base64 encoded transaction
181
- */
182
- async buildOfferCreate(
183
- account: string,
184
- takerPays: string | { currency: string; issuer: string; value: string },
185
- takerGets: string | { currency: string; issuer: string; value: string },
186
- ): Promise<string> {
187
- const tx: OfferCreate = {
188
- TransactionType: 'OfferCreate',
189
- Account: account,
190
- TakerPays: takerPays,
191
- TakerGets: takerGets,
192
- };
193
-
194
- return this.serializeTransaction(tx);
195
- }
196
-
197
- /**
198
- * Build an OfferCancel transaction
199
- * @param account - Account address
200
- * @param offerSequence - Sequence number of the offer to cancel
201
- * @returns Base64 encoded transaction
202
- */
203
- async buildOfferCancel(account: string, offerSequence: number): Promise<string> {
204
- const tx: OfferCancel = {
205
- TransactionType: 'OfferCancel',
206
- Account: account,
207
- OfferSequence: offerSequence,
208
- };
209
-
210
- return this.serializeTransaction(tx);
211
- }
212
-
213
- /**
214
- * Build an AccountSet transaction
215
- * @param account - Account address
216
- * @param options - Account set options (domain, emailHash, flags, etc.)
217
- * @param options.domain
218
- * @param options.emailHash
219
- * @param options.messageKey
220
- * @param options.transferRate
221
- * @param options.tickSize
222
- * @param options.setFlag
223
- * @param options.clearFlag
224
- * @returns Base64 encoded transaction
225
- */
226
- async buildAccountSet(
227
- account: string,
228
- options: {
229
- domain?: string;
230
- emailHash?: string;
231
- messageKey?: string;
232
- transferRate?: number;
233
- tickSize?: number;
234
- setFlag?: number;
235
- clearFlag?: number;
236
- },
237
- ): Promise<string> {
238
- const tx: AccountSet = {
239
- TransactionType: 'AccountSet',
240
- Account: account,
241
- ...options,
242
- };
243
-
244
- return this.serializeTransaction(tx);
245
- }
246
-
247
- /**
248
- * Build an EscrowCreate transaction
249
- * @param account - Account address
250
- * @param destination - Destination account
251
- * @param amount - Amount in drops
252
- * @param finishAfter - Ripple Epoch (seconds since 2000-01-01 UTC). Callers
253
- * that hold Unix timestamps must convert first; an unmodified Unix value
254
- * would put the escrow ~30 years in the future. The XRPL Time Utilities
255
- * in `xrpl.js` expose helpers, or compute as `unixSeconds - 946684800`.
256
- * @param cancelAfter - Optional. Same Ripple Epoch contract as finishAfter.
257
- * @returns Base64 encoded transaction
258
- */
259
- async buildEscrowCreate(
260
- account: string,
261
- destination: string,
262
- amount: string,
263
- finishAfter: number,
264
- cancelAfter?: number,
265
- ): Promise<string> {
266
- const tx: EscrowCreate = {
267
- TransactionType: 'EscrowCreate',
268
- Account: account,
269
- Destination: destination,
270
- Amount: amount,
271
- FinishAfter: finishAfter,
272
- ...(cancelAfter && { CancelAfter: cancelAfter }),
273
- };
274
-
275
- return this.serializeTransaction(tx);
276
- }
277
-
278
- /**
279
- * Build an EscrowFinish transaction
280
- * @param account - Account address
281
- * @param owner - Escrow owner account
282
- * @param offerSequence - Sequence number of EscrowCreate transaction
283
- * @returns Base64 encoded transaction
284
- */
285
- async buildEscrowFinish(account: string, owner: string, offerSequence: number): Promise<string> {
286
- const tx: EscrowFinish = {
287
- TransactionType: 'EscrowFinish',
288
- Account: account,
289
- Owner: owner,
290
- OfferSequence: offerSequence,
291
- };
292
-
293
- return this.serializeTransaction(tx);
294
- }
295
-
296
- /**
297
- * Build an EscrowCancel transaction
298
- * @param account - Account address
299
- * @param owner - Escrow owner account
300
- * @param offerSequence - Sequence number of EscrowCreate transaction
301
- * @returns Base64 encoded transaction
302
- */
303
- async buildEscrowCancel(account: string, owner: string, offerSequence: number): Promise<string> {
304
- const tx: EscrowCancel = {
305
- TransactionType: 'EscrowCancel',
306
- Account: account,
307
- Owner: owner,
308
- OfferSequence: offerSequence,
309
- };
310
-
311
- return this.serializeTransaction(tx);
312
- }
313
-
314
- /**
315
- * Build a PaymentChannelCreate transaction
316
- * @param account - Account address
317
- * @param destination - Destination account
318
- * @param amount - Amount in drops
319
- * @param settleDelay - Settle delay in seconds
320
- * @param publicKey - Public key for channel
321
- * @returns Base64 encoded transaction
322
- */
323
- async buildPaymentChannelCreate(
324
- account: string,
325
- destination: string,
326
- amount: string,
327
- settleDelay: number,
328
- publicKey: string,
329
- ): Promise<string> {
330
- const tx: PaymentChannelCreate = {
331
- TransactionType: 'PaymentChannelCreate',
332
- Account: account,
333
- Destination: destination,
334
- Amount: amount,
335
- SettleDelay: settleDelay,
336
- PublicKey: publicKey,
337
- };
338
-
339
- return this.serializeTransaction(tx);
340
- }
341
-
342
- /**
343
- * Build a PaymentChannelFund transaction
344
- * @param account - Account address
345
- * @param channel - Channel ID
346
- * @param amount - Amount in drops to add
347
- * @returns Base64 encoded transaction
348
- */
349
- async buildPaymentChannelFund(account: string, channel: string, amount: string): Promise<string> {
350
- const tx: PaymentChannelFund = {
351
- TransactionType: 'PaymentChannelFund',
352
- Account: account,
353
- Channel: channel,
354
- Amount: amount,
355
- };
356
-
357
- return this.serializeTransaction(tx);
358
- }
359
-
360
- /**
361
- * Build a PaymentChannelClaim transaction
362
- * @param account - Account address
363
- * @param channel - Channel ID
364
- * @param amount - Amount in drops to claim
365
- * @returns Base64 encoded transaction
366
- */
367
- async buildPaymentChannelClaim(
368
- account: string,
369
- channel: string,
370
- amount?: string,
371
- ): Promise<string> {
372
- const tx: PaymentChannelClaim = {
373
- TransactionType: 'PaymentChannelClaim',
374
- Account: account,
375
- Channel: channel,
376
- ...(amount && { Amount: amount }),
377
- };
378
-
379
- return this.serializeTransaction(tx);
380
- }
381
-
382
- /**
383
- * Build a CheckCreate transaction
384
- * @param account - Account address
385
- * @param destination - Destination account
386
- * @param sendMax - Maximum amount that can be cashed
387
- * @returns Base64 encoded transaction
388
- */
389
- async buildCheckCreate(account: string, destination: string, sendMax: string): Promise<string> {
390
- const tx: CheckCreate = {
391
- TransactionType: 'CheckCreate',
392
- Account: account,
393
- Destination: destination,
394
- SendMax: sendMax,
395
- };
396
-
397
- return this.serializeTransaction(tx);
398
- }
399
-
400
- /**
401
- * Build a CheckCash transaction
402
- * @param account - Account address
403
- * @param checkID - Check ID to cash
404
- * @param amount - Amount to cash (optional, uses DeliverMin if not provided)
405
- * @param deliverMin - Minimum amount to deliver (optional)
406
- * @returns Base64 encoded transaction
407
- */
408
- async buildCheckCash(
409
- account: string,
410
- checkID: string,
411
- amount?: string,
412
- deliverMin?: string,
413
- ): Promise<string> {
414
- const tx: CheckCash = {
415
- TransactionType: 'CheckCash',
416
- Account: account,
417
- CheckID: checkID,
418
- ...(amount && { Amount: amount }),
419
- ...(deliverMin && { DeliverMin: deliverMin }),
420
- };
421
-
422
- return this.serializeTransaction(tx);
423
- }
424
-
425
- /**
426
- * Build a CheckCancel transaction
427
- * @param account - Account address
428
- * @param checkID - Check ID to cancel
429
- * @returns Base64 encoded transaction
430
- */
431
- async buildCheckCancel(account: string, checkID: string): Promise<string> {
432
- const tx: CheckCancel = {
433
- TransactionType: 'CheckCancel',
434
- Account: account,
435
- CheckID: checkID,
436
- };
437
-
438
- return this.serializeTransaction(tx);
439
- }
440
-
441
- /**
442
- * Build a DepositPreauth transaction
443
- * @param account - Account address
444
- * @param authorize - Account to preauthorize (optional)
445
- * @param unauthorize - Account to remove authorization (optional)
446
- * @returns Base64 encoded transaction
447
- */
448
- async buildDepositPreauth(
449
- account: string,
450
- authorize?: string,
451
- unauthorize?: string,
452
- ): Promise<string> {
453
- const tx: DepositPreauth = {
454
- TransactionType: 'DepositPreauth',
455
- Account: account,
456
- ...(authorize && { Authorize: authorize }),
457
- ...(unauthorize && { Unauthorize: unauthorize }),
458
- };
459
-
460
- return this.serializeTransaction(tx);
461
- }
462
-
463
- /**
464
- * Build a SignerListSet transaction
465
- * @param account - Account address
466
- * @param signerQuorum - Required signature weight
467
- * @param signerEntries - Array of signer entries
468
- * @returns Base64 encoded transaction
469
- */
470
- async buildSignerListSet(
471
- account: string,
472
- signerQuorum: number,
473
- signerEntries: Array<{ account: string; weight: number }>,
474
- ): Promise<string> {
475
- const tx: SignerListSet = {
476
- TransactionType: 'SignerListSet',
477
- Account: account,
478
- SignerQuorum: signerQuorum,
479
- SignerEntries: signerEntries.map((entry) => ({
480
- SignerEntry: {
481
- Account: entry.account,
482
- SignerWeight: entry.weight,
483
- },
484
- })),
485
- };
486
-
487
- return this.serializeTransaction(tx);
488
- }
489
-
490
- /**
491
- * Build a TicketCreate transaction
492
- * @param account - Account address
493
- * @param ticketCount - Number of tickets to create
494
- * @returns Base64 encoded transaction
495
- */
496
- async buildTicketCreate(account: string, ticketCount: number): Promise<string> {
497
- const tx: TicketCreate = {
498
- TransactionType: 'TicketCreate',
499
- Account: account,
500
- TicketCount: ticketCount,
501
- };
502
-
503
- return this.serializeTransaction(tx);
504
- }
505
-
506
- /**
507
- * Build an NFTokenMint transaction
508
- * @param account - Account address
509
- * @param uri - NFT URI (hex encoded)
510
- * @param flags - NFT flags
511
- * @param transferFee - Transfer fee in basis points
512
- * @param taxon - NFT taxon
513
- * @returns Base64 encoded transaction
514
- */
515
- async buildNFTMint(
516
- account: string,
517
- uri: string,
518
- flags: number,
519
- transferFee: number,
520
- taxon: number,
521
- ): Promise<string> {
522
- const tx: NFTokenMint = {
523
- TransactionType: 'NFTokenMint',
524
- Account: account,
525
- URI: uri,
526
- Flags: flags,
527
- TransferFee: transferFee,
528
- NFTokenTaxon: taxon,
529
- };
530
-
531
- return this.serializeTransaction(tx);
532
- }
533
-
534
- /**
535
- * Build an NFTokenBurn transaction
536
- * @param account - Account address
537
- * @param nftokenID - NFT ID to burn
538
- * @returns Base64 encoded transaction
539
- */
540
- async buildNFTBurn(account: string, nftokenID: string): Promise<string> {
541
- const tx: NFTokenBurn = {
542
- TransactionType: 'NFTokenBurn',
543
- Account: account,
544
- NFTokenID: nftokenID,
545
- };
546
-
547
- return this.serializeTransaction(tx);
548
- }
549
-
550
- /**
551
- * Build an NFTokenCreateOffer transaction
552
- * @param account - Account address
553
- * @param nftokenID - NFT ID
554
- * @param amount - Offer amount
555
- * @param flags - Offer flags (1=sell, 0=buy)
556
- * @param destination - Optional destination account
557
- * @returns Base64 encoded transaction
558
- */
559
- async buildNFTCreateOffer(
560
- account: string,
561
- nftokenID: string,
562
- amount: string,
563
- flags: number,
564
- destination?: string,
565
- ): Promise<string> {
566
- const tx: NFTokenCreateOffer = {
567
- TransactionType: 'NFTokenCreateOffer',
568
- Account: account,
569
- NFTokenID: nftokenID,
570
- Amount: amount,
571
- Flags: flags,
572
- ...(destination && { Destination: destination }),
573
- };
574
-
575
- return this.serializeTransaction(tx);
576
- }
577
-
578
- /**
579
- * Build an NFTokenAcceptOffer transaction
580
- * @param account - Account address
581
- * @param nftokenSellOffer - Sell offer ID (optional)
582
- * @param nftokenBuyOffer - Buy offer ID (optional)
583
- * @returns Base64 encoded transaction
584
- */
585
- async buildNFTAcceptOffer(
586
- account: string,
587
- nftokenSellOffer?: string,
588
- nftokenBuyOffer?: string,
589
- ): Promise<string> {
590
- const tx: NFTokenAcceptOffer = {
591
- TransactionType: 'NFTokenAcceptOffer',
592
- Account: account,
593
- ...(nftokenSellOffer && { NFTokenSellOffer: nftokenSellOffer }),
594
- ...(nftokenBuyOffer && { NFTokenBuyOffer: nftokenBuyOffer }),
595
- };
596
-
597
- return this.serializeTransaction(tx);
598
- }
599
-
600
- /**
601
- * Build an NFTokenCancelOffer transaction
602
- * @param account - Account address
603
- * @param nftokenOffers - Array of offer IDs to cancel
604
- * @returns Base64 encoded transaction
605
- */
606
- async buildNFTCancelOffer(account: string, nftokenOffers: string[]): Promise<string> {
607
- const tx: NFTokenCancelOffer = {
608
- TransactionType: 'NFTokenCancelOffer',
609
- Account: account,
610
- NFTokenOffers: nftokenOffers,
611
- };
612
-
613
- return this.serializeTransaction(tx);
614
- }
615
-
616
- /**
617
- * Build a Batch transaction with multiple inner transactions
618
- * @param account - Account executing the batch
619
- * @param innerTransactions - Array of transaction descriptors
620
- * @returns Base64 encoded batch transaction JSON
621
- */
622
- async buildBatchTransaction(
623
- account: string,
624
- innerTransactions: Array<{
625
- type: 'payment' | 'trust-set' | 'nft-mint';
626
- destination?: string;
627
- amount?: string;
628
- currency?: string;
629
- issuer?: string;
630
- }>,
631
- ): Promise<string> {
632
- const tfInnerBatchTxn = 1073741824;
633
- const tfAllOrNothing = 65536;
634
-
635
- const rawTransactions = innerTransactions.map((tx, index) => {
636
- let innerTx: any;
637
-
638
- switch (tx.type) {
639
- case 'payment':
640
- innerTx = {
641
- TransactionType: 'Payment',
642
- Flags: tfInnerBatchTxn,
643
- Account: account,
644
- Destination: tx.destination || '',
645
- Amount: tx.amount || '1000000',
646
- Fee: '0',
647
- Sequence: index + 1,
648
- SigningPubKey: '',
649
- };
650
-
651
- if (tx.currency && tx.issuer) {
652
- innerTx.Amount = {
653
- currency: tx.currency,
654
- issuer: tx.issuer,
655
- value: tx.amount || '1',
656
- };
657
- }
658
- break;
659
-
660
- case 'trust-set':
661
- innerTx = {
662
- TransactionType: 'TrustSet',
663
- Flags: tfInnerBatchTxn,
664
- Account: account,
665
- LimitAmount: {
666
- currency: tx.currency || 'USD',
667
- issuer: tx.issuer || '',
668
- value: tx.amount || '1000000',
669
- },
670
- Fee: '0',
671
- Sequence: index + 1,
672
- SigningPubKey: '',
673
- };
674
- break;
675
-
676
- case 'nft-mint':
677
- innerTx = {
678
- TransactionType: 'NFTokenMint',
679
- Flags: tfInnerBatchTxn,
680
- Account: account,
681
- NFTokenTaxon: 0,
682
- Fee: '0',
683
- Sequence: index + 1,
684
- SigningPubKey: '',
685
- };
686
- break;
687
-
688
- default:
689
- innerTx = {
690
- TransactionType: 'Payment',
691
- Flags: tfInnerBatchTxn,
692
- Account: account,
693
- Destination: account,
694
- Amount: '1',
695
- Fee: '0',
696
- Sequence: index + 1,
697
- SigningPubKey: '',
698
- };
699
- }
700
-
701
- return { RawTransaction: innerTx };
702
- });
703
-
704
- const batchTx = {
705
- TransactionType: 'Batch',
706
- Account: account,
707
- Flags: tfAllOrNothing,
708
- RawTransactions: rawTransactions,
709
- };
710
-
711
- return this.serializeTransaction(batchTx as any);
712
- }
713
-
714
- /**
715
- * Build inner transactions for batch (unsigned, with batch flags set)
716
- * @param account - Account executing the batch
717
- * @param innerTransactions - Array of transaction descriptors
718
- * @returns Array of base64 encoded unsigned inner transactions
719
- */
720
- async buildBatchInnerTransactions(
721
- account: string,
722
- innerTransactions: Array<{
723
- type: 'payment' | 'trust-set' | 'nft-mint';
724
- destination?: string;
725
- amount?: string;
726
- currency?: string;
727
- issuer?: string;
728
- uri?: string;
729
- taxon?: number;
730
- }>,
731
- ): Promise<Array<{ payload: string; description: string }>> {
732
- const tfInnerBatchTxn = 1073741824;
733
- const results: Array<{ payload: string; description: string }> = [];
734
-
735
- for (let index = 0; index < innerTransactions.length; index++) {
736
- const tx = innerTransactions[index];
737
- let innerTx: any;
738
- let description: string;
739
-
740
- switch (tx.type) {
741
- case 'payment':
742
- if (tx.currency && tx.issuer) {
743
- innerTx = {
744
- TransactionType: 'Payment',
745
- Flags: tfInnerBatchTxn,
746
- Account: account,
747
- Destination: tx.destination || '',
748
- Amount: {
749
- currency: tx.currency,
750
- issuer: tx.issuer,
751
- value: tx.amount || '1',
752
- },
753
- Fee: '0',
754
- Sequence: index + 1,
755
- SigningPubKey: '',
756
- };
757
- description = `Send ${tx.amount} ${tx.currency} to ${tx.destination}`;
758
- } else {
759
- innerTx = {
760
- TransactionType: 'Payment',
761
- Flags: tfInnerBatchTxn,
762
- Account: account,
763
- Destination: tx.destination || '',
764
- Amount: tx.amount || '1000000',
765
- Fee: '0',
766
- Sequence: index + 1,
767
- SigningPubKey: '',
768
- };
769
- description = `Send ${Number(tx.amount || '1000000') / 1000000} XRP to ${tx.destination}`;
770
- }
771
- break;
772
-
773
- case 'trust-set':
774
- innerTx = {
775
- TransactionType: 'TrustSet',
776
- Flags: tfInnerBatchTxn,
777
- Account: account,
778
- LimitAmount: {
779
- currency: tx.currency || 'USD',
780
- issuer: tx.issuer || '',
781
- value: tx.amount || '1000000',
782
- },
783
- Fee: '0',
784
- Sequence: index + 1,
785
- SigningPubKey: '',
786
- };
787
- description = `Set trust line for ${tx.currency} (${tx.amount})`;
788
- break;
789
-
790
- case 'nft-mint':
791
- innerTx = {
792
- TransactionType: 'NFTokenMint',
793
- Flags: tfInnerBatchTxn,
794
- Account: account,
795
- URI: tx.uri || '',
796
- NFTokenTaxon: tx.taxon || 0,
797
- Fee: '0',
798
- Sequence: index + 1,
799
- SigningPubKey: '',
800
- };
801
- description = `Mint NFT (taxon: ${tx.taxon})`;
802
- break;
803
-
804
- default:
805
- throw new Error(`Unknown transaction type: ${(tx as any).type}`);
806
- }
807
-
808
- results.push({
809
- payload: btoa(JSON.stringify(innerTx)),
810
- description,
811
- });
812
- }
813
-
814
- return results;
815
- }
816
-
817
- /**
818
- * Serializes a transaction to base64 encoded JSON.
819
- *
820
- * @description
821
- * Converts the transaction object to a JSON string and encodes it as base64.
822
- * This format is used for transport to the wallet for signing.
823
- *
824
- * @param transaction - The XRPL transaction object
825
- *
826
- * @returns Base64 encoded JSON string
827
- */
828
- private async serializeTransaction(transaction: Transaction): Promise<string> {
829
- const jsonString = JSON.stringify(transaction);
830
- return btoa(jsonString);
831
- }
832
- }