@circle-fin/daa-react-native-sdk 0.0.0-stage → 0.5.0

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 (337) hide show
  1. package/DaaReactNativeSdk.podspec +69 -0
  2. package/LICENSE +176 -0
  3. package/README.md +691 -2
  4. package/android/build.gradle +102 -0
  5. package/android/src/main/AndroidManifest.xml +1 -0
  6. package/android/src/main/java/com/circle/daa/reactnative/DaaRegistrationExceptions.kt +47 -0
  7. package/android/src/main/java/com/circle/daa/reactnative/DaaRegistrationModule.kt +104 -0
  8. package/android/src/main/java/com/circle/daa/reactnative/DaaScaExceptions.kt +60 -0
  9. package/android/src/main/java/com/circle/daa/reactnative/DaaScaModule.kt +179 -0
  10. package/android/src/main/java/com/circle/daa/reactnative/DaaSecureKeyExceptions.kt +107 -0
  11. package/android/src/main/java/com/circle/daa/reactnative/DaaSecureKeyModule.kt +318 -0
  12. package/android/src/main/java/com/circle/daa/reactnative/InstallationIdentityStore.kt +122 -0
  13. package/android/src/main/java/com/circle/daa/reactnative/UnpaddedBase64Url.kt +45 -0
  14. package/build/DaaClient.d.ts +237 -0
  15. package/build/DaaClient.js +442 -0
  16. package/build/api/AccountLimitsClient.d.ts +79 -0
  17. package/build/api/AccountLimitsClient.js +142 -0
  18. package/build/api/AccountsClient.d.ts +98 -0
  19. package/build/api/AccountsClient.js +279 -0
  20. package/build/api/AchFiatAccountsClient.d.ts +92 -0
  21. package/build/api/AchFiatAccountsClient.js +142 -0
  22. package/build/api/AuthClient.d.ts +95 -0
  23. package/build/api/AuthClient.js +221 -0
  24. package/build/api/ContractExecutionsClient.d.ts +114 -0
  25. package/build/api/ContractExecutionsClient.js +462 -0
  26. package/build/api/DaaUserClient.d.ts +187 -0
  27. package/build/api/DaaUserClient.js +312 -0
  28. package/build/api/DepositAddressesClient.d.ts +112 -0
  29. package/build/api/DepositAddressesClient.js +222 -0
  30. package/build/api/DepositsClient.d.ts +106 -0
  31. package/build/api/DepositsClient.js +183 -0
  32. package/build/api/FiatAccountsClient.d.ts +43 -0
  33. package/build/api/FiatAccountsClient.js +46 -0
  34. package/build/api/TransactionsClient.d.ts +64 -0
  35. package/build/api/TransactionsClient.js +121 -0
  36. package/build/api/TransfersClient.d.ts +107 -0
  37. package/build/api/TransfersClient.js +324 -0
  38. package/build/api/WireFiatAccountsClient.d.ts +99 -0
  39. package/build/api/WireFiatAccountsClient.js +156 -0
  40. package/build/api/WithdrawalsClient.d.ts +97 -0
  41. package/build/api/WithdrawalsClient.js +308 -0
  42. package/build/api/deviceApproval.d.ts +48 -0
  43. package/build/api/deviceApproval.js +247 -0
  44. package/build/api/deviceStatus.d.ts +61 -0
  45. package/build/api/deviceStatus.js +216 -0
  46. package/build/api/loginFailure.d.ts +51 -0
  47. package/build/api/loginFailure.js +95 -0
  48. package/build/api/pagination.d.ts +29 -0
  49. package/build/api/pagination.js +50 -0
  50. package/build/api/queryParameters.d.ts +23 -0
  51. package/build/api/queryParameters.js +77 -0
  52. package/build/api/resourceRequest.d.ts +60 -0
  53. package/build/api/resourceRequest.js +79 -0
  54. package/build/api/signedResource.d.ts +124 -0
  55. package/build/api/signedResource.js +267 -0
  56. package/build/auth/RegistrationFlowKey.d.ts +93 -0
  57. package/build/auth/RegistrationFlowKey.js +203 -0
  58. package/build/auth/daaRegistrationNative.d.ts +58 -0
  59. package/build/auth/daaRegistrationNative.js +158 -0
  60. package/build/auth/deviceAuthorization.d.ts +87 -0
  61. package/build/auth/deviceAuthorization.js +295 -0
  62. package/build/auth/ownerGrant.d.ts +29 -0
  63. package/build/auth/ownerGrant.js +90 -0
  64. package/build/auth/registrationAuthorization.d.ts +48 -0
  65. package/build/auth/registrationAuthorization.js +246 -0
  66. package/build/auth/registrationCodeVerifier.d.ts +31 -0
  67. package/build/auth/registrationCodeVerifier.js +75 -0
  68. package/build/config.d.ts +106 -0
  69. package/build/config.js +131 -0
  70. package/build/crypto/base64url.d.ts +26 -0
  71. package/build/crypto/base64url.js +87 -0
  72. package/build/crypto/bytes.d.ts +27 -0
  73. package/build/crypto/bytes.js +32 -0
  74. package/build/crypto/jwkThumbprint.d.ts +32 -0
  75. package/build/crypto/jwkThumbprint.js +49 -0
  76. package/build/crypto/matchingCode.d.ts +47 -0
  77. package/build/crypto/matchingCode.js +93 -0
  78. package/build/crypto/random.d.ts +35 -0
  79. package/build/crypto/random.js +106 -0
  80. package/build/crypto/serialization.d.ts +26 -0
  81. package/build/crypto/serialization.js +43 -0
  82. package/build/crypto/sha256.d.ts +18 -0
  83. package/build/crypto/sha256.js +100 -0
  84. package/build/errors.d.ts +307 -0
  85. package/build/errors.js +413 -0
  86. package/build/index.d.ts +69 -0
  87. package/build/index.js +67 -0
  88. package/build/models/Account.d.ts +201 -0
  89. package/build/models/Account.js +147 -0
  90. package/build/models/AccountLimitsUsage.d.ts +169 -0
  91. package/build/models/AccountLimitsUsage.js +86 -0
  92. package/build/models/Ach.d.ts +135 -0
  93. package/build/models/Ach.js +184 -0
  94. package/build/models/AddressObject.d.ts +128 -0
  95. package/build/models/AddressObject.js +141 -0
  96. package/build/models/BusinessPii.d.ts +84 -0
  97. package/build/models/BusinessPii.js +142 -0
  98. package/build/models/ContractExecution.d.ts +197 -0
  99. package/build/models/ContractExecution.js +130 -0
  100. package/build/models/CreateAccountRequest.d.ts +74 -0
  101. package/build/models/CreateAccountRequest.js +19 -0
  102. package/build/models/CreateContractExecutionRequest.d.ts +81 -0
  103. package/build/models/CreateContractExecutionRequest.js +19 -0
  104. package/build/models/CreateTransferRequest.d.ts +91 -0
  105. package/build/models/CreateTransferRequest.js +19 -0
  106. package/build/models/CreateWithdrawalRequest.d.ts +99 -0
  107. package/build/models/CreateWithdrawalRequest.js +19 -0
  108. package/build/models/DaaUserContext.d.ts +146 -0
  109. package/build/models/DaaUserContext.js +164 -0
  110. package/build/models/Deposit.d.ts +241 -0
  111. package/build/models/Deposit.js +149 -0
  112. package/build/models/DepositSummary.d.ts +91 -0
  113. package/build/models/DepositSummary.js +114 -0
  114. package/build/models/DeviceStatus.d.ts +69 -0
  115. package/build/models/DeviceStatus.js +19 -0
  116. package/build/models/FiatAccount.d.ts +99 -0
  117. package/build/models/FiatAccount.js +151 -0
  118. package/build/models/GenerateAddressRequest.d.ts +67 -0
  119. package/build/models/GenerateAddressRequest.js +68 -0
  120. package/build/models/Money.d.ts +76 -0
  121. package/build/models/Money.js +99 -0
  122. package/build/models/Page.d.ts +33 -0
  123. package/build/models/Page.js +57 -0
  124. package/build/models/PendingDeviceApproval.d.ts +121 -0
  125. package/build/models/PendingDeviceApproval.js +208 -0
  126. package/build/models/PendingDeviceRegistration.d.ts +229 -0
  127. package/build/models/PendingDeviceRegistration.js +636 -0
  128. package/build/models/PreparedContractExecution.d.ts +70 -0
  129. package/build/models/PreparedContractExecution.js +77 -0
  130. package/build/models/PreparedSocialLogin.d.ts +148 -0
  131. package/build/models/PreparedSocialLogin.js +252 -0
  132. package/build/models/Transaction.d.ts +233 -0
  133. package/build/models/Transaction.js +182 -0
  134. package/build/models/Transfer.d.ts +335 -0
  135. package/build/models/Transfer.js +240 -0
  136. package/build/models/Wire.d.ts +213 -0
  137. package/build/models/Wire.js +264 -0
  138. package/build/models/Withdrawal.d.ts +201 -0
  139. package/build/models/Withdrawal.js +156 -0
  140. package/build/models/codeSecrets.d.ts +100 -0
  141. package/build/models/codeSecrets.js +321 -0
  142. package/build/models/redaction.d.ts +18 -0
  143. package/build/models/redaction.js +23 -0
  144. package/build/sca/ScaClient.d.ts +105 -0
  145. package/build/sca/ScaClient.js +193 -0
  146. package/build/securekey/InMemorySecureKey.d.ts +25 -0
  147. package/build/securekey/InMemorySecureKey.js +168 -0
  148. package/build/securekey/NativeSecureKey.d.ts +26 -0
  149. package/build/securekey/NativeSecureKey.js +355 -0
  150. package/build/securekey/NativeSecureKeyBridge.d.ts +151 -0
  151. package/build/securekey/NativeSecureKeyBridge.js +19 -0
  152. package/build/securekey/SecureKey.d.ts +257 -0
  153. package/build/securekey/SecureKey.js +19 -0
  154. package/build/securekey/alias.d.ts +97 -0
  155. package/build/securekey/alias.js +184 -0
  156. package/build/securekey/ownerAuthKeyResolver.d.ts +73 -0
  157. package/build/securekey/ownerAuthKeyResolver.js +78 -0
  158. package/build/securekey/registration.d.ts +19 -0
  159. package/build/securekey/registration.js +38 -0
  160. package/build/securekey/resolveNativeBridge.d.ts +33 -0
  161. package/build/securekey/resolveNativeBridge.js +201 -0
  162. package/build/testing.d.ts +18 -0
  163. package/build/testing.js +34 -0
  164. package/build/transport/DaaTransport.d.ts +35 -0
  165. package/build/transport/DaaTransport.js +19 -0
  166. package/build/transport/headers.d.ts +41 -0
  167. package/build/transport/headers.js +81 -0
  168. package/build/validation/requestBody.d.ts +27 -0
  169. package/build/validation/requestBody.js +56 -0
  170. package/build/validation/uuid.d.ts +25 -0
  171. package/build/validation/uuid.js +33 -0
  172. package/build/wire/accountLimitsUsagePayload.d.ts +30 -0
  173. package/build/wire/accountLimitsUsagePayload.js +130 -0
  174. package/build/wire/accountPayload.d.ts +36 -0
  175. package/build/wire/accountPayload.js +100 -0
  176. package/build/wire/achPayload.d.ts +24 -0
  177. package/build/wire/achPayload.js +82 -0
  178. package/build/wire/addressObjectPayload.d.ts +44 -0
  179. package/build/wire/addressObjectPayload.js +64 -0
  180. package/build/wire/contractExecutionPayload.d.ts +24 -0
  181. package/build/wire/contractExecutionPayload.js +130 -0
  182. package/build/wire/daaStatusCodes.d.ts +81 -0
  183. package/build/wire/daaStatusCodes.js +86 -0
  184. package/build/wire/dataEnvelope.d.ts +40 -0
  185. package/build/wire/dataEnvelope.js +79 -0
  186. package/build/wire/depositPayload.d.ts +42 -0
  187. package/build/wire/depositPayload.js +159 -0
  188. package/build/wire/deviceContextPayload.d.ts +35 -0
  189. package/build/wire/deviceContextPayload.js +59 -0
  190. package/build/wire/deviceRegistrationResultPayload.d.ts +77 -0
  191. package/build/wire/deviceRegistrationResultPayload.js +162 -0
  192. package/build/wire/deviceStatusPayload.d.ts +20 -0
  193. package/build/wire/deviceStatusPayload.js +66 -0
  194. package/build/wire/errorEnvelope.d.ts +43 -0
  195. package/build/wire/errorEnvelope.js +85 -0
  196. package/build/wire/fiatAccountPayload.d.ts +37 -0
  197. package/build/wire/fiatAccountPayload.js +93 -0
  198. package/build/wire/instant.d.ts +27 -0
  199. package/build/wire/instant.js +94 -0
  200. package/build/wire/jsonNumber.d.ts +30 -0
  201. package/build/wire/jsonNumber.js +34 -0
  202. package/build/wire/moneyPayload.d.ts +30 -0
  203. package/build/wire/moneyPayload.js +56 -0
  204. package/build/wire/paginationLinks.d.ts +28 -0
  205. package/build/wire/paginationLinks.js +167 -0
  206. package/build/wire/payload.d.ts +60 -0
  207. package/build/wire/payload.js +121 -0
  208. package/build/wire/pendingRegistrationPayload.d.ts +48 -0
  209. package/build/wire/pendingRegistrationPayload.js +72 -0
  210. package/build/wire/socialLoginRequestPayload.d.ts +26 -0
  211. package/build/wire/socialLoginRequestPayload.js +55 -0
  212. package/build/wire/transactionPayload.d.ts +31 -0
  213. package/build/wire/transactionPayload.js +149 -0
  214. package/build/wire/transferPayload.d.ts +43 -0
  215. package/build/wire/transferPayload.js +218 -0
  216. package/build/wire/wireEnums.d.ts +22 -0
  217. package/build/wire/wireEnums.js +69 -0
  218. package/build/wire/wirePayload.d.ts +29 -0
  219. package/build/wire/wirePayload.js +138 -0
  220. package/build/wire/withdrawalPayload.d.ts +27 -0
  221. package/build/wire/withdrawalPayload.js +179 -0
  222. package/expo-module.config.json +14 -0
  223. package/ios/DaaRegistrationExceptions.swift +58 -0
  224. package/ios/DaaRegistrationModule.swift +125 -0
  225. package/ios/DaaScaExceptions.swift +96 -0
  226. package/ios/DaaScaModule.swift +125 -0
  227. package/ios/DaaSecureKeyExceptions.swift +125 -0
  228. package/ios/DaaSecureKeyModule.swift +306 -0
  229. package/ios/InstallationIdentityStore.swift +162 -0
  230. package/ios/UnpaddedBase64URL.swift +42 -0
  231. package/package.json +114 -4
  232. package/src/DaaClient.ts +509 -0
  233. package/src/api/AccountLimitsClient.ts +146 -0
  234. package/src/api/AccountsClient.ts +308 -0
  235. package/src/api/AchFiatAccountsClient.ts +147 -0
  236. package/src/api/AuthClient.ts +266 -0
  237. package/src/api/ContractExecutionsClient.ts +527 -0
  238. package/src/api/DaaUserClient.ts +345 -0
  239. package/src/api/DepositAddressesClient.ts +239 -0
  240. package/src/api/DepositsClient.ts +208 -0
  241. package/src/api/FiatAccountsClient.ts +50 -0
  242. package/src/api/TransactionsClient.ts +138 -0
  243. package/src/api/TransfersClient.ts +364 -0
  244. package/src/api/WireFiatAccountsClient.ts +172 -0
  245. package/src/api/WithdrawalsClient.ts +342 -0
  246. package/src/api/deviceApproval.ts +306 -0
  247. package/src/api/deviceStatus.ts +238 -0
  248. package/src/api/loginFailure.ts +112 -0
  249. package/src/api/pagination.ts +63 -0
  250. package/src/api/queryParameters.ts +82 -0
  251. package/src/api/resourceRequest.ts +135 -0
  252. package/src/api/signedResource.ts +427 -0
  253. package/src/auth/RegistrationFlowKey.ts +274 -0
  254. package/src/auth/daaRegistrationNative.ts +191 -0
  255. package/src/auth/deviceAuthorization.ts +365 -0
  256. package/src/auth/ownerGrant.ts +102 -0
  257. package/src/auth/registrationAuthorization.ts +309 -0
  258. package/src/auth/registrationCodeVerifier.ts +76 -0
  259. package/src/config.ts +192 -0
  260. package/src/crypto/base64url.ts +88 -0
  261. package/src/crypto/bytes.ts +30 -0
  262. package/src/crypto/jwkThumbprint.ts +65 -0
  263. package/src/crypto/matchingCode.ts +100 -0
  264. package/src/crypto/random.ts +113 -0
  265. package/src/crypto/serialization.ts +42 -0
  266. package/src/crypto/sha256.ts +105 -0
  267. package/src/errors.ts +576 -0
  268. package/src/index.ts +258 -0
  269. package/src/models/Account.ts +264 -0
  270. package/src/models/AccountLimitsUsage.ts +192 -0
  271. package/src/models/Ach.ts +269 -0
  272. package/src/models/AddressObject.ts +169 -0
  273. package/src/models/BusinessPii.ts +154 -0
  274. package/src/models/ContractExecution.ts +250 -0
  275. package/src/models/CreateAccountRequest.ts +109 -0
  276. package/src/models/CreateContractExecutionRequest.ts +100 -0
  277. package/src/models/CreateTransferRequest.ts +114 -0
  278. package/src/models/CreateWithdrawalRequest.ts +120 -0
  279. package/src/models/DaaUserContext.ts +228 -0
  280. package/src/models/Deposit.ts +307 -0
  281. package/src/models/DepositSummary.ts +142 -0
  282. package/src/models/DeviceStatus.ts +50 -0
  283. package/src/models/FiatAccount.ts +195 -0
  284. package/src/models/GenerateAddressRequest.ts +101 -0
  285. package/src/models/Money.ts +91 -0
  286. package/src/models/Page.ts +48 -0
  287. package/src/models/PendingDeviceApproval.ts +229 -0
  288. package/src/models/PendingDeviceRegistration.ts +791 -0
  289. package/src/models/PreparedContractExecution.ts +128 -0
  290. package/src/models/PreparedSocialLogin.ts +297 -0
  291. package/src/models/Transaction.ts +322 -0
  292. package/src/models/Transfer.ts +459 -0
  293. package/src/models/Wire.ts +405 -0
  294. package/src/models/Withdrawal.ts +283 -0
  295. package/src/models/codeSecrets.ts +360 -0
  296. package/src/models/redaction.ts +22 -0
  297. package/src/sca/ScaClient.ts +289 -0
  298. package/src/securekey/InMemorySecureKey.ts +192 -0
  299. package/src/securekey/NativeSecureKey.ts +388 -0
  300. package/src/securekey/NativeSecureKeyBridge.ts +189 -0
  301. package/src/securekey/SecureKey.ts +279 -0
  302. package/src/securekey/alias.ts +212 -0
  303. package/src/securekey/ownerAuthKeyResolver.ts +135 -0
  304. package/src/securekey/registration.ts +40 -0
  305. package/src/securekey/resolveNativeBridge.ts +343 -0
  306. package/src/testing.ts +32 -0
  307. package/src/transport/DaaTransport.ts +42 -0
  308. package/src/transport/headers.ts +93 -0
  309. package/src/validation/requestBody.ts +60 -0
  310. package/src/validation/uuid.ts +31 -0
  311. package/src/wire/accountLimitsUsagePayload.ts +182 -0
  312. package/src/wire/accountPayload.ts +108 -0
  313. package/src/wire/achPayload.ts +98 -0
  314. package/src/wire/addressObjectPayload.ts +64 -0
  315. package/src/wire/contractExecutionPayload.ts +152 -0
  316. package/src/wire/daaStatusCodes.ts +86 -0
  317. package/src/wire/dataEnvelope.ts +80 -0
  318. package/src/wire/depositPayload.ts +186 -0
  319. package/src/wire/deviceContextPayload.ts +60 -0
  320. package/src/wire/deviceRegistrationResultPayload.ts +211 -0
  321. package/src/wire/deviceStatusPayload.ts +68 -0
  322. package/src/wire/errorEnvelope.ts +87 -0
  323. package/src/wire/fiatAccountPayload.ts +112 -0
  324. package/src/wire/instant.ts +96 -0
  325. package/src/wire/jsonNumber.ts +33 -0
  326. package/src/wire/moneyPayload.ts +55 -0
  327. package/src/wire/paginationLinks.ts +204 -0
  328. package/src/wire/payload.ts +146 -0
  329. package/src/wire/pendingRegistrationPayload.ts +118 -0
  330. package/src/wire/socialLoginRequestPayload.ts +66 -0
  331. package/src/wire/transactionPayload.ts +181 -0
  332. package/src/wire/transferPayload.ts +249 -0
  333. package/src/wire/wireEnums.ts +74 -0
  334. package/src/wire/wirePayload.ts +160 -0
  335. package/src/wire/withdrawalPayload.ts +219 -0
  336. package/testing.d.ts +19 -0
  337. package/testing.js +25 -0
@@ -0,0 +1,335 @@
1
+ /**
2
+ * Copyright (c) 2026, Circle Internet Group, Inc. All rights reserved.
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ import type { Money } from './Money';
19
+ /**
20
+ * Where a transfer is in its lifecycle (OpenAPI `TransferStatus`, wire values
21
+ * are the enum constant names verbatim).
22
+ *
23
+ * `pending` also covers any asynchronous processing before settlement: the
24
+ * public contract has no intermediate state, so that phase folds into
25
+ * `pending` before this SDK ever sees it.
26
+ */
27
+ export type TransferStatus = {
28
+ readonly kind: 'pending';
29
+ }
30
+ /** Terminal: successfully settled. */
31
+ | {
32
+ readonly kind: 'complete';
33
+ }
34
+ /** Terminal: failed or denied — see {@link TransferErrorCode}. */
35
+ | {
36
+ readonly kind: 'failed';
37
+ } | {
38
+ readonly kind: 'unrecognized';
39
+ readonly rawValue: string | null;
40
+ };
41
+ /**
42
+ * Why a transfer failed (OpenAPI `TransferErrorCode`), present only when
43
+ * {@link TransferStatus} is `failed`.
44
+ *
45
+ * This is the service's own public subset: internal failure reasons fold into
46
+ * `transfer_failed` before they reach the wire.
47
+ * Still modeled as an open set here rather than trusted to stay exactly five
48
+ * values — the public enum can grow without this SDK's say-so, and a value it has
49
+ * not shipped for must read as `unrecognized`, not fail the transfer.
50
+ */
51
+ export type TransferErrorCode = {
52
+ readonly kind: 'transfer_failed';
53
+ } | {
54
+ readonly kind: 'transfer_denied';
55
+ } | {
56
+ readonly kind: 'blockchain_error';
57
+ } | {
58
+ readonly kind: 'insufficient_funds';
59
+ } | {
60
+ readonly kind: 'invalid_crypto_address';
61
+ } | {
62
+ readonly kind: 'unrecognized';
63
+ readonly rawValue: string | null;
64
+ };
65
+ /**
66
+ * A transfer's source leg (OpenAPI `TransferSourceLocation`, a `oneOf` of
67
+ * `TransferSourceAccountLocation` and `TransferSourceBlockchainLocation`).
68
+ *
69
+ * Neither source shape ever carries an address: `TransferSourceAccountLocation`
70
+ * has only `id`, and `TransferSourceBlockchainLocation` has only `chain` — a
71
+ * transfer's origin address is not part of the public contract. Both are safe as
72
+ * plain frozen literals, unlike the destination union below, because neither
73
+ * carries a value this SDK must redact.
74
+ *
75
+ * The wire discriminator is the location's shared `type` property, keyed here
76
+ * to `account` / `blockchain` — the only two location types the contract
77
+ * allows for a transfer leg (`verified_blockchain`, `wire`, and `ach` are
78
+ * `Transaction`-only). A transfer that ever carries one of those, or a location
79
+ * kind not yet invented, degrades to `unrecognized` with the raw `type` string
80
+ * rather than failing the whole read — the same forward-compatibility contract as
81
+ * every other closed set here.
82
+ */
83
+ export type TransferSourceLocation = {
84
+ readonly kind: 'account';
85
+ /** The account id. Named `accountId` here (the wire spells it `id`) so it
86
+ * is not confused with the transfer's own `id` at `transfer.source.id`. */
87
+ readonly accountId: string;
88
+ } | {
89
+ readonly kind: 'blockchain';
90
+ /**
91
+ * Chain of the on-chain leg, as a plain string rather than a closed set —
92
+ * same reasoning as `Account.blockchain`: new chains ship without an SDK
93
+ * release, and the service's own chain type is the thing that would have
94
+ * to grow, not this union.
95
+ *
96
+ * **Nullable**, despite the OpenAPI schema marking
97
+ * `TransferSourceBlockchainLocation.chain` required: the service builds a
98
+ * blockchain source leg with no chain when the leg was recorded before its
99
+ * blockchain metadata backfilled, and the schema does not prevent it from
100
+ * sending that leg anyway.
101
+ */
102
+ readonly chain: string | null;
103
+ } | {
104
+ readonly kind: 'unrecognized';
105
+ readonly rawValue: string | null;
106
+ };
107
+ /** The redacted shape `JSON.stringify`/`toString` produce for a destination account leg. */
108
+ export type TransferDestinationAccountLocationRendering = {
109
+ readonly kind: 'account';
110
+ readonly accountId: string;
111
+ readonly address: string | null;
112
+ readonly addressTag: string | null;
113
+ };
114
+ /**
115
+ * A transfer destination that is a DAA account (OpenAPI
116
+ * `TransferDestinationAccountLocation`).
117
+ *
118
+ * Unlike the source shape, a destination account leg can carry the on-chain
119
+ * `address`/`addressTag` funds arrived at — present only when this account leg
120
+ * received a crypto deposit. A crypto address is treated as sensitive data, so
121
+ * it is held the same way `Money` holds `amount`: behind a `#` private field
122
+ * and a prototype accessor, with `toJSON`/`toString` reporting only *whether*
123
+ * one is present. The service redacts it from its own logs but still sends it
124
+ * in the JSON body; this SDK redacts the JSON rendering too.
125
+ */
126
+ export declare class TransferDestinationAccountLocation {
127
+ #private;
128
+ readonly kind: "account";
129
+ readonly accountId: string;
130
+ /** @internal Constructed only by the SDK's response decoder. */
131
+ constructor(fields: {
132
+ accountId: string;
133
+ address: string | null;
134
+ addressTag: string | null;
135
+ });
136
+ /** The on-chain address this account leg received a deposit at, or `null` if it did not. */
137
+ get address(): string | null;
138
+ /** Secondary on-chain identifier (e.g. a Stellar memo) paired with {@link address}; nullable. */
139
+ get addressTag(): string | null;
140
+ toJSON(): TransferDestinationAccountLocationRendering;
141
+ toString(): string;
142
+ }
143
+ /** The redacted shape `JSON.stringify`/`toString` produce for a destination blockchain leg. */
144
+ export type TransferDestinationBlockchainLocationRendering = {
145
+ readonly kind: 'blockchain';
146
+ readonly chain: string | null;
147
+ readonly address: string | null;
148
+ readonly addressTag: string | null;
149
+ };
150
+ /**
151
+ * A transfer destination that is an on-chain address (OpenAPI
152
+ * `TransferDestinationBlockchainLocation`).
153
+ *
154
+ * **Both `chain` and `address` are nullable here, despite the OpenAPI schema
155
+ * marking both required.** The wire's `type: "blockchain"` comes from two
156
+ * different kinds of leg that this SDK cannot tell apart from the JSON alone:
157
+ * a verified-blockchain leg folds into it, because the public transfer
158
+ * taxonomy has no verified form on a read.
159
+ *
160
+ * - A plain blockchain leg always resolves `address` (the service falls back
161
+ * to the stored leg id when metadata is absent), so that path alone would
162
+ * justify treating it as required.
163
+ * - A folded verified-blockchain leg does **not** fall back — one with no
164
+ * recorded metadata yet genuinely has no address to report.
165
+ * - Both kinds report `chain` only once their blockchain metadata is
166
+ * recorded.
167
+ *
168
+ * Since either path can produce the wire shape this SDK decodes, and one of
169
+ * them can leave `address` absent, `address` has to be modeled as optional —
170
+ * requiring it would reject a real, un-backfilled verified-blockchain
171
+ * destination. Both fields are redacted the same way `Money.amount` is: behind
172
+ * a `#` private field, never an own enumerable property; `chain` is public
173
+ * because it is not sensitive.
174
+ */
175
+ export declare class TransferDestinationBlockchainLocation {
176
+ #private;
177
+ readonly kind: "blockchain";
178
+ readonly chain: string | null;
179
+ /** @internal Constructed only by the SDK's response decoder. */
180
+ constructor(fields: {
181
+ chain: string | null;
182
+ address: string | null;
183
+ addressTag: string | null;
184
+ });
185
+ /** The destination on-chain address, or `null` for an un-backfilled verified-blockchain leg. See the class note. */
186
+ get address(): string | null;
187
+ /** Secondary on-chain identifier (e.g. a Stellar memo) paired with {@link address}; nullable. */
188
+ get addressTag(): string | null;
189
+ toJSON(): TransferDestinationBlockchainLocationRendering;
190
+ toString(): string;
191
+ }
192
+ /**
193
+ * A transfer's destination leg (OpenAPI `TransferDestinationLocation`, a `oneOf`
194
+ * of `TransferDestinationBlockchainLocation` and `TransferDestinationAccountLocation`).
195
+ *
196
+ * See {@link TransferSourceLocation} for the shared discriminator and the
197
+ * forward-compatibility contract for a `type` this SDK does not recognise.
198
+ */
199
+ export type TransferDestinationLocation = TransferDestinationAccountLocation | TransferDestinationBlockchainLocation | {
200
+ readonly kind: 'unrecognized';
201
+ readonly rawValue: string | null;
202
+ };
203
+ /**
204
+ * A single fee applied to a transfer (OpenAPI `Fee`).
205
+ *
206
+ * `amount` reuses `Money` rather than carrying its own decimal string — the exact
207
+ * problem `Money` already solves (the service serializes `Fee.amount` the same
208
+ * way, as a plain decimal string) and redacts the same way. `type` is a plain
209
+ * `string`: the service does not constrain it to an enum (the schema's
210
+ * `network` value is documentation only, not a runtime constraint), so there is
211
+ * no closed set to model or to get wrong.
212
+ */
213
+ export type Fee = {
214
+ readonly amount: Money;
215
+ readonly type: string;
216
+ };
217
+ /**
218
+ * Policy-engine evaluation attached to a transfer when one is available (OpenAPI
219
+ * `PolicyEvaluation`).
220
+ *
221
+ * `status` is a plain `string`, matching the service: `PolicyEvaluation.status`
222
+ * is a free-form string, not an enum, so — unlike `TransferStatus`/
223
+ * `TransferErrorCode` — there is no closed set to widen or to fall back from.
224
+ */
225
+ export type TransferPolicyEvaluation = {
226
+ readonly status: string;
227
+ };
228
+ /** The redacted shape `JSON.stringify(transfer)` produces. */
229
+ export type TransferRendering = {
230
+ readonly id: string;
231
+ readonly source: TransferSourceLocation | null;
232
+ readonly destination: TransferDestinationLocation | null;
233
+ readonly amount: {
234
+ readonly amount: string;
235
+ readonly currency: string;
236
+ };
237
+ readonly fees: string;
238
+ readonly transactionHash: string | null;
239
+ readonly destinationTransactionHash: string | null;
240
+ readonly status: TransferStatus;
241
+ readonly errorCode: TransferErrorCode | null;
242
+ readonly policyEvaluation: TransferPolicyEvaluation | null;
243
+ readonly createDate: string | null;
244
+ };
245
+ /**
246
+ * A DAA transfer, as the service reports it (OpenAPI `Transfer`, the response
247
+ * contract for `POST /v1/accounts/transfers`, each element of
248
+ * `GET /v1/accounts/transfers`, and `GET /v1/accounts/transfers/{transferId}`).
249
+ *
250
+ * Read-only at runtime as well as in the type system, for the same reason as
251
+ * `Account`: `readonly` is erased at compile time and would leave a returned
252
+ * transfer mutable through a cast. The instance is frozen and the fee list is a
253
+ * frozen array.
254
+ *
255
+ * **Not constructible by a consumer.** Exported from `index.ts` as a type only,
256
+ * and the `#` private fields make the type nominal so an object literal cannot
257
+ * be typed as a `Transfer`.
258
+ *
259
+ * **Only `id`, `amount`, and `status` are guaranteed non-null here — `source`
260
+ * and `destination` are not, despite the OpenAPI schema marking all five
261
+ * required.** That marking is a hint, not proof; the only evidence that
262
+ * settles requiredness is whether a service code path can produce the value
263
+ * absent, and for `source`/`destination` one does: the service reports no leg
264
+ * at all for a fiat source or destination, and no source leg for a
265
+ * verified-blockchain source. A transfer with a fiat leg — an ordinary onramp
266
+ * or offramp — is real, and the service omits null locations, so that leg is
267
+ * simply **absent** from the JSON body, not `null`; requiring it would reject
268
+ * an otherwise-readable transfer. `fees`, `transactionHash`,
269
+ * `destinationTransactionHash`, `errorCode`, and `policyEvaluation` are each
270
+ * documented as present only in some cases (a non-zero fee exists; a leg is
271
+ * blockchain; the CCTP destination leg has minted; status is `failed`; one is
272
+ * available) and decode to empty/`null` when absent, exactly as documented.
273
+ *
274
+ * **`createDate` is treated as optional despite looking mandatory**, and that is
275
+ * a deliberate hedge rather than an oversight: the OpenAPI schema does not mark
276
+ * it required at all (unlike `id`/`amount`/`status`) — the same kind of gap
277
+ * as `Account.description`, which the service can omit. This SDK reports it
278
+ * as it finds it rather than rejecting a transfer that is otherwise perfectly
279
+ * readable.
280
+ *
281
+ * **`amount` and `fees` do not appear in any default rendering.** Like `Account`'s
282
+ * `balances`, they sit behind prototype accessors rather than own properties, so
283
+ * `Object.keys`, `JSON.stringify`, `{ ...transfer }`, `for...in`, and the object
284
+ * inspectors behind `console.log` do not reach them; `toJSON`/`toString` reduce
285
+ * `fees` to a count and delegate `amount` to `Money`'s own redacted rendering.
286
+ * `source`/`destination` are plain own properties — safe, because a location that
287
+ * can carry an address redacts it itself (see
288
+ * {@link TransferDestinationAccountLocation}/{@link TransferDestinationBlockchainLocation}).
289
+ */
290
+ export declare class Transfer {
291
+ #private;
292
+ /** Transfer id. */
293
+ readonly id: string;
294
+ /** `null` for a fiat leg (an onramp) or a stray `verified_blockchain` source — see the class note. */
295
+ readonly source: TransferSourceLocation | null;
296
+ /** `null` for a fiat leg (an offramp) — see the class note. */
297
+ readonly destination: TransferDestinationLocation | null;
298
+ readonly status: TransferStatus;
299
+ /** Present only when {@link status} is `failed`. */
300
+ readonly errorCode: TransferErrorCode | null;
301
+ /** On-chain transaction hash; present only when a leg is blockchain. */
302
+ readonly transactionHash: string | null;
303
+ /**
304
+ * CCTP destination-mint hash — the transaction hash of the destination leg
305
+ * minting on the receiving chain. Present only for a CCTP transfer once
306
+ * that leg has minted; `null` otherwise.
307
+ */
308
+ readonly destinationTransactionHash: string | null;
309
+ /** Policy-evaluation; absent until one is available. */
310
+ readonly policyEvaluation: TransferPolicyEvaluation | null;
311
+ /** Creation timestamp, exactly as the service sent it (ISO-8601 UTC). See the class note on why this is optional. */
312
+ readonly createDate: string | null;
313
+ /** @internal Constructed only by the SDK's response decoder. */
314
+ constructor(fields: {
315
+ readonly id: string;
316
+ readonly source: TransferSourceLocation | null;
317
+ readonly destination: TransferDestinationLocation | null;
318
+ readonly amount: Money;
319
+ readonly fees: readonly Fee[];
320
+ readonly transactionHash: string | null;
321
+ readonly destinationTransactionHash: string | null;
322
+ readonly status: TransferStatus;
323
+ readonly errorCode: TransferErrorCode | null;
324
+ readonly policyEvaluation: TransferPolicyEvaluation | null;
325
+ readonly createDate: string | null;
326
+ });
327
+ /** The transferred amount. Reuses `Money`, which redacts its own `amount` field. */
328
+ get amount(): Money;
329
+ /** Applied fees. Empty when the service sent none (no non-zero fee exists). */
330
+ get fees(): readonly Fee[];
331
+ /** Identifiers and states render; the amount and fee amounts do not. */
332
+ toJSON(): TransferRendering;
333
+ /** Identifiers and states print; the amount and fee amounts do not. */
334
+ toString(): string;
335
+ }
@@ -0,0 +1,240 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2026, Circle Internet Group, Inc. All rights reserved.
4
+ *
5
+ * SPDX-License-Identifier: Apache-2.0
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
20
+ if (kind === "m") throw new TypeError("Private method is not writable");
21
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
22
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
23
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
24
+ };
25
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
26
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
27
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
28
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
29
+ };
30
+ var _TransferDestinationAccountLocation_address, _TransferDestinationAccountLocation_addressTag, _TransferDestinationBlockchainLocation_address, _TransferDestinationBlockchainLocation_addressTag, _Transfer_amount, _Transfer_fees;
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.Transfer = exports.TransferDestinationBlockchainLocation = exports.TransferDestinationAccountLocation = void 0;
33
+ const redaction_1 = require("./redaction");
34
+ /**
35
+ * A transfer destination that is a DAA account (OpenAPI
36
+ * `TransferDestinationAccountLocation`).
37
+ *
38
+ * Unlike the source shape, a destination account leg can carry the on-chain
39
+ * `address`/`addressTag` funds arrived at — present only when this account leg
40
+ * received a crypto deposit. A crypto address is treated as sensitive data, so
41
+ * it is held the same way `Money` holds `amount`: behind a `#` private field
42
+ * and a prototype accessor, with `toJSON`/`toString` reporting only *whether*
43
+ * one is present. The service redacts it from its own logs but still sends it
44
+ * in the JSON body; this SDK redacts the JSON rendering too.
45
+ */
46
+ class TransferDestinationAccountLocation {
47
+ /** @internal Constructed only by the SDK's response decoder. */
48
+ constructor(fields) {
49
+ this.kind = 'account';
50
+ _TransferDestinationAccountLocation_address.set(this, void 0);
51
+ _TransferDestinationAccountLocation_addressTag.set(this, void 0);
52
+ this.accountId = fields.accountId;
53
+ __classPrivateFieldSet(this, _TransferDestinationAccountLocation_address, fields.address, "f");
54
+ __classPrivateFieldSet(this, _TransferDestinationAccountLocation_addressTag, fields.addressTag, "f");
55
+ Object.freeze(this);
56
+ }
57
+ /** The on-chain address this account leg received a deposit at, or `null` if it did not. */
58
+ get address() {
59
+ return __classPrivateFieldGet(this, _TransferDestinationAccountLocation_address, "f");
60
+ }
61
+ /** Secondary on-chain identifier (e.g. a Stellar memo) paired with {@link address}; nullable. */
62
+ get addressTag() {
63
+ return __classPrivateFieldGet(this, _TransferDestinationAccountLocation_addressTag, "f");
64
+ }
65
+ toJSON() {
66
+ return {
67
+ kind: this.kind,
68
+ accountId: this.accountId,
69
+ address: __classPrivateFieldGet(this, _TransferDestinationAccountLocation_address, "f") === null ? null : redaction_1.REDACTED,
70
+ addressTag: __classPrivateFieldGet(this, _TransferDestinationAccountLocation_addressTag, "f") === null ? null : redaction_1.REDACTED,
71
+ };
72
+ }
73
+ toString() {
74
+ return (`TransferDestinationAccountLocation(kind=account, accountId=${this.accountId}, ` +
75
+ `address=${__classPrivateFieldGet(this, _TransferDestinationAccountLocation_address, "f") === null ? 'null' : redaction_1.REDACTED}, ` +
76
+ `addressTag=${__classPrivateFieldGet(this, _TransferDestinationAccountLocation_addressTag, "f") === null ? 'null' : redaction_1.REDACTED})`);
77
+ }
78
+ }
79
+ exports.TransferDestinationAccountLocation = TransferDestinationAccountLocation;
80
+ _TransferDestinationAccountLocation_address = new WeakMap(), _TransferDestinationAccountLocation_addressTag = new WeakMap();
81
+ /**
82
+ * A transfer destination that is an on-chain address (OpenAPI
83
+ * `TransferDestinationBlockchainLocation`).
84
+ *
85
+ * **Both `chain` and `address` are nullable here, despite the OpenAPI schema
86
+ * marking both required.** The wire's `type: "blockchain"` comes from two
87
+ * different kinds of leg that this SDK cannot tell apart from the JSON alone:
88
+ * a verified-blockchain leg folds into it, because the public transfer
89
+ * taxonomy has no verified form on a read.
90
+ *
91
+ * - A plain blockchain leg always resolves `address` (the service falls back
92
+ * to the stored leg id when metadata is absent), so that path alone would
93
+ * justify treating it as required.
94
+ * - A folded verified-blockchain leg does **not** fall back — one with no
95
+ * recorded metadata yet genuinely has no address to report.
96
+ * - Both kinds report `chain` only once their blockchain metadata is
97
+ * recorded.
98
+ *
99
+ * Since either path can produce the wire shape this SDK decodes, and one of
100
+ * them can leave `address` absent, `address` has to be modeled as optional —
101
+ * requiring it would reject a real, un-backfilled verified-blockchain
102
+ * destination. Both fields are redacted the same way `Money.amount` is: behind
103
+ * a `#` private field, never an own enumerable property; `chain` is public
104
+ * because it is not sensitive.
105
+ */
106
+ class TransferDestinationBlockchainLocation {
107
+ /** @internal Constructed only by the SDK's response decoder. */
108
+ constructor(fields) {
109
+ this.kind = 'blockchain';
110
+ _TransferDestinationBlockchainLocation_address.set(this, void 0);
111
+ _TransferDestinationBlockchainLocation_addressTag.set(this, void 0);
112
+ this.chain = fields.chain;
113
+ __classPrivateFieldSet(this, _TransferDestinationBlockchainLocation_address, fields.address, "f");
114
+ __classPrivateFieldSet(this, _TransferDestinationBlockchainLocation_addressTag, fields.addressTag, "f");
115
+ Object.freeze(this);
116
+ }
117
+ /** The destination on-chain address, or `null` for an un-backfilled verified-blockchain leg. See the class note. */
118
+ get address() {
119
+ return __classPrivateFieldGet(this, _TransferDestinationBlockchainLocation_address, "f");
120
+ }
121
+ /** Secondary on-chain identifier (e.g. a Stellar memo) paired with {@link address}; nullable. */
122
+ get addressTag() {
123
+ return __classPrivateFieldGet(this, _TransferDestinationBlockchainLocation_addressTag, "f");
124
+ }
125
+ toJSON() {
126
+ return {
127
+ kind: this.kind,
128
+ chain: this.chain,
129
+ address: __classPrivateFieldGet(this, _TransferDestinationBlockchainLocation_address, "f") === null ? null : redaction_1.REDACTED,
130
+ addressTag: __classPrivateFieldGet(this, _TransferDestinationBlockchainLocation_addressTag, "f") === null ? null : redaction_1.REDACTED,
131
+ };
132
+ }
133
+ toString() {
134
+ return (`TransferDestinationBlockchainLocation(kind=blockchain, chain=${this.chain}, ` +
135
+ `address=${__classPrivateFieldGet(this, _TransferDestinationBlockchainLocation_address, "f") === null ? 'null' : redaction_1.REDACTED}, ` +
136
+ `addressTag=${__classPrivateFieldGet(this, _TransferDestinationBlockchainLocation_addressTag, "f") === null ? 'null' : redaction_1.REDACTED})`);
137
+ }
138
+ }
139
+ exports.TransferDestinationBlockchainLocation = TransferDestinationBlockchainLocation;
140
+ _TransferDestinationBlockchainLocation_address = new WeakMap(), _TransferDestinationBlockchainLocation_addressTag = new WeakMap();
141
+ /**
142
+ * A DAA transfer, as the service reports it (OpenAPI `Transfer`, the response
143
+ * contract for `POST /v1/accounts/transfers`, each element of
144
+ * `GET /v1/accounts/transfers`, and `GET /v1/accounts/transfers/{transferId}`).
145
+ *
146
+ * Read-only at runtime as well as in the type system, for the same reason as
147
+ * `Account`: `readonly` is erased at compile time and would leave a returned
148
+ * transfer mutable through a cast. The instance is frozen and the fee list is a
149
+ * frozen array.
150
+ *
151
+ * **Not constructible by a consumer.** Exported from `index.ts` as a type only,
152
+ * and the `#` private fields make the type nominal so an object literal cannot
153
+ * be typed as a `Transfer`.
154
+ *
155
+ * **Only `id`, `amount`, and `status` are guaranteed non-null here — `source`
156
+ * and `destination` are not, despite the OpenAPI schema marking all five
157
+ * required.** That marking is a hint, not proof; the only evidence that
158
+ * settles requiredness is whether a service code path can produce the value
159
+ * absent, and for `source`/`destination` one does: the service reports no leg
160
+ * at all for a fiat source or destination, and no source leg for a
161
+ * verified-blockchain source. A transfer with a fiat leg — an ordinary onramp
162
+ * or offramp — is real, and the service omits null locations, so that leg is
163
+ * simply **absent** from the JSON body, not `null`; requiring it would reject
164
+ * an otherwise-readable transfer. `fees`, `transactionHash`,
165
+ * `destinationTransactionHash`, `errorCode`, and `policyEvaluation` are each
166
+ * documented as present only in some cases (a non-zero fee exists; a leg is
167
+ * blockchain; the CCTP destination leg has minted; status is `failed`; one is
168
+ * available) and decode to empty/`null` when absent, exactly as documented.
169
+ *
170
+ * **`createDate` is treated as optional despite looking mandatory**, and that is
171
+ * a deliberate hedge rather than an oversight: the OpenAPI schema does not mark
172
+ * it required at all (unlike `id`/`amount`/`status`) — the same kind of gap
173
+ * as `Account.description`, which the service can omit. This SDK reports it
174
+ * as it finds it rather than rejecting a transfer that is otherwise perfectly
175
+ * readable.
176
+ *
177
+ * **`amount` and `fees` do not appear in any default rendering.** Like `Account`'s
178
+ * `balances`, they sit behind prototype accessors rather than own properties, so
179
+ * `Object.keys`, `JSON.stringify`, `{ ...transfer }`, `for...in`, and the object
180
+ * inspectors behind `console.log` do not reach them; `toJSON`/`toString` reduce
181
+ * `fees` to a count and delegate `amount` to `Money`'s own redacted rendering.
182
+ * `source`/`destination` are plain own properties — safe, because a location that
183
+ * can carry an address redacts it itself (see
184
+ * {@link TransferDestinationAccountLocation}/{@link TransferDestinationBlockchainLocation}).
185
+ */
186
+ class Transfer {
187
+ /** @internal Constructed only by the SDK's response decoder. */
188
+ constructor(fields) {
189
+ _Transfer_amount.set(this, void 0);
190
+ _Transfer_fees.set(this, void 0);
191
+ this.id = fields.id;
192
+ this.source = fields.source;
193
+ this.destination = fields.destination;
194
+ this.status = fields.status;
195
+ this.errorCode = fields.errorCode;
196
+ this.transactionHash = fields.transactionHash;
197
+ this.destinationTransactionHash = fields.destinationTransactionHash;
198
+ this.policyEvaluation = fields.policyEvaluation;
199
+ this.createDate = fields.createDate;
200
+ __classPrivateFieldSet(this, _Transfer_amount, fields.amount, "f");
201
+ // Same reasoning as `Account#balances`: freezing a copy rather than the
202
+ // caller's own array, so this construction cannot reach back and freeze an
203
+ // argument the caller still holds a reference to.
204
+ __classPrivateFieldSet(this, _Transfer_fees, Object.freeze(fields.fees.slice()), "f");
205
+ Object.freeze(this);
206
+ }
207
+ /** The transferred amount. Reuses `Money`, which redacts its own `amount` field. */
208
+ get amount() {
209
+ return __classPrivateFieldGet(this, _Transfer_amount, "f");
210
+ }
211
+ /** Applied fees. Empty when the service sent none (no non-zero fee exists). */
212
+ get fees() {
213
+ return __classPrivateFieldGet(this, _Transfer_fees, "f");
214
+ }
215
+ /** Identifiers and states render; the amount and fee amounts do not. */
216
+ toJSON() {
217
+ return {
218
+ id: this.id,
219
+ source: this.source,
220
+ destination: this.destination,
221
+ amount: __classPrivateFieldGet(this, _Transfer_amount, "f").toJSON(),
222
+ fees: `${__classPrivateFieldGet(this, _Transfer_fees, "f").length} entries`,
223
+ transactionHash: this.transactionHash,
224
+ destinationTransactionHash: this.destinationTransactionHash,
225
+ status: this.status,
226
+ errorCode: this.errorCode,
227
+ policyEvaluation: this.policyEvaluation,
228
+ createDate: this.createDate,
229
+ };
230
+ }
231
+ /** Identifiers and states print; the amount and fee amounts do not. */
232
+ toString() {
233
+ return (`Transfer(id=${this.id}, status=${this.status.kind}, ` +
234
+ `errorCode=${this.errorCode === null ? 'null' : this.errorCode.kind}, ` +
235
+ `amount=${__classPrivateFieldGet(this, _Transfer_amount, "f").toString()}, fees=${__classPrivateFieldGet(this, _Transfer_fees, "f").length} entries, ` +
236
+ `transactionHash=${this.transactionHash}, createDate=${this.createDate})`);
237
+ }
238
+ }
239
+ exports.Transfer = Transfer;
240
+ _Transfer_amount = new WeakMap(), _Transfer_fees = new WeakMap();