@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.
- package/DaaReactNativeSdk.podspec +69 -0
- package/LICENSE +176 -0
- package/README.md +691 -2
- package/android/build.gradle +102 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/com/circle/daa/reactnative/DaaRegistrationExceptions.kt +47 -0
- package/android/src/main/java/com/circle/daa/reactnative/DaaRegistrationModule.kt +104 -0
- package/android/src/main/java/com/circle/daa/reactnative/DaaScaExceptions.kt +60 -0
- package/android/src/main/java/com/circle/daa/reactnative/DaaScaModule.kt +179 -0
- package/android/src/main/java/com/circle/daa/reactnative/DaaSecureKeyExceptions.kt +107 -0
- package/android/src/main/java/com/circle/daa/reactnative/DaaSecureKeyModule.kt +318 -0
- package/android/src/main/java/com/circle/daa/reactnative/InstallationIdentityStore.kt +122 -0
- package/android/src/main/java/com/circle/daa/reactnative/UnpaddedBase64Url.kt +45 -0
- package/build/DaaClient.d.ts +237 -0
- package/build/DaaClient.js +442 -0
- package/build/api/AccountLimitsClient.d.ts +79 -0
- package/build/api/AccountLimitsClient.js +142 -0
- package/build/api/AccountsClient.d.ts +98 -0
- package/build/api/AccountsClient.js +279 -0
- package/build/api/AchFiatAccountsClient.d.ts +92 -0
- package/build/api/AchFiatAccountsClient.js +142 -0
- package/build/api/AuthClient.d.ts +95 -0
- package/build/api/AuthClient.js +221 -0
- package/build/api/ContractExecutionsClient.d.ts +114 -0
- package/build/api/ContractExecutionsClient.js +462 -0
- package/build/api/DaaUserClient.d.ts +187 -0
- package/build/api/DaaUserClient.js +312 -0
- package/build/api/DepositAddressesClient.d.ts +112 -0
- package/build/api/DepositAddressesClient.js +222 -0
- package/build/api/DepositsClient.d.ts +106 -0
- package/build/api/DepositsClient.js +183 -0
- package/build/api/FiatAccountsClient.d.ts +43 -0
- package/build/api/FiatAccountsClient.js +46 -0
- package/build/api/TransactionsClient.d.ts +64 -0
- package/build/api/TransactionsClient.js +121 -0
- package/build/api/TransfersClient.d.ts +107 -0
- package/build/api/TransfersClient.js +324 -0
- package/build/api/WireFiatAccountsClient.d.ts +99 -0
- package/build/api/WireFiatAccountsClient.js +156 -0
- package/build/api/WithdrawalsClient.d.ts +97 -0
- package/build/api/WithdrawalsClient.js +308 -0
- package/build/api/deviceApproval.d.ts +48 -0
- package/build/api/deviceApproval.js +247 -0
- package/build/api/deviceStatus.d.ts +61 -0
- package/build/api/deviceStatus.js +216 -0
- package/build/api/loginFailure.d.ts +51 -0
- package/build/api/loginFailure.js +95 -0
- package/build/api/pagination.d.ts +29 -0
- package/build/api/pagination.js +50 -0
- package/build/api/queryParameters.d.ts +23 -0
- package/build/api/queryParameters.js +77 -0
- package/build/api/resourceRequest.d.ts +60 -0
- package/build/api/resourceRequest.js +79 -0
- package/build/api/signedResource.d.ts +124 -0
- package/build/api/signedResource.js +267 -0
- package/build/auth/RegistrationFlowKey.d.ts +93 -0
- package/build/auth/RegistrationFlowKey.js +203 -0
- package/build/auth/daaRegistrationNative.d.ts +58 -0
- package/build/auth/daaRegistrationNative.js +158 -0
- package/build/auth/deviceAuthorization.d.ts +87 -0
- package/build/auth/deviceAuthorization.js +295 -0
- package/build/auth/ownerGrant.d.ts +29 -0
- package/build/auth/ownerGrant.js +90 -0
- package/build/auth/registrationAuthorization.d.ts +48 -0
- package/build/auth/registrationAuthorization.js +246 -0
- package/build/auth/registrationCodeVerifier.d.ts +31 -0
- package/build/auth/registrationCodeVerifier.js +75 -0
- package/build/config.d.ts +106 -0
- package/build/config.js +131 -0
- package/build/crypto/base64url.d.ts +26 -0
- package/build/crypto/base64url.js +87 -0
- package/build/crypto/bytes.d.ts +27 -0
- package/build/crypto/bytes.js +32 -0
- package/build/crypto/jwkThumbprint.d.ts +32 -0
- package/build/crypto/jwkThumbprint.js +49 -0
- package/build/crypto/matchingCode.d.ts +47 -0
- package/build/crypto/matchingCode.js +93 -0
- package/build/crypto/random.d.ts +35 -0
- package/build/crypto/random.js +106 -0
- package/build/crypto/serialization.d.ts +26 -0
- package/build/crypto/serialization.js +43 -0
- package/build/crypto/sha256.d.ts +18 -0
- package/build/crypto/sha256.js +100 -0
- package/build/errors.d.ts +307 -0
- package/build/errors.js +413 -0
- package/build/index.d.ts +69 -0
- package/build/index.js +67 -0
- package/build/models/Account.d.ts +201 -0
- package/build/models/Account.js +147 -0
- package/build/models/AccountLimitsUsage.d.ts +169 -0
- package/build/models/AccountLimitsUsage.js +86 -0
- package/build/models/Ach.d.ts +135 -0
- package/build/models/Ach.js +184 -0
- package/build/models/AddressObject.d.ts +128 -0
- package/build/models/AddressObject.js +141 -0
- package/build/models/BusinessPii.d.ts +84 -0
- package/build/models/BusinessPii.js +142 -0
- package/build/models/ContractExecution.d.ts +197 -0
- package/build/models/ContractExecution.js +130 -0
- package/build/models/CreateAccountRequest.d.ts +74 -0
- package/build/models/CreateAccountRequest.js +19 -0
- package/build/models/CreateContractExecutionRequest.d.ts +81 -0
- package/build/models/CreateContractExecutionRequest.js +19 -0
- package/build/models/CreateTransferRequest.d.ts +91 -0
- package/build/models/CreateTransferRequest.js +19 -0
- package/build/models/CreateWithdrawalRequest.d.ts +99 -0
- package/build/models/CreateWithdrawalRequest.js +19 -0
- package/build/models/DaaUserContext.d.ts +146 -0
- package/build/models/DaaUserContext.js +164 -0
- package/build/models/Deposit.d.ts +241 -0
- package/build/models/Deposit.js +149 -0
- package/build/models/DepositSummary.d.ts +91 -0
- package/build/models/DepositSummary.js +114 -0
- package/build/models/DeviceStatus.d.ts +69 -0
- package/build/models/DeviceStatus.js +19 -0
- package/build/models/FiatAccount.d.ts +99 -0
- package/build/models/FiatAccount.js +151 -0
- package/build/models/GenerateAddressRequest.d.ts +67 -0
- package/build/models/GenerateAddressRequest.js +68 -0
- package/build/models/Money.d.ts +76 -0
- package/build/models/Money.js +99 -0
- package/build/models/Page.d.ts +33 -0
- package/build/models/Page.js +57 -0
- package/build/models/PendingDeviceApproval.d.ts +121 -0
- package/build/models/PendingDeviceApproval.js +208 -0
- package/build/models/PendingDeviceRegistration.d.ts +229 -0
- package/build/models/PendingDeviceRegistration.js +636 -0
- package/build/models/PreparedContractExecution.d.ts +70 -0
- package/build/models/PreparedContractExecution.js +77 -0
- package/build/models/PreparedSocialLogin.d.ts +148 -0
- package/build/models/PreparedSocialLogin.js +252 -0
- package/build/models/Transaction.d.ts +233 -0
- package/build/models/Transaction.js +182 -0
- package/build/models/Transfer.d.ts +335 -0
- package/build/models/Transfer.js +240 -0
- package/build/models/Wire.d.ts +213 -0
- package/build/models/Wire.js +264 -0
- package/build/models/Withdrawal.d.ts +201 -0
- package/build/models/Withdrawal.js +156 -0
- package/build/models/codeSecrets.d.ts +100 -0
- package/build/models/codeSecrets.js +321 -0
- package/build/models/redaction.d.ts +18 -0
- package/build/models/redaction.js +23 -0
- package/build/sca/ScaClient.d.ts +105 -0
- package/build/sca/ScaClient.js +193 -0
- package/build/securekey/InMemorySecureKey.d.ts +25 -0
- package/build/securekey/InMemorySecureKey.js +168 -0
- package/build/securekey/NativeSecureKey.d.ts +26 -0
- package/build/securekey/NativeSecureKey.js +355 -0
- package/build/securekey/NativeSecureKeyBridge.d.ts +151 -0
- package/build/securekey/NativeSecureKeyBridge.js +19 -0
- package/build/securekey/SecureKey.d.ts +257 -0
- package/build/securekey/SecureKey.js +19 -0
- package/build/securekey/alias.d.ts +97 -0
- package/build/securekey/alias.js +184 -0
- package/build/securekey/ownerAuthKeyResolver.d.ts +73 -0
- package/build/securekey/ownerAuthKeyResolver.js +78 -0
- package/build/securekey/registration.d.ts +19 -0
- package/build/securekey/registration.js +38 -0
- package/build/securekey/resolveNativeBridge.d.ts +33 -0
- package/build/securekey/resolveNativeBridge.js +201 -0
- package/build/testing.d.ts +18 -0
- package/build/testing.js +34 -0
- package/build/transport/DaaTransport.d.ts +35 -0
- package/build/transport/DaaTransport.js +19 -0
- package/build/transport/headers.d.ts +41 -0
- package/build/transport/headers.js +81 -0
- package/build/validation/requestBody.d.ts +27 -0
- package/build/validation/requestBody.js +56 -0
- package/build/validation/uuid.d.ts +25 -0
- package/build/validation/uuid.js +33 -0
- package/build/wire/accountLimitsUsagePayload.d.ts +30 -0
- package/build/wire/accountLimitsUsagePayload.js +130 -0
- package/build/wire/accountPayload.d.ts +36 -0
- package/build/wire/accountPayload.js +100 -0
- package/build/wire/achPayload.d.ts +24 -0
- package/build/wire/achPayload.js +82 -0
- package/build/wire/addressObjectPayload.d.ts +44 -0
- package/build/wire/addressObjectPayload.js +64 -0
- package/build/wire/contractExecutionPayload.d.ts +24 -0
- package/build/wire/contractExecutionPayload.js +130 -0
- package/build/wire/daaStatusCodes.d.ts +81 -0
- package/build/wire/daaStatusCodes.js +86 -0
- package/build/wire/dataEnvelope.d.ts +40 -0
- package/build/wire/dataEnvelope.js +79 -0
- package/build/wire/depositPayload.d.ts +42 -0
- package/build/wire/depositPayload.js +159 -0
- package/build/wire/deviceContextPayload.d.ts +35 -0
- package/build/wire/deviceContextPayload.js +59 -0
- package/build/wire/deviceRegistrationResultPayload.d.ts +77 -0
- package/build/wire/deviceRegistrationResultPayload.js +162 -0
- package/build/wire/deviceStatusPayload.d.ts +20 -0
- package/build/wire/deviceStatusPayload.js +66 -0
- package/build/wire/errorEnvelope.d.ts +43 -0
- package/build/wire/errorEnvelope.js +85 -0
- package/build/wire/fiatAccountPayload.d.ts +37 -0
- package/build/wire/fiatAccountPayload.js +93 -0
- package/build/wire/instant.d.ts +27 -0
- package/build/wire/instant.js +94 -0
- package/build/wire/jsonNumber.d.ts +30 -0
- package/build/wire/jsonNumber.js +34 -0
- package/build/wire/moneyPayload.d.ts +30 -0
- package/build/wire/moneyPayload.js +56 -0
- package/build/wire/paginationLinks.d.ts +28 -0
- package/build/wire/paginationLinks.js +167 -0
- package/build/wire/payload.d.ts +60 -0
- package/build/wire/payload.js +121 -0
- package/build/wire/pendingRegistrationPayload.d.ts +48 -0
- package/build/wire/pendingRegistrationPayload.js +72 -0
- package/build/wire/socialLoginRequestPayload.d.ts +26 -0
- package/build/wire/socialLoginRequestPayload.js +55 -0
- package/build/wire/transactionPayload.d.ts +31 -0
- package/build/wire/transactionPayload.js +149 -0
- package/build/wire/transferPayload.d.ts +43 -0
- package/build/wire/transferPayload.js +218 -0
- package/build/wire/wireEnums.d.ts +22 -0
- package/build/wire/wireEnums.js +69 -0
- package/build/wire/wirePayload.d.ts +29 -0
- package/build/wire/wirePayload.js +138 -0
- package/build/wire/withdrawalPayload.d.ts +27 -0
- package/build/wire/withdrawalPayload.js +179 -0
- package/expo-module.config.json +14 -0
- package/ios/DaaRegistrationExceptions.swift +58 -0
- package/ios/DaaRegistrationModule.swift +125 -0
- package/ios/DaaScaExceptions.swift +96 -0
- package/ios/DaaScaModule.swift +125 -0
- package/ios/DaaSecureKeyExceptions.swift +125 -0
- package/ios/DaaSecureKeyModule.swift +306 -0
- package/ios/InstallationIdentityStore.swift +162 -0
- package/ios/UnpaddedBase64URL.swift +42 -0
- package/package.json +114 -4
- package/src/DaaClient.ts +509 -0
- package/src/api/AccountLimitsClient.ts +146 -0
- package/src/api/AccountsClient.ts +308 -0
- package/src/api/AchFiatAccountsClient.ts +147 -0
- package/src/api/AuthClient.ts +266 -0
- package/src/api/ContractExecutionsClient.ts +527 -0
- package/src/api/DaaUserClient.ts +345 -0
- package/src/api/DepositAddressesClient.ts +239 -0
- package/src/api/DepositsClient.ts +208 -0
- package/src/api/FiatAccountsClient.ts +50 -0
- package/src/api/TransactionsClient.ts +138 -0
- package/src/api/TransfersClient.ts +364 -0
- package/src/api/WireFiatAccountsClient.ts +172 -0
- package/src/api/WithdrawalsClient.ts +342 -0
- package/src/api/deviceApproval.ts +306 -0
- package/src/api/deviceStatus.ts +238 -0
- package/src/api/loginFailure.ts +112 -0
- package/src/api/pagination.ts +63 -0
- package/src/api/queryParameters.ts +82 -0
- package/src/api/resourceRequest.ts +135 -0
- package/src/api/signedResource.ts +427 -0
- package/src/auth/RegistrationFlowKey.ts +274 -0
- package/src/auth/daaRegistrationNative.ts +191 -0
- package/src/auth/deviceAuthorization.ts +365 -0
- package/src/auth/ownerGrant.ts +102 -0
- package/src/auth/registrationAuthorization.ts +309 -0
- package/src/auth/registrationCodeVerifier.ts +76 -0
- package/src/config.ts +192 -0
- package/src/crypto/base64url.ts +88 -0
- package/src/crypto/bytes.ts +30 -0
- package/src/crypto/jwkThumbprint.ts +65 -0
- package/src/crypto/matchingCode.ts +100 -0
- package/src/crypto/random.ts +113 -0
- package/src/crypto/serialization.ts +42 -0
- package/src/crypto/sha256.ts +105 -0
- package/src/errors.ts +576 -0
- package/src/index.ts +258 -0
- package/src/models/Account.ts +264 -0
- package/src/models/AccountLimitsUsage.ts +192 -0
- package/src/models/Ach.ts +269 -0
- package/src/models/AddressObject.ts +169 -0
- package/src/models/BusinessPii.ts +154 -0
- package/src/models/ContractExecution.ts +250 -0
- package/src/models/CreateAccountRequest.ts +109 -0
- package/src/models/CreateContractExecutionRequest.ts +100 -0
- package/src/models/CreateTransferRequest.ts +114 -0
- package/src/models/CreateWithdrawalRequest.ts +120 -0
- package/src/models/DaaUserContext.ts +228 -0
- package/src/models/Deposit.ts +307 -0
- package/src/models/DepositSummary.ts +142 -0
- package/src/models/DeviceStatus.ts +50 -0
- package/src/models/FiatAccount.ts +195 -0
- package/src/models/GenerateAddressRequest.ts +101 -0
- package/src/models/Money.ts +91 -0
- package/src/models/Page.ts +48 -0
- package/src/models/PendingDeviceApproval.ts +229 -0
- package/src/models/PendingDeviceRegistration.ts +791 -0
- package/src/models/PreparedContractExecution.ts +128 -0
- package/src/models/PreparedSocialLogin.ts +297 -0
- package/src/models/Transaction.ts +322 -0
- package/src/models/Transfer.ts +459 -0
- package/src/models/Wire.ts +405 -0
- package/src/models/Withdrawal.ts +283 -0
- package/src/models/codeSecrets.ts +360 -0
- package/src/models/redaction.ts +22 -0
- package/src/sca/ScaClient.ts +289 -0
- package/src/securekey/InMemorySecureKey.ts +192 -0
- package/src/securekey/NativeSecureKey.ts +388 -0
- package/src/securekey/NativeSecureKeyBridge.ts +189 -0
- package/src/securekey/SecureKey.ts +279 -0
- package/src/securekey/alias.ts +212 -0
- package/src/securekey/ownerAuthKeyResolver.ts +135 -0
- package/src/securekey/registration.ts +40 -0
- package/src/securekey/resolveNativeBridge.ts +343 -0
- package/src/testing.ts +32 -0
- package/src/transport/DaaTransport.ts +42 -0
- package/src/transport/headers.ts +93 -0
- package/src/validation/requestBody.ts +60 -0
- package/src/validation/uuid.ts +31 -0
- package/src/wire/accountLimitsUsagePayload.ts +182 -0
- package/src/wire/accountPayload.ts +108 -0
- package/src/wire/achPayload.ts +98 -0
- package/src/wire/addressObjectPayload.ts +64 -0
- package/src/wire/contractExecutionPayload.ts +152 -0
- package/src/wire/daaStatusCodes.ts +86 -0
- package/src/wire/dataEnvelope.ts +80 -0
- package/src/wire/depositPayload.ts +186 -0
- package/src/wire/deviceContextPayload.ts +60 -0
- package/src/wire/deviceRegistrationResultPayload.ts +211 -0
- package/src/wire/deviceStatusPayload.ts +68 -0
- package/src/wire/errorEnvelope.ts +87 -0
- package/src/wire/fiatAccountPayload.ts +112 -0
- package/src/wire/instant.ts +96 -0
- package/src/wire/jsonNumber.ts +33 -0
- package/src/wire/moneyPayload.ts +55 -0
- package/src/wire/paginationLinks.ts +204 -0
- package/src/wire/payload.ts +146 -0
- package/src/wire/pendingRegistrationPayload.ts +118 -0
- package/src/wire/socialLoginRequestPayload.ts +66 -0
- package/src/wire/transactionPayload.ts +181 -0
- package/src/wire/transferPayload.ts +249 -0
- package/src/wire/wireEnums.ts +74 -0
- package/src/wire/wirePayload.ts +160 -0
- package/src/wire/withdrawalPayload.ts +219 -0
- package/testing.d.ts +19 -0
- package/testing.js +25 -0
|
@@ -0,0 +1,107 @@
|
|
|
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 { CreateTransferRequest } from '../models/CreateTransferRequest';
|
|
19
|
+
import type { Transfer } from '../models/Transfer';
|
|
20
|
+
import type { Page } from '../models/Page';
|
|
21
|
+
import type { DaaTransport } from '../transport/DaaTransport';
|
|
22
|
+
import { type DaaUserSigning } from './signedResource';
|
|
23
|
+
export type TransferListQuery = Readonly<{
|
|
24
|
+
/** Select a backing source explicitly; omitted derives from `accountId` or defaults to omnibus. */
|
|
25
|
+
custodyType?: 'omnibus' | 'segregated' | 'self';
|
|
26
|
+
/** Match transfers where this public account id is either leg. */
|
|
27
|
+
accountId?: string;
|
|
28
|
+
/** Match this source leg id. Leg ids are strings and are not necessarily UUIDs. */
|
|
29
|
+
sourceAccountId?: string;
|
|
30
|
+
/** Match this destination leg id. Leg ids are strings and are not necessarily UUIDs. */
|
|
31
|
+
destinationAccountId?: string;
|
|
32
|
+
/** Match transfers for one end-user sub-entity. */
|
|
33
|
+
clientEntityId?: string;
|
|
34
|
+
sourceType?: 'account' | 'blockchain';
|
|
35
|
+
destinationType?: 'account' | 'blockchain';
|
|
36
|
+
/** Inclusive RFC 3339 creation-time lower bound. */
|
|
37
|
+
from?: string;
|
|
38
|
+
/** Inclusive RFC 3339 creation-time upper bound. */
|
|
39
|
+
to?: string;
|
|
40
|
+
/** Initial forward keyset cursor. Link-derived navigation remains opaque. */
|
|
41
|
+
pageAfter?: string;
|
|
42
|
+
/** Initial backward keyset cursor. Link-derived navigation remains opaque. */
|
|
43
|
+
pageBefore?: string;
|
|
44
|
+
pageSize?: number;
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Reads over DAA transfers, plus the signed transfer create, as the SDK
|
|
48
|
+
* contract's `TransfersClient`.
|
|
49
|
+
*
|
|
50
|
+
* {@link list} retains the API's RFC 8288 navigation queries as opaque text.
|
|
51
|
+
* {@link create} is an Owner-authorized write: it carries an
|
|
52
|
+
* `X-Device-Authorization` bound to the exact bytes it sends and cannot happen
|
|
53
|
+
* without the registered AuthKey `forUser` supplies.
|
|
54
|
+
*
|
|
55
|
+
* Not constructible by a consumer: exported from `index.ts` as a type only, and
|
|
56
|
+
* the `#transport` field makes the type nominal.
|
|
57
|
+
*/
|
|
58
|
+
export declare class TransfersClient {
|
|
59
|
+
#private;
|
|
60
|
+
/** @internal Constructed only through the internal user-client factory. */
|
|
61
|
+
constructor(transport: DaaTransport, publicApiOrigin: string, signing: DaaUserSigning);
|
|
62
|
+
/** List transfers and retain the API's opaque navigation queries unchanged. */
|
|
63
|
+
list(query?: TransferListQuery): Promise<Page<Transfer>>;
|
|
64
|
+
/**
|
|
65
|
+
* Read one transfer.
|
|
66
|
+
*
|
|
67
|
+
* @param transferId The service-assigned UUID. Values that are not
|
|
68
|
+
* UUID-formatted are rejected locally because they cannot resolve to a
|
|
69
|
+
* transfer on the service side.
|
|
70
|
+
* @throws DaaError with `detail.kind === 'contract_violation'` for a rejected
|
|
71
|
+
* `transferId` or a response the SDK cannot read, and `detail.kind === 'api'`
|
|
72
|
+
* for a status other than the documented `200`; `detail.kind === 'transport'`
|
|
73
|
+
* if the consumer's transport throws, with the thrown value as `err.cause`.
|
|
74
|
+
*/
|
|
75
|
+
get(transferId: string): Promise<Transfer>;
|
|
76
|
+
/**
|
|
77
|
+
* Create a transfer, authorized by the registered device key.
|
|
78
|
+
*
|
|
79
|
+
* The body is validated, serialized **once**, and that exact byte slice is
|
|
80
|
+
* both hashed into the authorization's `body_sha256` claim and sent as the
|
|
81
|
+
* request entity. Nothing between here and the transport re-serializes it,
|
|
82
|
+
* which is the whole point: a re-encoding that changed so much as a space
|
|
83
|
+
* would produce a signature over bytes the service never receives.
|
|
84
|
+
*
|
|
85
|
+
* Neither the method nor the path is chosen here. `postSignedResource`
|
|
86
|
+
* resolves both from the registry entry for `transfer`, so a signed write
|
|
87
|
+
* cannot be aimed somewhere the operation does not name.
|
|
88
|
+
*
|
|
89
|
+
* @throws DaaError with `detail.kind === 'contract_violation'` for a request
|
|
90
|
+
* the registry schema would reject, for an AuthKey that is not yet
|
|
91
|
+
* registered — the create is refused locally, before anything is signed or
|
|
92
|
+
* sent — for a rejected or replayed authorization (including a key that is
|
|
93
|
+
* no longer active: DAA has no revoked-credential code, so this never
|
|
94
|
+
* throws `device_revoked`), and for a response the SDK cannot read;
|
|
95
|
+
* `clock_skew` when DAA refused the authorization because the device clock
|
|
96
|
+
* was more than 60 seconds off: correct the device time, then send the same
|
|
97
|
+
* request again;
|
|
98
|
+
* `idempotency_conflict`, with the request's key, for a `409` with
|
|
99
|
+
* `IDEMPOTENCY_KEY_REUSED` (`420034`): reconcile the original transfer with
|
|
100
|
+
* the same key; do not mint a new key for it;
|
|
101
|
+
* `detail.kind === 'api'` for a status other than the documented `201`; and
|
|
102
|
+
* `detail.kind === 'transport'` if the consumer's transport throws, with the
|
|
103
|
+
* thrown value as `err.cause` and the request's `idempotencyKey` on the
|
|
104
|
+
* detail.
|
|
105
|
+
*/
|
|
106
|
+
create(request: CreateTransferRequest): Promise<Transfer>;
|
|
107
|
+
}
|
|
@@ -0,0 +1,324 @@
|
|
|
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 _TransfersClient_transport, _TransfersClient_publicApiOrigin, _TransfersClient_signing;
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.TransfersClient = void 0;
|
|
33
|
+
const serialization_1 = require("../crypto/serialization");
|
|
34
|
+
const errors_1 = require("../errors");
|
|
35
|
+
const requestBody_1 = require("../validation/requestBody");
|
|
36
|
+
const uuid_1 = require("../validation/uuid");
|
|
37
|
+
const jsonNumber_1 = require("../wire/jsonNumber");
|
|
38
|
+
const transferPayload_1 = require("../wire/transferPayload");
|
|
39
|
+
const pagination_1 = require("./pagination");
|
|
40
|
+
const queryParameters_1 = require("./queryParameters");
|
|
41
|
+
const resourceRequest_1 = require("./resourceRequest");
|
|
42
|
+
const signedResource_1 = require("./signedResource");
|
|
43
|
+
/**
|
|
44
|
+
* `GET /v1/accounts/transfers/{transferId}` — the **public** path, exactly as
|
|
45
|
+
* for Accounts (`AccountsClient.ts`). The registry's
|
|
46
|
+
* `"canonical_path": "/v1/accounts/transfers"` and the `Location` header of
|
|
47
|
+
* `/v1/accounts/transfers/<id>` on create both use it.
|
|
48
|
+
*/
|
|
49
|
+
const TRANSFER_PATH_PREFIX = '/v1/accounts/transfers/';
|
|
50
|
+
const TRANSFER_COLLECTION_PATH = '/v1/accounts/transfers';
|
|
51
|
+
/**
|
|
52
|
+
* The properties the Owner-authorization registry's `transfer` schema names, in
|
|
53
|
+
* the order it names them, at each level of the body.
|
|
54
|
+
*
|
|
55
|
+
* Order matters because these are the bytes that get signed: the body is
|
|
56
|
+
* serialized once from these shapes and that exact slice is hashed into
|
|
57
|
+
* `body_sha256` and put on the wire. Building it here rather than forwarding
|
|
58
|
+
* the caller's object also means the property order does not vary with how the
|
|
59
|
+
* caller happened to write its literal. Every one of these objects is
|
|
60
|
+
* `additionalProperties: false` in the registry, so each level is checked, not
|
|
61
|
+
* just the top.
|
|
62
|
+
*/
|
|
63
|
+
const TRANSFER_PROPERTIES = Object.freeze([
|
|
64
|
+
'idempotencyKey',
|
|
65
|
+
'source',
|
|
66
|
+
'destination',
|
|
67
|
+
'amount',
|
|
68
|
+
'riskSignals',
|
|
69
|
+
]);
|
|
70
|
+
const TRANSFER_LOCATION_PROPERTIES = Object.freeze(['type', 'id']);
|
|
71
|
+
const TRANSFER_VERIFIED_BLOCKCHAIN_PROPERTIES = Object.freeze(['type', 'addressId']);
|
|
72
|
+
const TRANSFER_AMOUNT_PROPERTIES = Object.freeze(['amount', 'currency']);
|
|
73
|
+
const TRANSFER_RISK_SIGNAL_PROPERTIES = Object.freeze(['ipAddress', 'sessionId', 'deviceId']);
|
|
74
|
+
/*
|
|
75
|
+
* A transfer id is a UUID, and is checked as one rather than as a generic path
|
|
76
|
+
* segment.
|
|
77
|
+
*
|
|
78
|
+
* The SDK contract types this parameter `transferId: UUID`. That is
|
|
79
|
+
* deliberately unlike `AccountsClient`, whose signature is
|
|
80
|
+
* `accountId: string`, because public account ids are strings, including
|
|
81
|
+
* numeric IDs. The two guards differ on purpose; applying one rule to
|
|
82
|
+
* both would make one of them wrong.
|
|
83
|
+
*
|
|
84
|
+
* A UUID-formatted identifier contains none of the characters — `/`, `%`, `.`, control
|
|
85
|
+
* bytes — that could redirect the request into a sibling route, so this subsumes
|
|
86
|
+
* the path-segment check rather than merely differing from it.
|
|
87
|
+
*/
|
|
88
|
+
/**
|
|
89
|
+
* Reads over DAA transfers, plus the signed transfer create, as the SDK
|
|
90
|
+
* contract's `TransfersClient`.
|
|
91
|
+
*
|
|
92
|
+
* {@link list} retains the API's RFC 8288 navigation queries as opaque text.
|
|
93
|
+
* {@link create} is an Owner-authorized write: it carries an
|
|
94
|
+
* `X-Device-Authorization` bound to the exact bytes it sends and cannot happen
|
|
95
|
+
* without the registered AuthKey `forUser` supplies.
|
|
96
|
+
*
|
|
97
|
+
* Not constructible by a consumer: exported from `index.ts` as a type only, and
|
|
98
|
+
* the `#transport` field makes the type nominal.
|
|
99
|
+
*/
|
|
100
|
+
class TransfersClient {
|
|
101
|
+
/** @internal Constructed only through the internal user-client factory. */
|
|
102
|
+
constructor(transport, publicApiOrigin, signing) {
|
|
103
|
+
_TransfersClient_transport.set(this, void 0);
|
|
104
|
+
_TransfersClient_publicApiOrigin.set(this, void 0);
|
|
105
|
+
_TransfersClient_signing.set(this, void 0);
|
|
106
|
+
__classPrivateFieldSet(this, _TransfersClient_transport, transport, "f");
|
|
107
|
+
__classPrivateFieldSet(this, _TransfersClient_publicApiOrigin, publicApiOrigin, "f");
|
|
108
|
+
__classPrivateFieldSet(this, _TransfersClient_signing, signing, "f");
|
|
109
|
+
Object.freeze(this);
|
|
110
|
+
}
|
|
111
|
+
/** List transfers and retain the API's opaque navigation queries unchanged. */
|
|
112
|
+
async list(query) {
|
|
113
|
+
return (0, pagination_1.readPage)({
|
|
114
|
+
transport: __classPrivateFieldGet(this, _TransfersClient_transport, "f"),
|
|
115
|
+
publicApiOrigin: __classPrivateFieldGet(this, _TransfersClient_publicApiOrigin, "f"),
|
|
116
|
+
path: TRANSFER_COLLECTION_PATH,
|
|
117
|
+
query: transferListQuery(query),
|
|
118
|
+
decode: transferPayload_1.toTransfers,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Read one transfer.
|
|
123
|
+
*
|
|
124
|
+
* @param transferId The service-assigned UUID. Values that are not
|
|
125
|
+
* UUID-formatted are rejected locally because they cannot resolve to a
|
|
126
|
+
* transfer on the service side.
|
|
127
|
+
* @throws DaaError with `detail.kind === 'contract_violation'` for a rejected
|
|
128
|
+
* `transferId` or a response the SDK cannot read, and `detail.kind === 'api'`
|
|
129
|
+
* for a status other than the documented `200`; `detail.kind === 'transport'`
|
|
130
|
+
* if the consumer's transport throws, with the thrown value as `err.cause`.
|
|
131
|
+
*/
|
|
132
|
+
async get(transferId) {
|
|
133
|
+
if (!(0, uuid_1.isUuid)(transferId)) {
|
|
134
|
+
throw (0, errors_1.contractViolation)('transferId must be a UUID');
|
|
135
|
+
}
|
|
136
|
+
return (0, resourceRequest_1.readResource)({
|
|
137
|
+
transport: __classPrivateFieldGet(this, _TransfersClient_transport, "f"),
|
|
138
|
+
path: TRANSFER_PATH_PREFIX + transferId,
|
|
139
|
+
decode: transferPayload_1.toTransfer,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Create a transfer, authorized by the registered device key.
|
|
144
|
+
*
|
|
145
|
+
* The body is validated, serialized **once**, and that exact byte slice is
|
|
146
|
+
* both hashed into the authorization's `body_sha256` claim and sent as the
|
|
147
|
+
* request entity. Nothing between here and the transport re-serializes it,
|
|
148
|
+
* which is the whole point: a re-encoding that changed so much as a space
|
|
149
|
+
* would produce a signature over bytes the service never receives.
|
|
150
|
+
*
|
|
151
|
+
* Neither the method nor the path is chosen here. `postSignedResource`
|
|
152
|
+
* resolves both from the registry entry for `transfer`, so a signed write
|
|
153
|
+
* cannot be aimed somewhere the operation does not name.
|
|
154
|
+
*
|
|
155
|
+
* @throws DaaError with `detail.kind === 'contract_violation'` for a request
|
|
156
|
+
* the registry schema would reject, for an AuthKey that is not yet
|
|
157
|
+
* registered — the create is refused locally, before anything is signed or
|
|
158
|
+
* sent — for a rejected or replayed authorization (including a key that is
|
|
159
|
+
* no longer active: DAA has no revoked-credential code, so this never
|
|
160
|
+
* throws `device_revoked`), and for a response the SDK cannot read;
|
|
161
|
+
* `clock_skew` when DAA refused the authorization because the device clock
|
|
162
|
+
* was more than 60 seconds off: correct the device time, then send the same
|
|
163
|
+
* request again;
|
|
164
|
+
* `idempotency_conflict`, with the request's key, for a `409` with
|
|
165
|
+
* `IDEMPOTENCY_KEY_REUSED` (`420034`): reconcile the original transfer with
|
|
166
|
+
* the same key; do not mint a new key for it;
|
|
167
|
+
* `detail.kind === 'api'` for a status other than the documented `201`; and
|
|
168
|
+
* `detail.kind === 'transport'` if the consumer's transport throws, with the
|
|
169
|
+
* thrown value as `err.cause` and the request's `idempotencyKey` on the
|
|
170
|
+
* detail.
|
|
171
|
+
*/
|
|
172
|
+
async create(request) {
|
|
173
|
+
const bodyBytes = (0, serialization_1.serializeBody)(createTransferBody(request));
|
|
174
|
+
return (0, signedResource_1.postSignedResource)({
|
|
175
|
+
transport: __classPrivateFieldGet(this, _TransfersClient_transport, "f"),
|
|
176
|
+
operation: 'transfer',
|
|
177
|
+
authKey: await __classPrivateFieldGet(this, _TransfersClient_signing, "f").resolveAuthKey(),
|
|
178
|
+
authKeyId: __classPrivateFieldGet(this, _TransfersClient_signing, "f").authKeyId,
|
|
179
|
+
bodyBytes,
|
|
180
|
+
// The contract documents exactly 201, with a Location header. Another
|
|
181
|
+
// 2xx is an observable API failure rather than a silently accepted
|
|
182
|
+
// variant, the same rule the by-id reads apply to 200.
|
|
183
|
+
expectedStatus: 201,
|
|
184
|
+
decode: transferPayload_1.toTransfer,
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
exports.TransfersClient = TransfersClient;
|
|
189
|
+
_TransfersClient_transport = new WeakMap(), _TransfersClient_publicApiOrigin = new WeakMap(), _TransfersClient_signing = new WeakMap();
|
|
190
|
+
/**
|
|
191
|
+
* Project a validated request onto the registry's `transfer` shape.
|
|
192
|
+
*
|
|
193
|
+
* Returned rather than serialized here so the caller can hold the one byte
|
|
194
|
+
* slice this body becomes; see {@link TransfersClient.create}.
|
|
195
|
+
*/
|
|
196
|
+
function createTransferBody(request) {
|
|
197
|
+
(0, requestBody_1.requireBodyObject)(request, 'transfer create request');
|
|
198
|
+
(0, requestBody_1.requireKnownProperties)(request, TRANSFER_PROPERTIES, 'transfer create request');
|
|
199
|
+
const { idempotencyKey, source, destination, amount, riskSignals } = request;
|
|
200
|
+
// The registry types this `format: uuid`, and nothing in the transfer
|
|
201
|
+
// contract narrows it to v4 — unlike the account create, whose own contract
|
|
202
|
+
// text says v4. Requiring more here would reject a key DAA accepts.
|
|
203
|
+
if (typeof idempotencyKey !== 'string' || !(0, uuid_1.isUuid)(idempotencyKey)) {
|
|
204
|
+
throw (0, errors_1.contractViolation)('idempotencyKey must be a UUID');
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
idempotencyKey,
|
|
208
|
+
...(source === undefined ? {} : { source: transferSource(source) }),
|
|
209
|
+
destination: transferDestination(destination),
|
|
210
|
+
amount: transferAmount(amount),
|
|
211
|
+
...(riskSignals === undefined ? {} : { riskSignals: transferRiskSignals(riskSignals) }),
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
function transferSource(source) {
|
|
215
|
+
(0, requestBody_1.requireBodyObject)(source, 'transfer source');
|
|
216
|
+
(0, requestBody_1.requireKnownProperties)(source, TRANSFER_LOCATION_PROPERTIES, 'transfer source');
|
|
217
|
+
const { type, id } = source;
|
|
218
|
+
if (type !== 'account') {
|
|
219
|
+
throw (0, errors_1.contractViolation)('transfer source type must be account');
|
|
220
|
+
}
|
|
221
|
+
if (typeof id !== 'string' || id.length === 0) {
|
|
222
|
+
throw (0, errors_1.contractViolation)('transfer source id must be a non-empty string');
|
|
223
|
+
}
|
|
224
|
+
return { type, id };
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Both `oneOf` arms, kept apart by their discriminator.
|
|
228
|
+
*
|
|
229
|
+
* The registry requires a destination to match exactly one arm, and the two are
|
|
230
|
+
* told apart by `type` alone — their required properties are disjoint (`id`
|
|
231
|
+
* against `addressId`) and neither admits additional ones. So an unfamiliar
|
|
232
|
+
* `type` is rejected here rather than guessed at: guessing would mean picking
|
|
233
|
+
* an arm DAA would not have picked, and signing that.
|
|
234
|
+
*/
|
|
235
|
+
function transferDestination(destination) {
|
|
236
|
+
(0, requestBody_1.requireBodyObject)(destination, 'transfer destination');
|
|
237
|
+
const { type } = destination;
|
|
238
|
+
if (type === 'account') {
|
|
239
|
+
(0, requestBody_1.requireKnownProperties)(destination, TRANSFER_LOCATION_PROPERTIES, 'transfer destination');
|
|
240
|
+
const { id } = destination;
|
|
241
|
+
if (typeof id !== 'string' || id.length === 0) {
|
|
242
|
+
throw (0, errors_1.contractViolation)('transfer destination id must be a non-empty string');
|
|
243
|
+
}
|
|
244
|
+
return { type, id };
|
|
245
|
+
}
|
|
246
|
+
if (type === 'verified_blockchain') {
|
|
247
|
+
(0, requestBody_1.requireKnownProperties)(destination, TRANSFER_VERIFIED_BLOCKCHAIN_PROPERTIES, 'transfer destination');
|
|
248
|
+
const { addressId } = destination;
|
|
249
|
+
if (typeof addressId !== 'string' || !(0, uuid_1.isUuid)(addressId)) {
|
|
250
|
+
throw (0, errors_1.contractViolation)('transfer destination addressId must be a UUID');
|
|
251
|
+
}
|
|
252
|
+
return { type, addressId };
|
|
253
|
+
}
|
|
254
|
+
throw (0, errors_1.contractViolation)('transfer destination type must be account or verified_blockchain');
|
|
255
|
+
}
|
|
256
|
+
function transferAmount(amount) {
|
|
257
|
+
(0, requestBody_1.requireBodyObject)(amount, 'transfer amount');
|
|
258
|
+
(0, requestBody_1.requireKnownProperties)(amount, TRANSFER_AMOUNT_PROPERTIES, 'transfer amount');
|
|
259
|
+
const { amount: amountValue, currency } = amount;
|
|
260
|
+
// The registry's `decimal` accepts a JSON string or a JSON number and then
|
|
261
|
+
// parses it as an arbitrary-precision decimal, so it would also take forms
|
|
262
|
+
// JSON itself does not write — a bare leading `.`, a trailing `.`, a leading
|
|
263
|
+
// `+`. This narrows to the RFC 8259 number grammar the SDK already requires
|
|
264
|
+
// of a `Money` on the way in (`wire/jsonNumber.ts`), so the same literal
|
|
265
|
+
// means the same thing in both directions and the signed bytes are never
|
|
266
|
+
// ambiguous.
|
|
267
|
+
if (typeof amountValue !== 'string' || !jsonNumber_1.JSON_NUMBER.test(amountValue)) {
|
|
268
|
+
throw (0, errors_1.contractViolation)('transfer amount must be a decimal string, e.g. "10.25"');
|
|
269
|
+
}
|
|
270
|
+
if (typeof currency !== 'string' || currency.length === 0) {
|
|
271
|
+
throw (0, errors_1.contractViolation)('transfer amount currency must be a non-empty string');
|
|
272
|
+
}
|
|
273
|
+
return { amount: amountValue, currency };
|
|
274
|
+
}
|
|
275
|
+
function transferRiskSignals(riskSignals) {
|
|
276
|
+
(0, requestBody_1.requireBodyObject)(riskSignals, 'transfer risk signals');
|
|
277
|
+
(0, requestBody_1.requireKnownProperties)(riskSignals, TRANSFER_RISK_SIGNAL_PROPERTIES, 'transfer risk signals');
|
|
278
|
+
const { ipAddress, sessionId, deviceId } = riskSignals;
|
|
279
|
+
requireOptionalRiskSignal(ipAddress, 'ipAddress');
|
|
280
|
+
requireOptionalRiskSignal(sessionId, 'sessionId');
|
|
281
|
+
requireOptionalRiskSignal(deviceId, 'deviceId');
|
|
282
|
+
// The registry requires none of these, so an object with none of them is a
|
|
283
|
+
// valid `riskSignals` and is sent as the empty object the caller asked for.
|
|
284
|
+
return {
|
|
285
|
+
...(ipAddress === undefined ? {} : { ipAddress }),
|
|
286
|
+
...(sessionId === undefined ? {} : { sessionId }),
|
|
287
|
+
...(deviceId === undefined ? {} : { deviceId }),
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
function requireOptionalRiskSignal(value, name) {
|
|
291
|
+
if (value !== undefined && (typeof value !== 'string' || value.length === 0)) {
|
|
292
|
+
throw (0, errors_1.contractViolation)(`transfer risk signal ${name} must be a non-empty string`);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
function transferListQuery(query) {
|
|
296
|
+
if (query === undefined)
|
|
297
|
+
return null;
|
|
298
|
+
if (typeof query !== 'object' || query === null || Array.isArray(query)) {
|
|
299
|
+
throw (0, errors_1.contractViolation)('transfer list query must be an object');
|
|
300
|
+
}
|
|
301
|
+
if (query.pageAfter !== undefined && query.pageBefore !== undefined) {
|
|
302
|
+
throw (0, errors_1.contractViolation)('pageAfter and pageBefore cannot be used together');
|
|
303
|
+
}
|
|
304
|
+
const parts = [];
|
|
305
|
+
(0, queryParameters_1.appendEnum)(parts, 'custodyType', query.custodyType, ['omnibus', 'segregated', 'self']);
|
|
306
|
+
(0, queryParameters_1.appendString)(parts, 'accountId', query.accountId);
|
|
307
|
+
(0, queryParameters_1.appendString)(parts, 'sourceAccountId', query.sourceAccountId);
|
|
308
|
+
(0, queryParameters_1.appendString)(parts, 'destinationAccountId', query.destinationAccountId);
|
|
309
|
+
(0, queryParameters_1.appendUuid)(parts, 'clientEntityId', query.clientEntityId);
|
|
310
|
+
(0, queryParameters_1.appendEnum)(parts, 'sourceType', query.sourceType, ['account', 'blockchain']);
|
|
311
|
+
(0, queryParameters_1.appendEnum)(parts, 'destinationType', query.destinationType, ['account', 'blockchain']);
|
|
312
|
+
(0, queryParameters_1.appendString)(parts, 'from', query.from);
|
|
313
|
+
(0, queryParameters_1.appendString)(parts, 'to', query.to);
|
|
314
|
+
// Unlike account cursors, the service models transfer cursors as UUID transfer ids.
|
|
315
|
+
(0, queryParameters_1.appendUuid)(parts, 'pageAfter', query.pageAfter);
|
|
316
|
+
(0, queryParameters_1.appendUuid)(parts, 'pageBefore', query.pageBefore);
|
|
317
|
+
if (query.pageSize !== undefined) {
|
|
318
|
+
if (!Number.isInteger(query.pageSize) || query.pageSize < 1) {
|
|
319
|
+
throw (0, errors_1.contractViolation)('pageSize must be a positive integer');
|
|
320
|
+
}
|
|
321
|
+
(0, queryParameters_1.append)(parts, 'pageSize', String(query.pageSize));
|
|
322
|
+
}
|
|
323
|
+
return parts.length === 0 ? null : parts.join('&');
|
|
324
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
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 { Wire, WireInstruction, WireSummary } from '../models/Wire';
|
|
19
|
+
import type { DaaTransport } from '../transport/DaaTransport';
|
|
20
|
+
/** The wire collection's list query: `clientEntityId` is optional. */
|
|
21
|
+
export type WireFiatAccountListQuery = Readonly<{
|
|
22
|
+
clientEntityId?: string;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* A public Accounts API `accountId` query value. These are strings, including
|
|
26
|
+
* numeric IDs — the same reason `AccountsClient.get` types its parameter
|
|
27
|
+
* `string` rather than `UUID`.
|
|
28
|
+
*/
|
|
29
|
+
export type PublicAccountId = string;
|
|
30
|
+
/** Optional query accepted by {@link WireFiatAccountsClient.getInstructions}. */
|
|
31
|
+
export type WireInstructionQuery = Readonly<{
|
|
32
|
+
accountId?: PublicAccountId;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Reads over wire fiat accounts.
|
|
36
|
+
*
|
|
37
|
+
* Every operation here is an **ordinary typed read** — fiat-account list and
|
|
38
|
+
* get and the receiving-instructions read are all unsigned — so, like
|
|
39
|
+
* `AccountsClient.get`, none of it needs a device signature.
|
|
40
|
+
*
|
|
41
|
+
* {@link list} returns the API's **unpaginated list shape**: a plain `data`
|
|
42
|
+
* array, not this SDK's opaque-cursor `Page<T>`. {@link get} and
|
|
43
|
+
* {@link getInstructions} are separate SDK methods and response types by
|
|
44
|
+
* design: {@link get} returns the linked bank account, {@link getInstructions}
|
|
45
|
+
* returns Circle receiving instructions for it. {@link getInstructions} is a
|
|
46
|
+
* plain typed read of the public instruction route: it returns Circle's
|
|
47
|
+
* receiving instructions and does not resolve a self-custody pass-through
|
|
48
|
+
* account.
|
|
49
|
+
*
|
|
50
|
+
* Not constructible by a consumer: exported from `index.ts` as a type only,
|
|
51
|
+
* and the `#transport` field makes the type nominal.
|
|
52
|
+
*/
|
|
53
|
+
export declare class WireFiatAccountsClient {
|
|
54
|
+
#private;
|
|
55
|
+
/** @internal Constructed only through `createDaaUserClient`. */
|
|
56
|
+
constructor(transport: DaaTransport);
|
|
57
|
+
/**
|
|
58
|
+
* List wire fiat accounts.
|
|
59
|
+
*
|
|
60
|
+
* `clientEntityId` is optional here — unlike `AchFiatAccountsClient.list`,
|
|
61
|
+
* where it is required. This is a deliberate asymmetry, not a typo:
|
|
62
|
+
* `WireFiatAccountListQuery.clientEntityId` is optional and
|
|
63
|
+
* `AchFiatAccountListQuery.clientEntityId` is required, because ACH listing
|
|
64
|
+
* covers third-party accounts only.
|
|
65
|
+
*
|
|
66
|
+
* @throws DaaError with `detail.kind === 'contract_violation'` for an
|
|
67
|
+
* invalid query or a response the SDK cannot read, and
|
|
68
|
+
* `detail.kind === 'api'` for a status other than the documented `200`;
|
|
69
|
+
* `detail.kind === 'transport'` if the consumer's transport throws, with the
|
|
70
|
+
* thrown value as `err.cause`.
|
|
71
|
+
*/
|
|
72
|
+
list(query?: WireFiatAccountListQuery): Promise<ReadonlyArray<WireSummary>>;
|
|
73
|
+
/**
|
|
74
|
+
* Read one wire fiat account.
|
|
75
|
+
*
|
|
76
|
+
* @param fiatAccountId The service-assigned UUID.
|
|
77
|
+
* @throws DaaError with `detail.kind === 'contract_violation'` for a
|
|
78
|
+
* rejected `fiatAccountId` or a response the SDK cannot read, and
|
|
79
|
+
* `detail.kind === 'api'` for a status other than the documented `200`;
|
|
80
|
+
* `detail.kind === 'transport'` if the consumer's transport throws, with the
|
|
81
|
+
* thrown value as `err.cause`.
|
|
82
|
+
*/
|
|
83
|
+
get(fiatAccountId: string): Promise<Wire>;
|
|
84
|
+
/**
|
|
85
|
+
* Read Circle receiving instructions for a wire fiat account.
|
|
86
|
+
*
|
|
87
|
+
* A plain typed read of the public instruction route — see the class doc.
|
|
88
|
+
*
|
|
89
|
+
* @param fiatAccountId The service-assigned UUID.
|
|
90
|
+
* @param query Optional public `accountId`. The wire instruction route
|
|
91
|
+
* accepts this parameter; the ACH route does not.
|
|
92
|
+
* @throws DaaError with `detail.kind === 'contract_violation'` for a
|
|
93
|
+
* rejected `fiatAccountId`/`accountId` or a response the SDK cannot read,
|
|
94
|
+
* and `detail.kind === 'api'` for a status other than the documented
|
|
95
|
+
* `200`; `detail.kind === 'transport'` if the consumer's transport throws,
|
|
96
|
+
* with the thrown value as `err.cause`.
|
|
97
|
+
*/
|
|
98
|
+
getInstructions(fiatAccountId: string, query?: WireInstructionQuery): Promise<WireInstruction>;
|
|
99
|
+
}
|