@augustusbank/typescript-sdk 0.21.0 → 0.22.1

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 (216) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/client.d.mts +12 -6
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +12 -6
  5. package/client.d.ts.map +1 -1
  6. package/client.js +6 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +6 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/account-holders.d.mts +1555 -1184
  12. package/resources/account-holders.d.mts.map +1 -1
  13. package/resources/account-holders.d.ts +1555 -1184
  14. package/resources/account-holders.d.ts.map +1 -1
  15. package/resources/account-holders.js +59 -0
  16. package/resources/account-holders.js.map +1 -1
  17. package/resources/account-holders.mjs +59 -0
  18. package/resources/account-holders.mjs.map +1 -1
  19. package/resources/account-programs.d.mts +22 -17
  20. package/resources/account-programs.d.mts.map +1 -1
  21. package/resources/account-programs.d.ts +22 -17
  22. package/resources/account-programs.d.ts.map +1 -1
  23. package/resources/account-programs.js +2 -2
  24. package/resources/account-programs.js.map +1 -1
  25. package/resources/account-programs.mjs +2 -2
  26. package/resources/account-programs.mjs.map +1 -1
  27. package/resources/accounts.d.mts +226 -48
  28. package/resources/accounts.d.mts.map +1 -1
  29. package/resources/accounts.d.ts +226 -48
  30. package/resources/accounts.d.ts.map +1 -1
  31. package/resources/accounts.js +55 -2
  32. package/resources/accounts.js.map +1 -1
  33. package/resources/accounts.mjs +55 -2
  34. package/resources/accounts.mjs.map +1 -1
  35. package/resources/api-keys.d.mts +1 -1
  36. package/resources/api-keys.d.mts.map +1 -1
  37. package/resources/api-keys.d.ts +1 -1
  38. package/resources/api-keys.d.ts.map +1 -1
  39. package/resources/api-versions.d.mts +3 -0
  40. package/resources/api-versions.d.mts.map +1 -1
  41. package/resources/api-versions.d.ts +3 -0
  42. package/resources/api-versions.d.ts.map +1 -1
  43. package/resources/conversions.d.mts +36 -81
  44. package/resources/conversions.d.mts.map +1 -1
  45. package/resources/conversions.d.ts +36 -81
  46. package/resources/conversions.d.ts.map +1 -1
  47. package/resources/conversions.js +25 -1
  48. package/resources/conversions.js.map +1 -1
  49. package/resources/conversions.mjs +25 -1
  50. package/resources/conversions.mjs.map +1 -1
  51. package/resources/counterparties.d.mts +1042 -0
  52. package/resources/counterparties.d.mts.map +1 -0
  53. package/resources/counterparties.d.ts +1042 -0
  54. package/resources/counterparties.d.ts.map +1 -0
  55. package/resources/counterparties.js +45 -0
  56. package/resources/counterparties.js.map +1 -0
  57. package/resources/counterparties.mjs +41 -0
  58. package/resources/counterparties.mjs.map +1 -0
  59. package/resources/deposits.d.mts +48 -186
  60. package/resources/deposits.d.mts.map +1 -1
  61. package/resources/deposits.d.ts +48 -186
  62. package/resources/deposits.d.ts.map +1 -1
  63. package/resources/events.d.mts +3 -3
  64. package/resources/events.d.mts.map +1 -1
  65. package/resources/events.d.ts +3 -3
  66. package/resources/events.d.ts.map +1 -1
  67. package/resources/index.d.mts +5 -3
  68. package/resources/index.d.mts.map +1 -1
  69. package/resources/index.d.ts +5 -3
  70. package/resources/index.d.ts.map +1 -1
  71. package/resources/index.js +5 -1
  72. package/resources/index.js.map +1 -1
  73. package/resources/index.mjs +2 -0
  74. package/resources/index.mjs.map +1 -1
  75. package/resources/payouts.d.mts +133 -335
  76. package/resources/payouts.d.mts.map +1 -1
  77. package/resources/payouts.d.ts +133 -335
  78. package/resources/payouts.d.ts.map +1 -1
  79. package/resources/payouts.js +25 -0
  80. package/resources/payouts.js.map +1 -1
  81. package/resources/payouts.mjs +25 -0
  82. package/resources/payouts.mjs.map +1 -1
  83. package/resources/quotes/indicative.d.mts +7 -11
  84. package/resources/quotes/indicative.d.mts.map +1 -1
  85. package/resources/quotes/indicative.d.ts +7 -11
  86. package/resources/quotes/indicative.d.ts.map +1 -1
  87. package/resources/quotes/quotes.d.mts +4 -8
  88. package/resources/quotes/quotes.d.mts.map +1 -1
  89. package/resources/quotes/quotes.d.ts +4 -8
  90. package/resources/quotes/quotes.d.ts.map +1 -1
  91. package/resources/quotes/quotes.js.map +1 -1
  92. package/resources/quotes/quotes.mjs.map +1 -1
  93. package/resources/returns.d.mts +84 -39
  94. package/resources/returns.d.mts.map +1 -1
  95. package/resources/returns.d.ts +84 -39
  96. package/resources/returns.d.ts.map +1 -1
  97. package/resources/returns.js +22 -0
  98. package/resources/returns.js.map +1 -1
  99. package/resources/returns.mjs +22 -0
  100. package/resources/returns.mjs.map +1 -1
  101. package/resources/scopes.d.mts +4 -1
  102. package/resources/scopes.d.mts.map +1 -1
  103. package/resources/scopes.d.ts +4 -1
  104. package/resources/scopes.d.ts.map +1 -1
  105. package/resources/simulations/account-programs.d.mts +215 -0
  106. package/resources/simulations/account-programs.d.mts.map +1 -0
  107. package/resources/simulations/account-programs.d.ts +215 -0
  108. package/resources/simulations/account-programs.d.ts.map +1 -0
  109. package/resources/simulations/account-programs.js +96 -0
  110. package/resources/simulations/account-programs.js.map +1 -0
  111. package/resources/simulations/account-programs.mjs +92 -0
  112. package/resources/simulations/account-programs.mjs.map +1 -0
  113. package/resources/simulations/accounts.d.mts +209 -0
  114. package/resources/simulations/accounts.d.mts.map +1 -0
  115. package/resources/simulations/accounts.d.ts +209 -0
  116. package/resources/simulations/accounts.d.ts.map +1 -0
  117. package/resources/simulations/accounts.js +90 -0
  118. package/resources/simulations/accounts.js.map +1 -0
  119. package/resources/simulations/accounts.mjs +86 -0
  120. package/resources/simulations/accounts.mjs.map +1 -0
  121. package/resources/simulations/conversions.d.mts +54 -0
  122. package/resources/simulations/conversions.d.mts.map +1 -0
  123. package/resources/simulations/conversions.d.ts +54 -0
  124. package/resources/simulations/conversions.d.ts.map +1 -0
  125. package/resources/simulations/conversions.js +39 -0
  126. package/resources/simulations/conversions.js.map +1 -0
  127. package/resources/simulations/conversions.mjs +35 -0
  128. package/resources/simulations/conversions.mjs.map +1 -0
  129. package/resources/simulations/deposits.d.mts +202 -0
  130. package/resources/simulations/deposits.d.mts.map +1 -0
  131. package/resources/simulations/deposits.d.ts +202 -0
  132. package/resources/simulations/deposits.d.ts.map +1 -0
  133. package/resources/simulations/deposits.js +25 -0
  134. package/resources/simulations/deposits.js.map +1 -0
  135. package/resources/simulations/deposits.mjs +21 -0
  136. package/resources/simulations/deposits.mjs.map +1 -0
  137. package/resources/simulations/index.d.mts +7 -0
  138. package/resources/simulations/index.d.mts.map +1 -0
  139. package/resources/simulations/index.d.ts +7 -0
  140. package/resources/simulations/index.d.ts.map +1 -0
  141. package/resources/simulations/index.js +17 -0
  142. package/resources/simulations/index.js.map +1 -0
  143. package/resources/simulations/index.mjs +8 -0
  144. package/resources/simulations/index.mjs.map +1 -0
  145. package/resources/simulations/payouts.d.mts +62 -0
  146. package/resources/simulations/payouts.d.mts.map +1 -0
  147. package/resources/simulations/payouts.d.ts +62 -0
  148. package/resources/simulations/payouts.d.ts.map +1 -0
  149. package/resources/simulations/payouts.js +39 -0
  150. package/resources/simulations/payouts.js.map +1 -0
  151. package/resources/simulations/payouts.mjs +35 -0
  152. package/resources/simulations/payouts.mjs.map +1 -0
  153. package/resources/simulations/simulations.d.mts +26 -0
  154. package/resources/simulations/simulations.d.mts.map +1 -0
  155. package/resources/simulations/simulations.d.ts +26 -0
  156. package/resources/simulations/simulations.d.ts.map +1 -0
  157. package/resources/simulations/simulations.js +33 -0
  158. package/resources/simulations/simulations.js.map +1 -0
  159. package/resources/simulations/simulations.mjs +28 -0
  160. package/resources/simulations/simulations.mjs.map +1 -0
  161. package/resources/simulations.d.mts +2 -0
  162. package/resources/simulations.d.mts.map +1 -0
  163. package/resources/simulations.d.ts +2 -0
  164. package/resources/simulations.d.ts.map +1 -0
  165. package/resources/simulations.js +6 -0
  166. package/resources/simulations.js.map +1 -0
  167. package/resources/simulations.mjs +3 -0
  168. package/resources/simulations.mjs.map +1 -0
  169. package/resources/transactions.d.mts +342 -162
  170. package/resources/transactions.d.mts.map +1 -1
  171. package/resources/transactions.d.ts +342 -162
  172. package/resources/transactions.d.ts.map +1 -1
  173. package/resources/webhook-subscriptions.d.mts +61 -11
  174. package/resources/webhook-subscriptions.d.mts.map +1 -1
  175. package/resources/webhook-subscriptions.d.ts +61 -11
  176. package/resources/webhook-subscriptions.d.ts.map +1 -1
  177. package/resources/webhook-subscriptions.js +49 -0
  178. package/resources/webhook-subscriptions.js.map +1 -1
  179. package/resources/webhook-subscriptions.mjs +49 -0
  180. package/resources/webhook-subscriptions.mjs.map +1 -1
  181. package/resources/webhooks.d.mts +976 -978
  182. package/resources/webhooks.d.mts.map +1 -1
  183. package/resources/webhooks.d.ts +976 -978
  184. package/resources/webhooks.d.ts.map +1 -1
  185. package/src/client.ts +48 -8
  186. package/src/resources/account-holders.ts +1701 -1282
  187. package/src/resources/account-programs.ts +30 -19
  188. package/src/resources/accounts.ts +265 -50
  189. package/src/resources/api-keys.ts +3 -0
  190. package/src/resources/api-versions.ts +3 -0
  191. package/src/resources/conversions.ts +36 -93
  192. package/src/resources/counterparties.ts +3127 -0
  193. package/src/resources/deposits.ts +66 -269
  194. package/src/resources/events.ts +18 -12
  195. package/src/resources/index.ts +21 -4
  196. package/src/resources/payouts.ts +204 -439
  197. package/src/resources/quotes/indicative.ts +7 -12
  198. package/src/resources/quotes/quotes.ts +4 -9
  199. package/src/resources/returns.ts +144 -40
  200. package/src/resources/scopes.ts +7 -1
  201. package/src/resources/simulations/account-programs.ts +282 -0
  202. package/src/resources/simulations/accounts.ts +265 -0
  203. package/src/resources/simulations/conversions.ts +70 -0
  204. package/src/resources/simulations/deposits.ts +522 -0
  205. package/src/resources/simulations/index.ts +33 -0
  206. package/src/resources/simulations/payouts.ts +80 -0
  207. package/src/resources/simulations/simulations.ts +92 -0
  208. package/src/resources/simulations.ts +3 -0
  209. package/src/resources/transactions.ts +954 -206
  210. package/src/resources/webhook-subscriptions.ts +102 -36
  211. package/src/resources/webhooks.ts +1283 -1153
  212. package/src/version.ts +1 -1
  213. package/version.d.mts +1 -1
  214. package/version.d.ts +1 -1
  215. package/version.js +1 -1
  216. package/version.mjs +1 -1
@@ -33,29 +33,24 @@ export interface IndicativeRetrieveResponse {
33
33
  rate: string;
34
34
 
35
35
  /**
36
- * Source amount as a string decimal.
36
+ * Amount as a string decimal (e.g. "100.50").
37
37
  */
38
38
  source_amount: string;
39
39
 
40
40
  /**
41
- * Source currency code.
41
+ * Currency code (ISO 4217 or crypto).
42
42
  */
43
43
  source_currency: 'EUR' | 'GBP' | 'USD' | 'USDC' | 'BTC' | 'ETH' | 'SOL' | 'POL';
44
44
 
45
45
  /**
46
- * Target amount as a string decimal.
46
+ * Amount as a string decimal (e.g. "100.50").
47
47
  */
48
48
  target_amount: string;
49
49
 
50
50
  /**
51
- * Target currency code.
51
+ * Currency code (ISO 4217 or crypto).
52
52
  */
53
53
  target_currency: 'EUR' | 'GBP' | 'USD' | 'USDC' | 'BTC' | 'ETH' | 'SOL' | 'POL';
54
-
55
- /**
56
- * Venue the quote was fetched from.
57
- */
58
- venue: string;
59
54
  }
60
55
 
61
56
  export namespace IndicativeRetrieveResponse {
@@ -77,17 +72,17 @@ export namespace IndicativeRetrieveResponse {
77
72
 
78
73
  export interface IndicativeRetrieveParams {
79
74
  /**
80
- * Source currency code.
75
+ * Currency code (ISO 4217 or crypto).
81
76
  */
82
77
  source_currency: 'EUR' | 'GBP' | 'USD' | 'USDC' | 'BTC' | 'ETH' | 'SOL' | 'POL';
83
78
 
84
79
  /**
85
- * Target currency code.
80
+ * Currency code (ISO 4217 or crypto).
86
81
  */
87
82
  target_currency: 'EUR' | 'GBP' | 'USD' | 'USDC' | 'BTC' | 'ETH' | 'SOL' | 'POL';
88
83
 
89
84
  /**
90
- * Source amount as a string decimal. Defaults to 1 unit if omitted.
85
+ * Amount as a string decimal (e.g. "100.50").
91
86
  */
92
87
  source_amount?: string;
93
88
  }
@@ -45,12 +45,12 @@ export interface QuoteRetrieveResponse {
45
45
  funding_status: 'pending' | 'sent' | 'completed' | 'failed' | 'on_hold';
46
46
 
47
47
  /**
48
- * Source amount as a string decimal.
48
+ * Amount as a string decimal (e.g. "100.50").
49
49
  */
50
50
  source_amount: string;
51
51
 
52
52
  /**
53
- * Source currency code.
53
+ * Currency code (ISO 4217 or crypto).
54
54
  */
55
55
  source_currency: 'EUR' | 'GBP' | 'USD' | 'USDC' | 'BTC' | 'ETH' | 'SOL' | 'POL';
56
56
 
@@ -70,12 +70,12 @@ export interface QuoteRetrieveResponse {
70
70
  | 'failed';
71
71
 
72
72
  /**
73
- * Target amount as a string decimal.
73
+ * Amount as a string decimal (e.g. "100.50").
74
74
  */
75
75
  target_amount: string;
76
76
 
77
77
  /**
78
- * Target currency code.
78
+ * Currency code (ISO 4217 or crypto).
79
79
  */
80
80
  target_currency: 'EUR' | 'GBP' | 'USD' | 'USDC' | 'BTC' | 'ETH' | 'SOL' | 'POL';
81
81
 
@@ -88,11 +88,6 @@ export interface QuoteRetrieveResponse {
88
88
  * ISO 8601 UTC timestamp when the quote was last updated.
89
89
  */
90
90
  updated_at: string;
91
-
92
- /**
93
- * Execution venue (e.g. "kraken").
94
- */
95
- venue: string;
96
91
  }
97
92
 
98
93
  Quotes.Indicative = Indicative;
@@ -9,6 +9,13 @@ import { path } from '../internal/utils/path';
9
9
  export class Returns extends APIResource {
10
10
  /**
11
11
  * Initiates a return of funds from a deposit to the source.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const _return = await client.returns.create({
16
+ * deposit_id: '550e8400-e29b-41d4-a716-446655440004',
17
+ * });
18
+ * ```
12
19
  */
13
20
  create(body: ReturnCreateParams, options?: RequestOptions): APIPromise<ReturnCreateResponse> {
14
21
  return this._client.post('/v1/returns', { body, ...options });
@@ -16,6 +23,13 @@ export class Returns extends APIResource {
16
23
 
17
24
  /**
18
25
  * Retrieves a return by ID.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const _return = await client.returns.retrieve(
30
+ * '550e8400-e29b-41d4-a716-446655440005',
31
+ * );
32
+ * ```
19
33
  */
20
34
  retrieve(id: string, options?: RequestOptions): APIPromise<ReturnRetrieveResponse> {
21
35
  return this._client.get(path`/v1/returns/${id}`, options);
@@ -23,6 +37,14 @@ export class Returns extends APIResource {
23
37
 
24
38
  /**
25
39
  * Lists deposit returns for the merchant with cursor-based pagination.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * // Automatically fetches more pages as needed.
44
+ * for await (const returnListResponse of client.returns.list()) {
45
+ * // ...
46
+ * }
47
+ * ```
26
48
  */
27
49
  list(
28
50
  query: ReturnListParams | null | undefined = {},
@@ -46,12 +68,7 @@ export interface ReturnCreateResponse {
46
68
  amount: string;
47
69
 
48
70
  /**
49
- * ISO 8601 UTC timestamp when the return was created.
50
- */
51
- created_at: string;
52
-
53
- /**
54
- * Currency code (ISO 4217 currency code or crypto currency code).
71
+ * Currency code (ISO 4217 or crypto).
55
72
  */
56
73
  currency: 'EUR' | 'GBP' | 'USD' | 'USDC';
57
74
 
@@ -65,20 +82,53 @@ export interface ReturnCreateResponse {
65
82
  */
66
83
  failure: ReturnCreateResponse.Failure | null;
67
84
 
85
+ /**
86
+ * ISO 8601 UTC timestamp when the return was initiated.
87
+ */
88
+ initiated_at: string;
89
+
90
+ /**
91
+ * Payment scheme or blockchain used for the return, or null when unknown.
92
+ */
93
+ rail:
94
+ | 'sepa'
95
+ | 'sepa_instant'
96
+ | 'faster_payments'
97
+ | 'swift'
98
+ | 'internal'
99
+ | 'target'
100
+ | 'ach'
101
+ | 'fedwire'
102
+ | 'bitcoin'
103
+ | 'bitcoin_testnet4'
104
+ | 'ethereum'
105
+ | 'ethereum_sepolia'
106
+ | 'solana'
107
+ | 'solana_devnet'
108
+ | 'polygon'
109
+ | 'polygon_amoy'
110
+ | null;
111
+
112
+ /**
113
+ * ISO 8601 UTC timestamp when the return was sent.
114
+ */
115
+ sent_at: string | null;
116
+
68
117
  /**
69
118
  * Current status of the return.
70
119
  */
71
- status: 'pending' | 'paid' | 'failed' | 'returned';
120
+ status: 'initiated' | 'submitted' | 'sent' | 'failed' | 'returned';
72
121
 
73
122
  /**
74
- * Type of the resource.
123
+ * Transaction hash for crypto returns, or null when not known. Only blockchain
124
+ * rails support this field.
75
125
  */
76
- type: 'return';
126
+ tx_hash: string | null;
77
127
 
78
128
  /**
79
- * ISO 8601 UTC timestamp when the return was last updated.
129
+ * Resource type discriminator.
80
130
  */
81
- updated_at: string;
131
+ type: 'return';
82
132
  }
83
133
 
84
134
  export namespace ReturnCreateResponse {
@@ -94,6 +144,7 @@ export namespace ReturnCreateResponse {
94
144
  | 'account_blocked'
95
145
  | 'insufficient_funds'
96
146
  | 'invalid_account_format'
147
+ | 'invalid_routing_number'
97
148
  | 'invalid_instruction'
98
149
  | 'invalid_amount'
99
150
  | 'invalid_time'
@@ -129,12 +180,7 @@ export interface ReturnRetrieveResponse {
129
180
  amount: string;
130
181
 
131
182
  /**
132
- * ISO 8601 UTC timestamp when the return was created.
133
- */
134
- created_at: string;
135
-
136
- /**
137
- * Currency code (ISO 4217 currency code or crypto currency code).
183
+ * Currency code (ISO 4217 or crypto).
138
184
  */
139
185
  currency: 'EUR' | 'GBP' | 'USD' | 'USDC';
140
186
 
@@ -148,20 +194,53 @@ export interface ReturnRetrieveResponse {
148
194
  */
149
195
  failure: ReturnRetrieveResponse.Failure | null;
150
196
 
197
+ /**
198
+ * ISO 8601 UTC timestamp when the return was initiated.
199
+ */
200
+ initiated_at: string;
201
+
202
+ /**
203
+ * Payment scheme or blockchain used for the return, or null when unknown.
204
+ */
205
+ rail:
206
+ | 'sepa'
207
+ | 'sepa_instant'
208
+ | 'faster_payments'
209
+ | 'swift'
210
+ | 'internal'
211
+ | 'target'
212
+ | 'ach'
213
+ | 'fedwire'
214
+ | 'bitcoin'
215
+ | 'bitcoin_testnet4'
216
+ | 'ethereum'
217
+ | 'ethereum_sepolia'
218
+ | 'solana'
219
+ | 'solana_devnet'
220
+ | 'polygon'
221
+ | 'polygon_amoy'
222
+ | null;
223
+
224
+ /**
225
+ * ISO 8601 UTC timestamp when the return was sent.
226
+ */
227
+ sent_at: string | null;
228
+
151
229
  /**
152
230
  * Current status of the return.
153
231
  */
154
- status: 'pending' | 'paid' | 'failed' | 'returned';
232
+ status: 'initiated' | 'submitted' | 'sent' | 'failed' | 'returned';
155
233
 
156
234
  /**
157
- * Type of the resource.
235
+ * Transaction hash for crypto returns, or null when not known. Only blockchain
236
+ * rails support this field.
158
237
  */
159
- type: 'return';
238
+ tx_hash: string | null;
160
239
 
161
240
  /**
162
- * ISO 8601 UTC timestamp when the return was last updated.
241
+ * Resource type discriminator.
163
242
  */
164
- updated_at: string;
243
+ type: 'return';
165
244
  }
166
245
 
167
246
  export namespace ReturnRetrieveResponse {
@@ -177,6 +256,7 @@ export namespace ReturnRetrieveResponse {
177
256
  | 'account_blocked'
178
257
  | 'insufficient_funds'
179
258
  | 'invalid_account_format'
259
+ | 'invalid_routing_number'
180
260
  | 'invalid_instruction'
181
261
  | 'invalid_amount'
182
262
  | 'invalid_time'
@@ -212,12 +292,7 @@ export interface ReturnListResponse {
212
292
  amount: string;
213
293
 
214
294
  /**
215
- * ISO 8601 UTC timestamp when the return was created.
216
- */
217
- created_at: string;
218
-
219
- /**
220
- * Currency code (ISO 4217 currency code or crypto currency code).
295
+ * Currency code (ISO 4217 or crypto).
221
296
  */
222
297
  currency: 'EUR' | 'GBP' | 'USD' | 'USDC';
223
298
 
@@ -231,20 +306,53 @@ export interface ReturnListResponse {
231
306
  */
232
307
  failure: ReturnListResponse.Failure | null;
233
308
 
309
+ /**
310
+ * ISO 8601 UTC timestamp when the return was initiated.
311
+ */
312
+ initiated_at: string;
313
+
314
+ /**
315
+ * Payment scheme or blockchain used for the return, or null when unknown.
316
+ */
317
+ rail:
318
+ | 'sepa'
319
+ | 'sepa_instant'
320
+ | 'faster_payments'
321
+ | 'swift'
322
+ | 'internal'
323
+ | 'target'
324
+ | 'ach'
325
+ | 'fedwire'
326
+ | 'bitcoin'
327
+ | 'bitcoin_testnet4'
328
+ | 'ethereum'
329
+ | 'ethereum_sepolia'
330
+ | 'solana'
331
+ | 'solana_devnet'
332
+ | 'polygon'
333
+ | 'polygon_amoy'
334
+ | null;
335
+
336
+ /**
337
+ * ISO 8601 UTC timestamp when the return was sent.
338
+ */
339
+ sent_at: string | null;
340
+
234
341
  /**
235
342
  * Current status of the return.
236
343
  */
237
- status: 'pending' | 'paid' | 'failed' | 'returned';
344
+ status: 'initiated' | 'submitted' | 'sent' | 'failed' | 'returned';
238
345
 
239
346
  /**
240
- * Type of the resource.
347
+ * Transaction hash for crypto returns, or null when not known. Only blockchain
348
+ * rails support this field.
241
349
  */
242
- type: 'return';
350
+ tx_hash: string | null;
243
351
 
244
352
  /**
245
- * ISO 8601 UTC timestamp when the return was last updated.
353
+ * Resource type discriminator.
246
354
  */
247
- updated_at: string;
355
+ type: 'return';
248
356
  }
249
357
 
250
358
  export namespace ReturnListResponse {
@@ -260,6 +368,7 @@ export namespace ReturnListResponse {
260
368
  | 'account_blocked'
261
369
  | 'insufficient_funds'
262
370
  | 'invalid_account_format'
371
+ | 'invalid_routing_number'
263
372
  | 'invalid_instruction'
264
373
  | 'invalid_amount'
265
374
  | 'invalid_time'
@@ -288,11 +397,6 @@ export interface ReturnCreateParams {
288
397
  * Deposit to return funds from.
289
398
  */
290
399
  deposit_id: string;
291
-
292
- /**
293
- * Payment rail when the deposit allows multiple schemes.
294
- */
295
- rail?: 'sepa_instant' | 'sepa' | 'faster_payments';
296
400
  }
297
401
 
298
402
  export interface ReturnListParams extends CursorPageParams {
@@ -304,9 +408,9 @@ export interface ReturnListParams extends CursorPageParams {
304
408
  deposit_id?: string;
305
409
 
306
410
  /**
307
- * Current status of the return.
411
+ * Filter by return status.
308
412
  */
309
- status?: 'pending' | 'paid' | 'failed' | 'returned';
413
+ status?: 'initiated' | 'submitted' | 'sent' | 'failed' | 'returned';
310
414
  }
311
415
 
312
416
  export namespace ReturnListParams {
@@ -42,12 +42,15 @@ export namespace ScopeListResponse {
42
42
  | 'account_programs:read'
43
43
  | 'account_holders:read'
44
44
  | 'account_holders:write'
45
+ | 'counterparties:read'
46
+ | 'counterparties:write'
45
47
  | 'webhook_subscriptions:read'
46
48
  | 'webhook_subscriptions:write'
47
49
  | 'events:read'
48
50
  | 'webhook_deliveries:read'
49
51
  | 'webhook_deliveries:write'
50
- | 'transactions:read';
52
+ | 'transactions:read'
53
+ | 'simulations:write';
51
54
 
52
55
  /**
53
56
  * Action category.
@@ -74,6 +77,9 @@ export namespace ScopeListResponse {
74
77
  */
75
78
  resource: string;
76
79
 
80
+ /**
81
+ * Resource type discriminator.
82
+ */
77
83
  type: 'scope';
78
84
  }
79
85
  }
@@ -0,0 +1,282 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import { APIPromise } from '../../core/api-promise';
5
+ import { RequestOptions } from '../../internal/request-options';
6
+ import { path } from '../../internal/utils/path';
7
+
8
+ export class AccountPrograms extends APIResource {
9
+ /**
10
+ * Creates a Mock-US USD account program owned by the caller merchant. This
11
+ * endpoint is unavailable in live production.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const accountProgram =
16
+ * await client.simulations.accountPrograms.create({
17
+ * label: 'x',
18
+ * });
19
+ * ```
20
+ */
21
+ create(
22
+ body: AccountProgramCreateParams,
23
+ options?: RequestOptions,
24
+ ): APIPromise<AccountProgramCreateResponse> {
25
+ return this._client.post('/v1/simulations/account_programs', { body, ...options });
26
+ }
27
+
28
+ /**
29
+ * Closes an account program. All child accounts must be drained via the drain
30
+ * endpoint first. This endpoint is unavailable in live production.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const response =
35
+ * await client.simulations.accountPrograms.close(
36
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
37
+ * { reason: 'aml_risk_fraud' },
38
+ * );
39
+ * ```
40
+ */
41
+ close(
42
+ id: string,
43
+ body: AccountProgramCloseParams,
44
+ options?: RequestOptions,
45
+ ): APIPromise<AccountProgramCloseResponse> {
46
+ return this._client.post(path`/v1/simulations/account_programs/${id}/close`, { body, ...options });
47
+ }
48
+
49
+ /**
50
+ * Creates outbound payouts that drain the residual balance of every frozen account
51
+ * under the program to the provided destination. The program must be frozen. Every
52
+ * returned `payout_ids[i]` must be settled via
53
+ * `POST /v1/simulations/payouts/{id}/send` for the program balance to reach zero.
54
+ * This endpoint is unavailable in live production.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * const response =
59
+ * await client.simulations.accountPrograms.drain(
60
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
61
+ * {
62
+ * destination: {
63
+ * account_holder_name: 'Acme Sandbox Ltd.',
64
+ * iban: 'DE89370400440532013000',
65
+ * type: 'iban',
66
+ * },
67
+ * },
68
+ * );
69
+ * ```
70
+ */
71
+ drain(
72
+ id: string,
73
+ body: AccountProgramDrainParams,
74
+ options?: RequestOptions,
75
+ ): APIPromise<AccountProgramDrainResponse> {
76
+ return this._client.post(path`/v1/simulations/account_programs/${id}/drain`, { body, ...options });
77
+ }
78
+
79
+ /**
80
+ * Freezes an existing account program and its virtual accounts. This endpoint is
81
+ * unavailable in live production.
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * const response =
86
+ * await client.simulations.accountPrograms.freeze(
87
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
88
+ * );
89
+ * ```
90
+ */
91
+ freeze(id: string, options?: RequestOptions): APIPromise<AccountProgramFreezeResponse> {
92
+ return this._client.post(path`/v1/simulations/account_programs/${id}/freeze`, options);
93
+ }
94
+
95
+ /**
96
+ * Unfreezes an existing account program and its virtual accounts. This endpoint is
97
+ * unavailable in live production.
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * const response =
102
+ * await client.simulations.accountPrograms.unfreeze(
103
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
104
+ * );
105
+ * ```
106
+ */
107
+ unfreeze(id: string, options?: RequestOptions): APIPromise<AccountProgramUnfreezeResponse> {
108
+ return this._client.post(path`/v1/simulations/account_programs/${id}/unfreeze`, options);
109
+ }
110
+ }
111
+
112
+ export interface AccountProgramCreateResponse {
113
+ /**
114
+ * Account program whose lifecycle is being simulated.
115
+ */
116
+ account_program_id: string;
117
+
118
+ /**
119
+ * Resource type discriminator.
120
+ */
121
+ type: 'account_program_simulation';
122
+ }
123
+
124
+ export interface AccountProgramCloseResponse {
125
+ /**
126
+ * Account program whose lifecycle is being simulated.
127
+ */
128
+ account_program_id: string;
129
+
130
+ /**
131
+ * Resource type discriminator.
132
+ */
133
+ type: 'account_program_simulation';
134
+ }
135
+
136
+ export interface AccountProgramDrainResponse {
137
+ /**
138
+ * Account program whose lifecycle is being simulated.
139
+ */
140
+ account_program_id: string;
141
+
142
+ /**
143
+ * Payouts created by the drain. Feed each id to
144
+ * `POST /v1/simulations/payouts/{id}/send` to settle.
145
+ */
146
+ payout_ids: Array<string>;
147
+
148
+ /**
149
+ * Resource type discriminator.
150
+ */
151
+ type: 'account_program_simulation';
152
+ }
153
+
154
+ export interface AccountProgramFreezeResponse {
155
+ /**
156
+ * Account program whose lifecycle is being simulated.
157
+ */
158
+ account_program_id: string;
159
+
160
+ /**
161
+ * Resource type discriminator.
162
+ */
163
+ type: 'account_program_simulation';
164
+ }
165
+
166
+ export interface AccountProgramUnfreezeResponse {
167
+ /**
168
+ * Account program whose lifecycle is being simulated.
169
+ */
170
+ account_program_id: string;
171
+
172
+ /**
173
+ * Resource type discriminator.
174
+ */
175
+ type: 'account_program_simulation';
176
+ }
177
+
178
+ export interface AccountProgramCreateParams {
179
+ /**
180
+ * Human-readable label for the account program.
181
+ */
182
+ label: string;
183
+ }
184
+
185
+ export interface AccountProgramCloseParams {
186
+ /**
187
+ * Reason for closing the account program.
188
+ */
189
+ reason: 'aml_risk_fraud' | 'client_request';
190
+ }
191
+
192
+ export interface AccountProgramDrainParams {
193
+ /**
194
+ * Fiat financial address to which the residual balance of every frozen account
195
+ * under the program is drained.
196
+ */
197
+ destination:
198
+ | AccountProgramDrainParams.IbanFinancialAddressRequest
199
+ | AccountProgramDrainParams.SortCodeFinancialAddress
200
+ | AccountProgramDrainParams.AbaFinancialAddress;
201
+ }
202
+
203
+ export namespace AccountProgramDrainParams {
204
+ export interface IbanFinancialAddressRequest {
205
+ /**
206
+ * Name of the account holder.
207
+ */
208
+ account_holder_name: string;
209
+
210
+ /**
211
+ * International Bank Account Number.
212
+ */
213
+ iban: string;
214
+
215
+ /**
216
+ * Discriminator for IBAN financial address.
217
+ */
218
+ type: 'iban';
219
+
220
+ /**
221
+ * Bank Identifier Code. Optional; omit or send null if not provided.
222
+ */
223
+ bic?: string | null;
224
+ }
225
+
226
+ export interface SortCodeFinancialAddress {
227
+ /**
228
+ * Name of the account holder.
229
+ */
230
+ account_holder_name: string;
231
+
232
+ /**
233
+ * UK account number (8 digits).
234
+ */
235
+ account_number: string;
236
+
237
+ /**
238
+ * UK sort code (6 digits).
239
+ */
240
+ sort_code: string;
241
+
242
+ /**
243
+ * Discriminator for UK sort code financial address.
244
+ */
245
+ type: 'sort_code';
246
+ }
247
+
248
+ export interface AbaFinancialAddress {
249
+ /**
250
+ * Name of the account holder.
251
+ */
252
+ account_holder_name: string;
253
+
254
+ /**
255
+ * Bank account number.
256
+ */
257
+ account_number: string;
258
+
259
+ /**
260
+ * ABA routing number (9 digits).
261
+ */
262
+ routing_number: string;
263
+
264
+ /**
265
+ * Discriminator for ABA wire financial address.
266
+ */
267
+ type: 'aba';
268
+ }
269
+ }
270
+
271
+ export declare namespace AccountPrograms {
272
+ export {
273
+ type AccountProgramCreateResponse as AccountProgramCreateResponse,
274
+ type AccountProgramCloseResponse as AccountProgramCloseResponse,
275
+ type AccountProgramDrainResponse as AccountProgramDrainResponse,
276
+ type AccountProgramFreezeResponse as AccountProgramFreezeResponse,
277
+ type AccountProgramUnfreezeResponse as AccountProgramUnfreezeResponse,
278
+ type AccountProgramCreateParams as AccountProgramCreateParams,
279
+ type AccountProgramCloseParams as AccountProgramCloseParams,
280
+ type AccountProgramDrainParams as AccountProgramDrainParams,
281
+ };
282
+ }