@circle-fin/daa-react-native-sdk 0.0.0-stage → 0.4.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 (304) hide show
  1. package/DaaReactNativeSdk.podspec +63 -0
  2. package/LICENSE +176 -0
  3. package/README.md +217 -2
  4. package/android/build.gradle +97 -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 +121 -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 +73 -0
  11. package/android/src/main/java/com/circle/daa/reactnative/DaaSecureKeyModule.kt +185 -0
  12. package/android/src/main/java/com/circle/daa/reactnative/InstallationIdentityStore.kt +73 -0
  13. package/android/src/main/java/com/circle/daa/reactnative/UnpaddedBase64Url.kt +45 -0
  14. package/build/DaaClient.d.ts +57 -0
  15. package/build/DaaClient.js +158 -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 +95 -0
  19. package/build/api/AccountsClient.js +276 -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 +120 -0
  23. package/build/api/AuthClient.js +257 -0
  24. package/build/api/DaaUserClient.d.ts +124 -0
  25. package/build/api/DaaUserClient.js +245 -0
  26. package/build/api/DepositAddressesClient.d.ts +112 -0
  27. package/build/api/DepositAddressesClient.js +222 -0
  28. package/build/api/DepositsClient.d.ts +106 -0
  29. package/build/api/DepositsClient.js +183 -0
  30. package/build/api/FiatAccountsClient.d.ts +43 -0
  31. package/build/api/FiatAccountsClient.js +46 -0
  32. package/build/api/TransactionsClient.d.ts +64 -0
  33. package/build/api/TransactionsClient.js +120 -0
  34. package/build/api/TransfersClient.d.ts +104 -0
  35. package/build/api/TransfersClient.js +321 -0
  36. package/build/api/WireFiatAccountsClient.d.ts +99 -0
  37. package/build/api/WireFiatAccountsClient.js +156 -0
  38. package/build/api/WithdrawalsClient.d.ts +94 -0
  39. package/build/api/WithdrawalsClient.js +305 -0
  40. package/build/api/loginFailure.d.ts +43 -0
  41. package/build/api/loginFailure.js +64 -0
  42. package/build/api/pagination.d.ts +29 -0
  43. package/build/api/pagination.js +50 -0
  44. package/build/api/queryParameters.d.ts +23 -0
  45. package/build/api/queryParameters.js +77 -0
  46. package/build/api/resourceRequest.d.ts +60 -0
  47. package/build/api/resourceRequest.js +79 -0
  48. package/build/api/signedResource.d.ts +77 -0
  49. package/build/api/signedResource.js +168 -0
  50. package/build/auth/RegistrationFlowKey.d.ts +93 -0
  51. package/build/auth/RegistrationFlowKey.js +203 -0
  52. package/build/auth/daaRegistrationNative.d.ts +80 -0
  53. package/build/auth/daaRegistrationNative.js +184 -0
  54. package/build/auth/deviceAuthorization.d.ts +73 -0
  55. package/build/auth/deviceAuthorization.js +243 -0
  56. package/build/auth/ownerGrant.d.ts +29 -0
  57. package/build/auth/ownerGrant.js +90 -0
  58. package/build/auth/prepareReceipt.d.ts +150 -0
  59. package/build/auth/prepareReceipt.js +357 -0
  60. package/build/auth/registrationAuthorization.d.ts +48 -0
  61. package/build/auth/registrationAuthorization.js +243 -0
  62. package/build/auth/registrationCodeVerifier.d.ts +31 -0
  63. package/build/auth/registrationCodeVerifier.js +75 -0
  64. package/build/config.d.ts +79 -0
  65. package/build/config.js +116 -0
  66. package/build/crypto/base64url.d.ts +26 -0
  67. package/build/crypto/base64url.js +87 -0
  68. package/build/crypto/bytes.d.ts +27 -0
  69. package/build/crypto/bytes.js +32 -0
  70. package/build/crypto/es256Jws.d.ts +56 -0
  71. package/build/crypto/es256Jws.js +196 -0
  72. package/build/crypto/jwkThumbprint.d.ts +32 -0
  73. package/build/crypto/jwkThumbprint.js +49 -0
  74. package/build/crypto/random.d.ts +35 -0
  75. package/build/crypto/random.js +106 -0
  76. package/build/crypto/serialization.d.ts +26 -0
  77. package/build/crypto/serialization.js +43 -0
  78. package/build/crypto/sha256.d.ts +18 -0
  79. package/build/crypto/sha256.js +100 -0
  80. package/build/errors.d.ts +190 -0
  81. package/build/errors.js +252 -0
  82. package/build/index.d.ts +61 -0
  83. package/build/index.js +67 -0
  84. package/build/models/Account.d.ts +201 -0
  85. package/build/models/Account.js +147 -0
  86. package/build/models/AccountLimitsUsage.d.ts +169 -0
  87. package/build/models/AccountLimitsUsage.js +86 -0
  88. package/build/models/Ach.d.ts +135 -0
  89. package/build/models/Ach.js +184 -0
  90. package/build/models/AddressObject.d.ts +128 -0
  91. package/build/models/AddressObject.js +141 -0
  92. package/build/models/BusinessPii.d.ts +84 -0
  93. package/build/models/BusinessPii.js +142 -0
  94. package/build/models/CreateAccountRequest.d.ts +74 -0
  95. package/build/models/CreateAccountRequest.js +19 -0
  96. package/build/models/CreateTransferRequest.d.ts +91 -0
  97. package/build/models/CreateTransferRequest.js +19 -0
  98. package/build/models/CreateWithdrawalRequest.d.ts +99 -0
  99. package/build/models/CreateWithdrawalRequest.js +19 -0
  100. package/build/models/DaaUserContext.d.ts +96 -0
  101. package/build/models/DaaUserContext.js +133 -0
  102. package/build/models/Deposit.d.ts +241 -0
  103. package/build/models/Deposit.js +149 -0
  104. package/build/models/DepositSummary.d.ts +91 -0
  105. package/build/models/DepositSummary.js +114 -0
  106. package/build/models/FiatAccount.d.ts +99 -0
  107. package/build/models/FiatAccount.js +151 -0
  108. package/build/models/GenerateAddressRequest.d.ts +67 -0
  109. package/build/models/GenerateAddressRequest.js +68 -0
  110. package/build/models/Money.d.ts +76 -0
  111. package/build/models/Money.js +99 -0
  112. package/build/models/Page.d.ts +33 -0
  113. package/build/models/Page.js +57 -0
  114. package/build/models/PendingDeviceRegistration.d.ts +90 -0
  115. package/build/models/PendingDeviceRegistration.js +180 -0
  116. package/build/models/PreparedSocialLogin.d.ts +155 -0
  117. package/build/models/PreparedSocialLogin.js +235 -0
  118. package/build/models/Transaction.d.ts +187 -0
  119. package/build/models/Transaction.js +134 -0
  120. package/build/models/Transfer.d.ts +335 -0
  121. package/build/models/Transfer.js +240 -0
  122. package/build/models/Wire.d.ts +213 -0
  123. package/build/models/Wire.js +264 -0
  124. package/build/models/Withdrawal.d.ts +201 -0
  125. package/build/models/Withdrawal.js +156 -0
  126. package/build/models/redaction.d.ts +18 -0
  127. package/build/models/redaction.js +23 -0
  128. package/build/sca/ScaClient.d.ts +105 -0
  129. package/build/sca/ScaClient.js +193 -0
  130. package/build/securekey/InMemorySecureKey.d.ts +23 -0
  131. package/build/securekey/InMemorySecureKey.js +127 -0
  132. package/build/securekey/NativeSecureKey.d.ts +24 -0
  133. package/build/securekey/NativeSecureKey.js +178 -0
  134. package/build/securekey/NativeSecureKeyBridge.d.ts +83 -0
  135. package/build/securekey/NativeSecureKeyBridge.js +19 -0
  136. package/build/securekey/SecureKey.d.ts +137 -0
  137. package/build/securekey/SecureKey.js +19 -0
  138. package/build/securekey/alias.d.ts +88 -0
  139. package/build/securekey/alias.js +175 -0
  140. package/build/securekey/ownerAuthKeyResolver.d.ts +56 -0
  141. package/build/securekey/ownerAuthKeyResolver.js +63 -0
  142. package/build/securekey/resolveNativeBridge.d.ts +30 -0
  143. package/build/securekey/resolveNativeBridge.js +120 -0
  144. package/build/testing.d.ts +18 -0
  145. package/build/testing.js +34 -0
  146. package/build/transport/DaaTransport.d.ts +35 -0
  147. package/build/transport/DaaTransport.js +19 -0
  148. package/build/transport/headers.d.ts +30 -0
  149. package/build/transport/headers.js +45 -0
  150. package/build/validation/requestBody.d.ts +27 -0
  151. package/build/validation/requestBody.js +56 -0
  152. package/build/validation/uuid.d.ts +25 -0
  153. package/build/validation/uuid.js +33 -0
  154. package/build/wire/accountLimitsUsagePayload.d.ts +30 -0
  155. package/build/wire/accountLimitsUsagePayload.js +130 -0
  156. package/build/wire/accountPayload.d.ts +36 -0
  157. package/build/wire/accountPayload.js +100 -0
  158. package/build/wire/achPayload.d.ts +24 -0
  159. package/build/wire/achPayload.js +82 -0
  160. package/build/wire/addressObjectPayload.d.ts +44 -0
  161. package/build/wire/addressObjectPayload.js +64 -0
  162. package/build/wire/daaStatusCodes.d.ts +64 -0
  163. package/build/wire/daaStatusCodes.js +69 -0
  164. package/build/wire/dataEnvelope.d.ts +40 -0
  165. package/build/wire/dataEnvelope.js +79 -0
  166. package/build/wire/depositPayload.d.ts +42 -0
  167. package/build/wire/depositPayload.js +159 -0
  168. package/build/wire/deviceContextPayload.d.ts +33 -0
  169. package/build/wire/deviceContextPayload.js +57 -0
  170. package/build/wire/deviceRegistrationResultPayload.d.ts +32 -0
  171. package/build/wire/deviceRegistrationResultPayload.js +128 -0
  172. package/build/wire/errorEnvelope.d.ts +43 -0
  173. package/build/wire/errorEnvelope.js +85 -0
  174. package/build/wire/fiatAccountPayload.d.ts +37 -0
  175. package/build/wire/fiatAccountPayload.js +93 -0
  176. package/build/wire/instant.d.ts +27 -0
  177. package/build/wire/instant.js +91 -0
  178. package/build/wire/jsonNumber.d.ts +30 -0
  179. package/build/wire/jsonNumber.js +34 -0
  180. package/build/wire/moneyPayload.d.ts +30 -0
  181. package/build/wire/moneyPayload.js +56 -0
  182. package/build/wire/paginationLinks.d.ts +28 -0
  183. package/build/wire/paginationLinks.js +167 -0
  184. package/build/wire/payload.d.ts +60 -0
  185. package/build/wire/payload.js +121 -0
  186. package/build/wire/pendingRegistrationPayload.d.ts +32 -0
  187. package/build/wire/pendingRegistrationPayload.js +54 -0
  188. package/build/wire/socialLoginRequestPayload.d.ts +31 -0
  189. package/build/wire/socialLoginRequestPayload.js +72 -0
  190. package/build/wire/transactionPayload.d.ts +31 -0
  191. package/build/wire/transactionPayload.js +126 -0
  192. package/build/wire/transferPayload.d.ts +43 -0
  193. package/build/wire/transferPayload.js +218 -0
  194. package/build/wire/wireEnums.d.ts +22 -0
  195. package/build/wire/wireEnums.js +69 -0
  196. package/build/wire/wirePayload.d.ts +29 -0
  197. package/build/wire/wirePayload.js +138 -0
  198. package/build/wire/withdrawalPayload.d.ts +27 -0
  199. package/build/wire/withdrawalPayload.js +179 -0
  200. package/expo-module.config.json +14 -0
  201. package/ios/DaaRegistrationExceptions.swift +58 -0
  202. package/ios/DaaRegistrationModule.swift +143 -0
  203. package/ios/DaaScaExceptions.swift +96 -0
  204. package/ios/DaaScaModule.swift +125 -0
  205. package/ios/DaaSecureKeyExceptions.swift +77 -0
  206. package/ios/DaaSecureKeyModule.swift +162 -0
  207. package/ios/InstallationIdentityStore.swift +126 -0
  208. package/ios/UnpaddedBase64URL.swift +42 -0
  209. package/package.json +114 -4
  210. package/src/DaaClient.ts +171 -0
  211. package/src/api/AccountLimitsClient.ts +146 -0
  212. package/src/api/AccountsClient.ts +305 -0
  213. package/src/api/AchFiatAccountsClient.ts +147 -0
  214. package/src/api/AuthClient.ts +331 -0
  215. package/src/api/DaaUserClient.ts +270 -0
  216. package/src/api/DepositAddressesClient.ts +239 -0
  217. package/src/api/DepositsClient.ts +208 -0
  218. package/src/api/FiatAccountsClient.ts +50 -0
  219. package/src/api/TransactionsClient.ts +137 -0
  220. package/src/api/TransfersClient.ts +361 -0
  221. package/src/api/WireFiatAccountsClient.ts +172 -0
  222. package/src/api/WithdrawalsClient.ts +339 -0
  223. package/src/api/loginFailure.ts +75 -0
  224. package/src/api/pagination.ts +63 -0
  225. package/src/api/queryParameters.ts +82 -0
  226. package/src/api/resourceRequest.ts +135 -0
  227. package/src/api/signedResource.ts +267 -0
  228. package/src/auth/RegistrationFlowKey.ts +274 -0
  229. package/src/auth/daaRegistrationNative.ts +236 -0
  230. package/src/auth/deviceAuthorization.ts +302 -0
  231. package/src/auth/ownerGrant.ts +102 -0
  232. package/src/auth/prepareReceipt.ts +522 -0
  233. package/src/auth/registrationAuthorization.ts +306 -0
  234. package/src/auth/registrationCodeVerifier.ts +76 -0
  235. package/src/config.ts +156 -0
  236. package/src/crypto/base64url.ts +88 -0
  237. package/src/crypto/bytes.ts +30 -0
  238. package/src/crypto/es256Jws.ts +240 -0
  239. package/src/crypto/jwkThumbprint.ts +65 -0
  240. package/src/crypto/random.ts +113 -0
  241. package/src/crypto/serialization.ts +42 -0
  242. package/src/crypto/sha256.ts +105 -0
  243. package/src/errors.ts +319 -0
  244. package/src/index.ts +223 -0
  245. package/src/models/Account.ts +264 -0
  246. package/src/models/AccountLimitsUsage.ts +192 -0
  247. package/src/models/Ach.ts +269 -0
  248. package/src/models/AddressObject.ts +169 -0
  249. package/src/models/BusinessPii.ts +154 -0
  250. package/src/models/CreateAccountRequest.ts +109 -0
  251. package/src/models/CreateTransferRequest.ts +114 -0
  252. package/src/models/CreateWithdrawalRequest.ts +120 -0
  253. package/src/models/DaaUserContext.ts +172 -0
  254. package/src/models/Deposit.ts +307 -0
  255. package/src/models/DepositSummary.ts +142 -0
  256. package/src/models/FiatAccount.ts +195 -0
  257. package/src/models/GenerateAddressRequest.ts +101 -0
  258. package/src/models/Money.ts +91 -0
  259. package/src/models/Page.ts +48 -0
  260. package/src/models/PendingDeviceRegistration.ts +197 -0
  261. package/src/models/PreparedSocialLogin.ts +287 -0
  262. package/src/models/Transaction.ts +247 -0
  263. package/src/models/Transfer.ts +459 -0
  264. package/src/models/Wire.ts +405 -0
  265. package/src/models/Withdrawal.ts +283 -0
  266. package/src/models/redaction.ts +22 -0
  267. package/src/sca/ScaClient.ts +289 -0
  268. package/src/securekey/InMemorySecureKey.ts +138 -0
  269. package/src/securekey/NativeSecureKey.ts +179 -0
  270. package/src/securekey/NativeSecureKeyBridge.ts +109 -0
  271. package/src/securekey/SecureKey.ts +149 -0
  272. package/src/securekey/alias.ts +204 -0
  273. package/src/securekey/ownerAuthKeyResolver.ts +96 -0
  274. package/src/securekey/resolveNativeBridge.ts +185 -0
  275. package/src/testing.ts +32 -0
  276. package/src/transport/DaaTransport.ts +42 -0
  277. package/src/transport/headers.ts +46 -0
  278. package/src/validation/requestBody.ts +60 -0
  279. package/src/validation/uuid.ts +31 -0
  280. package/src/wire/accountLimitsUsagePayload.ts +182 -0
  281. package/src/wire/accountPayload.ts +108 -0
  282. package/src/wire/achPayload.ts +98 -0
  283. package/src/wire/addressObjectPayload.ts +64 -0
  284. package/src/wire/daaStatusCodes.ts +69 -0
  285. package/src/wire/dataEnvelope.ts +80 -0
  286. package/src/wire/depositPayload.ts +186 -0
  287. package/src/wire/deviceContextPayload.ts +58 -0
  288. package/src/wire/deviceRegistrationResultPayload.ts +153 -0
  289. package/src/wire/errorEnvelope.ts +87 -0
  290. package/src/wire/fiatAccountPayload.ts +112 -0
  291. package/src/wire/instant.ts +93 -0
  292. package/src/wire/jsonNumber.ts +33 -0
  293. package/src/wire/moneyPayload.ts +55 -0
  294. package/src/wire/paginationLinks.ts +204 -0
  295. package/src/wire/payload.ts +146 -0
  296. package/src/wire/pendingRegistrationPayload.ts +75 -0
  297. package/src/wire/socialLoginRequestPayload.ts +89 -0
  298. package/src/wire/transactionPayload.ts +145 -0
  299. package/src/wire/transferPayload.ts +249 -0
  300. package/src/wire/wireEnums.ts +74 -0
  301. package/src/wire/wirePayload.ts +160 -0
  302. package/src/wire/withdrawalPayload.ts +219 -0
  303. package/testing.d.ts +19 -0
  304. package/testing.js +25 -0
@@ -0,0 +1,405 @@
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
+
19
+ import { BankAddress, BillingDetails } from './FiatAccount'
20
+ import type { FiatAccountStatus } from './FiatAccount'
21
+ import { REDACTED } from './redaction'
22
+
23
+ // `WireSummary`, `Wire`, and `WireInstruction` are the exact component names
24
+ // the canonical public Accounts OpenAPI uses, not DAA-owned aliases.
25
+ // `WireInstructionBeneficiary` and `WireInstructionBeneficiaryBank` are that
26
+ // same schema's own nested type names for `WireInstruction`'s
27
+ // `beneficiary`/`beneficiaryBank` properties.
28
+
29
+ /** One `transferTypesInfo` entry: the currencies a supported transfer type accepts. */
30
+ export type TransferTypeInfo = Readonly<{
31
+ currencies: readonly string[]
32
+ }>
33
+
34
+ /**
35
+ * Circle's own receiving identity on a wire instruction — who the wire is
36
+ * addressed to, not the fiat-account holder. Not redacted: this is Circle's
37
+ * published receiving name and address, the same information the wire
38
+ * reference text itself carries, not the restricted PII this SDK redacts
39
+ * (`billingDetails`, `bankAddress`, `routingNumber`).
40
+ */
41
+ export type WireInstructionBeneficiary = Readonly<{
42
+ name: string | null
43
+ address1: string | null
44
+ address2: string | null
45
+ }>
46
+
47
+ /**
48
+ * The receiving bank's own account details for a wire instruction —
49
+ * `routingNumber` and `accountNumber` among them, which are restricted PII.
50
+ * Redacted the same way
51
+ * `models/FiatAccount.ts`'s `BillingDetails`/`BankAddress` are.
52
+ */
53
+ export class WireInstructionBeneficiaryBank {
54
+ readonly #name: string | null
55
+ readonly #swiftCode: string | null
56
+ readonly #routingNumber: string | null
57
+ readonly #accountNumber: string | null
58
+ readonly #currency: string | null
59
+ readonly #address: string | null
60
+ readonly #city: string | null
61
+ readonly #postalCode: string | null
62
+ readonly #country: string | null
63
+
64
+ /** @internal Constructed only by the SDK's response decoder. */
65
+ constructor(fields: {
66
+ readonly name: string | null
67
+ readonly swiftCode: string | null
68
+ readonly routingNumber: string | null
69
+ readonly accountNumber: string | null
70
+ readonly currency: string | null
71
+ readonly address: string | null
72
+ readonly city: string | null
73
+ readonly postalCode: string | null
74
+ readonly country: string | null
75
+ }) {
76
+ this.#name = fields.name
77
+ this.#swiftCode = fields.swiftCode
78
+ this.#routingNumber = fields.routingNumber
79
+ this.#accountNumber = fields.accountNumber
80
+ this.#currency = fields.currency
81
+ this.#address = fields.address
82
+ this.#city = fields.city
83
+ this.#postalCode = fields.postalCode
84
+ this.#country = fields.country
85
+ Object.freeze(this)
86
+ }
87
+
88
+ get name(): string | null {
89
+ return this.#name
90
+ }
91
+
92
+ get swiftCode(): string | null {
93
+ return this.#swiftCode
94
+ }
95
+
96
+ get routingNumber(): string | null {
97
+ return this.#routingNumber
98
+ }
99
+
100
+ get accountNumber(): string | null {
101
+ return this.#accountNumber
102
+ }
103
+
104
+ get currency(): string | null {
105
+ return this.#currency
106
+ }
107
+
108
+ get address(): string | null {
109
+ return this.#address
110
+ }
111
+
112
+ get city(): string | null {
113
+ return this.#city
114
+ }
115
+
116
+ get postalCode(): string | null {
117
+ return this.#postalCode
118
+ }
119
+
120
+ get country(): string | null {
121
+ return this.#country
122
+ }
123
+
124
+ toJSON(): string {
125
+ return this.toString()
126
+ }
127
+
128
+ toString(): string {
129
+ return `WireInstructionBeneficiaryBank(${REDACTED})`
130
+ }
131
+ }
132
+
133
+ /**
134
+ * Circle receiving instructions for a wire fiat account (`GET
135
+ * /v1/banks/wires/{id}/instructions`).
136
+ *
137
+ * Deliberately a separate SDK method and response type from {@link Wire}: the
138
+ * account resource and its funding instructions are separate. This is a plain
139
+ * typed read of the public instruction route, which returns Circle's receiving
140
+ * instructions; it does not resolve a self-custody pass-through account.
141
+ */
142
+ export class WireInstruction {
143
+ readonly trackingRef: string | null
144
+ readonly beneficiary: WireInstructionBeneficiary | null
145
+ readonly virtualAccountEnabled: boolean | null
146
+
147
+ readonly #beneficiaryBank: WireInstructionBeneficiaryBank | null
148
+
149
+ /** @internal Constructed only by the SDK's response decoder. */
150
+ constructor(fields: {
151
+ trackingRef: string | null
152
+ beneficiary: WireInstructionBeneficiary | null
153
+ beneficiaryBank: WireInstructionBeneficiaryBank | null
154
+ virtualAccountEnabled: boolean | null
155
+ }) {
156
+ this.trackingRef = fields.trackingRef
157
+ this.beneficiary = fields.beneficiary
158
+ this.virtualAccountEnabled = fields.virtualAccountEnabled
159
+ this.#beneficiaryBank = fields.beneficiaryBank
160
+ Object.freeze(this)
161
+ }
162
+
163
+ get beneficiaryBank(): WireInstructionBeneficiaryBank | null {
164
+ return this.#beneficiaryBank
165
+ }
166
+
167
+ toJSON(): {
168
+ trackingRef: string | null
169
+ beneficiary: WireInstructionBeneficiary | null
170
+ beneficiaryBank: string | null
171
+ virtualAccountEnabled: boolean | null
172
+ } {
173
+ return {
174
+ trackingRef: this.trackingRef,
175
+ beneficiary: this.beneficiary,
176
+ beneficiaryBank: this.#beneficiaryBank === null ? null : REDACTED,
177
+ virtualAccountEnabled: this.virtualAccountEnabled,
178
+ }
179
+ }
180
+
181
+ toString(): string {
182
+ return (
183
+ `WireInstruction(trackingRef=${this.trackingRef ?? 'null'}, ` +
184
+ `beneficiaryBank=${this.#beneficiaryBank === null ? 'null' : REDACTED})`
185
+ )
186
+ }
187
+ }
188
+
189
+ /**
190
+ * A wire bank account summary (`GET /v1/banks/wires` collection entry).
191
+ *
192
+ * `billingDetails` and `bankAddress` are private, redacted fields — see
193
+ * `models/FiatAccount.ts`. `ffcMemo` is private and redacted the same way: it
194
+ * is not one of the named restricted fields, but a for-further-credit memo can
195
+ * carry the end beneficiary's name, which is the same personal data
196
+ * `billingDetails.name` holds. Every other field is public:
197
+ * `id`/`status`/`description` (bank name plus last four
198
+ * digits)/`trackingRef`/`fingerprint` are what a caller needs to identify and
199
+ * select a fiat account without exposing the underlying bank details.
200
+ */
201
+ export class WireSummary {
202
+ readonly id: string
203
+ readonly type: string | null
204
+ readonly status: FiatAccountStatus
205
+ readonly description: string
206
+ readonly trackingRef: string
207
+ readonly fingerprint: string
208
+ readonly virtualAccountEnabled: boolean | null
209
+ readonly createDate: string
210
+ readonly updateDate: string
211
+
212
+ readonly #billingDetails: BillingDetails
213
+ readonly #bankAddress: BankAddress | null
214
+ readonly #ffcMemo: string | null
215
+
216
+ /** @internal Constructed only by the SDK's response decoder. */
217
+ constructor(fields: {
218
+ id: string
219
+ type: string | null
220
+ status: FiatAccountStatus
221
+ description: string
222
+ trackingRef: string
223
+ fingerprint: string
224
+ billingDetails: BillingDetails
225
+ bankAddress: BankAddress | null
226
+ virtualAccountEnabled: boolean | null
227
+ ffcMemo: string | null
228
+ createDate: string
229
+ updateDate: string
230
+ }) {
231
+ this.id = fields.id
232
+ this.type = fields.type
233
+ this.status = fields.status
234
+ this.description = fields.description
235
+ this.trackingRef = fields.trackingRef
236
+ this.fingerprint = fields.fingerprint
237
+ this.virtualAccountEnabled = fields.virtualAccountEnabled
238
+ this.createDate = fields.createDate
239
+ this.updateDate = fields.updateDate
240
+ this.#billingDetails = fields.billingDetails
241
+ this.#bankAddress = fields.bankAddress
242
+ this.#ffcMemo = fields.ffcMemo
243
+ Object.freeze(this)
244
+ }
245
+
246
+ get billingDetails(): BillingDetails {
247
+ return this.#billingDetails
248
+ }
249
+
250
+ get bankAddress(): BankAddress | null {
251
+ return this.#bankAddress
252
+ }
253
+
254
+ get ffcMemo(): string | null {
255
+ return this.#ffcMemo
256
+ }
257
+
258
+ toJSON(): {
259
+ id: string
260
+ type: string | null
261
+ status: FiatAccountStatus
262
+ description: string
263
+ trackingRef: string
264
+ fingerprint: string
265
+ billingDetails: string
266
+ bankAddress: string | null
267
+ virtualAccountEnabled: boolean | null
268
+ ffcMemo: string | null
269
+ createDate: string
270
+ updateDate: string
271
+ } {
272
+ return {
273
+ id: this.id,
274
+ type: this.type,
275
+ status: this.status,
276
+ description: this.description,
277
+ trackingRef: this.trackingRef,
278
+ fingerprint: this.fingerprint,
279
+ billingDetails: REDACTED,
280
+ bankAddress: this.#bankAddress === null ? null : REDACTED,
281
+ virtualAccountEnabled: this.virtualAccountEnabled,
282
+ ffcMemo: this.#ffcMemo === null ? null : REDACTED,
283
+ createDate: this.createDate,
284
+ updateDate: this.updateDate,
285
+ }
286
+ }
287
+
288
+ toString(): string {
289
+ return (
290
+ `WireSummary(id=${this.id}, status=${this.status.kind}, ` +
291
+ `billingDetails=${REDACTED}, bankAddress=${this.#bankAddress === null ? 'null' : REDACTED})`
292
+ )
293
+ }
294
+ }
295
+
296
+ /**
297
+ * A wire bank account (`GET /v1/banks/wires/{id}`).
298
+ *
299
+ * Carries every {@link WireSummary} field plus `transferTypesInfo`, which the
300
+ * list projection omits, and redacts `billingDetails`, `bankAddress`, and
301
+ * `ffcMemo` the same way. Deliberately a distinct SDK type from `WireSummary`
302
+ * rather than a subtype — fiat-account resources are distinct SDK methods and
303
+ * response types, and the two
304
+ * projections diverge only in this one additional field, not in a
305
+ * specialization relationship.
306
+ */
307
+ export class Wire {
308
+ readonly id: string
309
+ readonly type: string | null
310
+ readonly status: FiatAccountStatus
311
+ readonly description: string
312
+ readonly trackingRef: string
313
+ readonly fingerprint: string
314
+ readonly virtualAccountEnabled: boolean | null
315
+ readonly transferTypesInfo: Readonly<Record<string, TransferTypeInfo>> | null
316
+ readonly createDate: string
317
+ readonly updateDate: string
318
+
319
+ readonly #billingDetails: BillingDetails
320
+ readonly #bankAddress: BankAddress | null
321
+ readonly #ffcMemo: string | null
322
+
323
+ /** @internal Constructed only by the SDK's response decoder. */
324
+ constructor(fields: {
325
+ id: string
326
+ type: string | null
327
+ status: FiatAccountStatus
328
+ description: string
329
+ trackingRef: string
330
+ fingerprint: string
331
+ billingDetails: BillingDetails
332
+ bankAddress: BankAddress | null
333
+ virtualAccountEnabled: boolean | null
334
+ ffcMemo: string | null
335
+ transferTypesInfo: Readonly<Record<string, TransferTypeInfo>> | null
336
+ createDate: string
337
+ updateDate: string
338
+ }) {
339
+ this.id = fields.id
340
+ this.type = fields.type
341
+ this.status = fields.status
342
+ this.description = fields.description
343
+ this.trackingRef = fields.trackingRef
344
+ this.fingerprint = fields.fingerprint
345
+ this.virtualAccountEnabled = fields.virtualAccountEnabled
346
+ this.transferTypesInfo = fields.transferTypesInfo
347
+ this.createDate = fields.createDate
348
+ this.updateDate = fields.updateDate
349
+ this.#billingDetails = fields.billingDetails
350
+ this.#bankAddress = fields.bankAddress
351
+ this.#ffcMemo = fields.ffcMemo
352
+ Object.freeze(this)
353
+ }
354
+
355
+ get billingDetails(): BillingDetails {
356
+ return this.#billingDetails
357
+ }
358
+
359
+ get bankAddress(): BankAddress | null {
360
+ return this.#bankAddress
361
+ }
362
+
363
+ get ffcMemo(): string | null {
364
+ return this.#ffcMemo
365
+ }
366
+
367
+ toJSON(): {
368
+ id: string
369
+ type: string | null
370
+ status: FiatAccountStatus
371
+ description: string
372
+ trackingRef: string
373
+ fingerprint: string
374
+ billingDetails: string
375
+ bankAddress: string | null
376
+ virtualAccountEnabled: boolean | null
377
+ ffcMemo: string | null
378
+ transferTypesInfo: Readonly<Record<string, TransferTypeInfo>> | null
379
+ createDate: string
380
+ updateDate: string
381
+ } {
382
+ return {
383
+ id: this.id,
384
+ type: this.type,
385
+ status: this.status,
386
+ description: this.description,
387
+ trackingRef: this.trackingRef,
388
+ fingerprint: this.fingerprint,
389
+ billingDetails: REDACTED,
390
+ bankAddress: this.#bankAddress === null ? null : REDACTED,
391
+ virtualAccountEnabled: this.virtualAccountEnabled,
392
+ ffcMemo: this.#ffcMemo === null ? null : REDACTED,
393
+ transferTypesInfo: this.transferTypesInfo,
394
+ createDate: this.createDate,
395
+ updateDate: this.updateDate,
396
+ }
397
+ }
398
+
399
+ toString(): string {
400
+ return (
401
+ `Wire(id=${this.id}, status=${this.status.kind}, ` +
402
+ `billingDetails=${REDACTED}, bankAddress=${this.#bankAddress === null ? 'null' : REDACTED})`
403
+ )
404
+ }
405
+ }
@@ -0,0 +1,283 @@
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
+
19
+ import type { Money } from './Money'
20
+ import { REDACTED } from './redaction'
21
+
22
+ export type WithdrawalStatus =
23
+ | { readonly kind: 'pending' }
24
+ | { readonly kind: 'complete' }
25
+ | { readonly kind: 'failed' }
26
+ | { readonly kind: 'unrecognized'; readonly rawValue: string | null }
27
+
28
+ export type WithdrawalErrorCode =
29
+ | { readonly kind: 'insufficient_funds' }
30
+ | { readonly kind: 'transaction_denied' }
31
+ | { readonly kind: 'transaction_failed' }
32
+ | { readonly kind: 'transaction_returned' }
33
+ | { readonly kind: 'bank_transaction_error' }
34
+ | { readonly kind: 'fiat_account_limit_exceeded' }
35
+ | { readonly kind: 'invalid_bank_account_number' }
36
+ | { readonly kind: 'invalid_ach_rtn' }
37
+ | { readonly kind: 'invalid_wire_rtn' }
38
+ | { readonly kind: 'vendor_inactive' }
39
+ | { readonly kind: 'payout_canceled' }
40
+ | { readonly kind: 'invalid_travel_rule_identity' }
41
+ | { readonly kind: 'intermediary_bank_required' }
42
+ | { readonly kind: 'sen_not_supported' }
43
+ | { readonly kind: 'unrecognized'; readonly rawValue: string | null }
44
+
45
+ export type WithdrawalDestinationType =
46
+ | { readonly kind: 'wire' }
47
+ | { readonly kind: 'ach' }
48
+ | { readonly kind: 'unrecognized'; readonly rawValue: string | null }
49
+
50
+ export type WithdrawalDestination = Readonly<{
51
+ type: WithdrawalDestinationType
52
+ id: string
53
+ name: string | null
54
+ }>
55
+
56
+ export type WithdrawalRiskEvaluation = Readonly<{
57
+ decision: string | null
58
+ reason: string | null
59
+ }>
60
+
61
+ export type WithdrawalPolicyEvaluation = Readonly<{ status: string }>
62
+
63
+ /** Target fiat amount. Unlike `Money`, its service-side amount is deliberately optional. */
64
+ export class WithdrawalToAmount {
65
+ readonly currency: string | null
66
+ readonly #amount: string | null
67
+
68
+ /** @internal Constructed only by the response decoder. */
69
+ constructor(amount: string | null, currency: string | null) {
70
+ this.#amount = amount
71
+ this.currency = currency
72
+ Object.freeze(this)
73
+ }
74
+
75
+ get amount(): string | null {
76
+ return this.#amount
77
+ }
78
+
79
+ toJSON(): { readonly amount: string | null; readonly currency: string | null } {
80
+ return { amount: this.#amount === null ? null : REDACTED, currency: this.currency }
81
+ }
82
+
83
+ toString(): string {
84
+ return `WithdrawalToAmount(amount=${this.#amount === null ? 'null' : REDACTED}, currency=${this.currency})`
85
+ }
86
+ }
87
+
88
+ export type WithdrawalAdjustments = Readonly<{
89
+ fxCredit: Money | null
90
+ fxDebit: Money | null
91
+ }>
92
+
93
+ export type WithdrawalReturn = Readonly<{
94
+ id: string | null
95
+ payoutId: string | null
96
+ amount: Money | null
97
+ fees: Money | null
98
+ reason: string | null
99
+ status: WithdrawalStatus | null
100
+ createDate: string | null
101
+ updateDate: string | null
102
+ }>
103
+
104
+ export type WithdrawalSweepStatus =
105
+ | { readonly kind: 'pending' }
106
+ | { readonly kind: 'complete' }
107
+ | { readonly kind: 'failed' }
108
+ | { readonly kind: 'skipped' }
109
+ | { readonly kind: 'unrecognized'; readonly rawValue: string | null }
110
+
111
+ export type WithdrawalSubAccountSweep = Readonly<{
112
+ subAccountId: string | null
113
+ amount: Money | null
114
+ status: WithdrawalSweepStatus | null
115
+ }>
116
+
117
+ export type WithdrawalDetailRendering = Readonly<{
118
+ id: string
119
+ sourceAccountId: string
120
+ destination: WithdrawalDestination
121
+ amount: ReturnType<Money['toJSON']>
122
+ toAmount: WithdrawalToAmount | null
123
+ fees: ReturnType<Money['toJSON']> | null
124
+ status: WithdrawalStatus
125
+ trackingRef: string | null
126
+ errorCode: WithdrawalErrorCode | null
127
+ externalRef: string | null
128
+ riskEvaluation: WithdrawalRiskEvaluation | null
129
+ adjustments: string
130
+ return: string
131
+ customerExternalRef: string | null
132
+ burnAll: boolean | null
133
+ subAccountSweeps: string
134
+ createDate: string
135
+ updateDate: string | null
136
+ policyEvaluation: WithdrawalPolicyEvaluation | null
137
+ }>
138
+
139
+ /**
140
+ * GET-only DAA withdrawal projection.
141
+ *
142
+ * The guaranteed core follows the service's two read paths, not the generated
143
+ * schema: `id`, `sourceAccountId`, `destination`, `amount`, `status`, and
144
+ * `createDate` are produced by both payout-backed and stored-withdrawal reads.
145
+ * Enrichment is omitted from the response whenever unavailable. Amounts plus
146
+ * bank/customer references are private so object inspection, spread, and
147
+ * enumeration cannot disclose them.
148
+ */
149
+ export class WithdrawalDetail {
150
+ readonly id: string
151
+ readonly sourceAccountId: string
152
+ readonly destination: WithdrawalDestination
153
+ readonly status: WithdrawalStatus
154
+ readonly trackingRef: string | null
155
+ readonly errorCode: WithdrawalErrorCode | null
156
+ readonly riskEvaluation: WithdrawalRiskEvaluation | null
157
+ readonly burnAll: boolean | null
158
+ readonly createDate: string
159
+ readonly updateDate: string | null
160
+ readonly policyEvaluation: WithdrawalPolicyEvaluation | null
161
+
162
+ readonly #amount: Money
163
+ readonly #toAmount: WithdrawalToAmount | null
164
+ readonly #fees: Money | null
165
+ readonly #externalRef: string | null
166
+ readonly #adjustments: WithdrawalAdjustments | null
167
+ readonly #returnObject: WithdrawalReturn | null
168
+ readonly #customerExternalRef: string | null
169
+ readonly #subAccountSweeps: readonly WithdrawalSubAccountSweep[]
170
+
171
+ /** @internal Constructed only by the response decoder. */
172
+ constructor(fields: {
173
+ id: string
174
+ sourceAccountId: string
175
+ destination: WithdrawalDestination
176
+ amount: Money
177
+ toAmount: WithdrawalToAmount | null
178
+ fees: Money | null
179
+ status: WithdrawalStatus
180
+ trackingRef: string | null
181
+ errorCode: WithdrawalErrorCode | null
182
+ externalRef: string | null
183
+ riskEvaluation: WithdrawalRiskEvaluation | null
184
+ adjustments: WithdrawalAdjustments | null
185
+ returnObject: WithdrawalReturn | null
186
+ customerExternalRef: string | null
187
+ burnAll: boolean | null
188
+ subAccountSweeps: readonly WithdrawalSubAccountSweep[]
189
+ createDate: string
190
+ updateDate: string | null
191
+ policyEvaluation: WithdrawalPolicyEvaluation | null
192
+ }) {
193
+ this.id = fields.id
194
+ this.sourceAccountId = fields.sourceAccountId
195
+ this.destination = fields.destination
196
+ this.status = fields.status
197
+ this.trackingRef = fields.trackingRef
198
+ this.errorCode = fields.errorCode
199
+ this.riskEvaluation = fields.riskEvaluation
200
+ this.burnAll = fields.burnAll
201
+ this.createDate = fields.createDate
202
+ this.updateDate = fields.updateDate
203
+ this.policyEvaluation = fields.policyEvaluation
204
+ this.#amount = fields.amount
205
+ this.#toAmount = fields.toAmount
206
+ this.#fees = fields.fees
207
+ this.#externalRef = fields.externalRef
208
+ this.#adjustments = fields.adjustments
209
+ this.#returnObject = fields.returnObject
210
+ this.#customerExternalRef = fields.customerExternalRef
211
+ this.#subAccountSweeps = Object.freeze(fields.subAccountSweeps.slice())
212
+ Object.freeze(this)
213
+ }
214
+
215
+ get amount(): Money {
216
+ return this.#amount
217
+ }
218
+
219
+ get toAmount(): WithdrawalToAmount | null {
220
+ return this.#toAmount
221
+ }
222
+
223
+ get fees(): Money | null {
224
+ return this.#fees
225
+ }
226
+
227
+ get externalRef(): string | null {
228
+ return this.#externalRef
229
+ }
230
+
231
+ get adjustments(): WithdrawalAdjustments | null {
232
+ return this.#adjustments
233
+ }
234
+
235
+ get returnObject(): WithdrawalReturn | null {
236
+ return this.#returnObject
237
+ }
238
+
239
+ get customerExternalRef(): string | null {
240
+ return this.#customerExternalRef
241
+ }
242
+
243
+ get subAccountSweeps(): readonly WithdrawalSubAccountSweep[] {
244
+ return this.#subAccountSweeps
245
+ }
246
+
247
+ toJSON(): WithdrawalDetailRendering {
248
+ return {
249
+ id: this.id,
250
+ sourceAccountId: this.sourceAccountId,
251
+ destination: this.destination,
252
+ amount: this.#amount.toJSON(),
253
+ toAmount: this.#toAmount,
254
+ fees: this.#fees?.toJSON() ?? null,
255
+ status: this.status,
256
+ trackingRef: this.trackingRef,
257
+ errorCode: this.errorCode,
258
+ externalRef: this.#externalRef === null ? null : REDACTED,
259
+ riskEvaluation: this.riskEvaluation,
260
+ adjustments: `${this.#adjustments === null ? 0 : 1} entry`,
261
+ return: `${this.#returnObject === null ? 0 : 1} entry`,
262
+ customerExternalRef: this.#customerExternalRef === null ? null : REDACTED,
263
+ burnAll: this.burnAll,
264
+ subAccountSweeps: `${this.#subAccountSweeps.length} entries`,
265
+ createDate: this.createDate,
266
+ updateDate: this.updateDate,
267
+ policyEvaluation: this.policyEvaluation,
268
+ }
269
+ }
270
+
271
+ toString(): string {
272
+ return (
273
+ `WithdrawalDetail(id=${this.id}, sourceAccountId=${this.sourceAccountId}, ` +
274
+ `status=${this.status.kind}, amount=${this.#amount.toString()}, ` +
275
+ `fees=${this.#fees === null ? 'null' : this.#fees.toString()}, ` +
276
+ `externalRef=${this.#externalRef === null ? 'null' : REDACTED}, ` +
277
+ `customerExternalRef=${this.#customerExternalRef === null ? 'null' : REDACTED}, ` +
278
+ `adjustments=${this.#adjustments === null ? 0 : 1} entry, ` +
279
+ `return=${this.#returnObject === null ? 0 : 1} entry, ` +
280
+ `subAccountSweeps=${this.#subAccountSweeps.length} entries)`
281
+ )
282
+ }
283
+ }
@@ -0,0 +1,22 @@
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
+
19
+ // The one spelling of a redacted value, so a model cannot half-redact and a test
20
+ // cannot pass against a different placeholder than the one production renders.
21
+
22
+ export const REDACTED = '<redacted>'