@distilled.cloud/coinbase 1.0.0-rc.3 → 1.0.0-rc.4
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/lib/errors.js +51 -51
- package/lib/errors.js.map +1 -1
- package/lib/services/cdp.d.ts +13 -40
- package/lib/services/cdp.d.ts.map +1 -1
- package/lib/services/cdp.js +8 -32
- package/lib/services/cdp.js.map +1 -1
- package/package.json +4 -4
- package/src/errors.ts +51 -51
- package/src/services/cdp.ts +20 -77
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@distilled.cloud/coinbase",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/alchemy-run/distilled",
|
|
@@ -66,14 +66,14 @@
|
|
|
66
66
|
"specs:update": "git -C specs/cdp-sdk fetch && git -C specs/cdp-sdk checkout main && git -C specs/cdp-sdk pull"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@distilled.cloud/core": "1.0.0-rc.
|
|
69
|
+
"@distilled.cloud/core": "1.0.0-rc.4"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/bun": "latest",
|
|
73
73
|
"@types/node": "latest",
|
|
74
|
-
"@effect/platform-bun": ">=4.0.0-beta.
|
|
74
|
+
"@effect/platform-bun": ">=4.0.0-beta.104 || >=4.0.0"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"effect": ">=4.0.0-beta.
|
|
77
|
+
"effect": ">=4.0.0-beta.104 || >=4.0.0"
|
|
78
78
|
}
|
|
79
79
|
}
|
package/src/errors.ts
CHANGED
|
@@ -76,7 +76,7 @@ const CoinbaseErrorFields = {
|
|
|
76
76
|
* Payment method required — a valid payment method is required (HTTP 402).
|
|
77
77
|
* errorType: "payment_method_required" | "payment_required"
|
|
78
78
|
*/
|
|
79
|
-
export class PaymentRequired extends Schema.
|
|
79
|
+
export class PaymentRequired extends Schema.TaggedError<PaymentRequired>()(
|
|
80
80
|
"PaymentRequired",
|
|
81
81
|
CoinbaseErrorFields,
|
|
82
82
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -87,7 +87,7 @@ export class PaymentRequired extends Schema.TaggedErrorClass<PaymentRequired>()(
|
|
|
87
87
|
* Idempotency key conflict — the same key was used with different request params (HTTP 422).
|
|
88
88
|
* errorType: "idempotency_error"
|
|
89
89
|
*/
|
|
90
|
-
export class IdempotencyError extends Schema.
|
|
90
|
+
export class IdempotencyError extends Schema.TaggedError<IdempotencyError>()(
|
|
91
91
|
"IdempotencyError",
|
|
92
92
|
CoinbaseErrorFields,
|
|
93
93
|
).pipe(Category.withConflictError) {}
|
|
@@ -98,7 +98,7 @@ export class IdempotencyError extends Schema.TaggedErrorClass<IdempotencyError>(
|
|
|
98
98
|
* Resource already exists — trying to create a duplicate resource (HTTP 409).
|
|
99
99
|
* errorType: "already_exists"
|
|
100
100
|
*/
|
|
101
|
-
export class AlreadyExists extends Schema.
|
|
101
|
+
export class AlreadyExists extends Schema.TaggedError<AlreadyExists>()(
|
|
102
102
|
"AlreadyExists",
|
|
103
103
|
CoinbaseErrorFields,
|
|
104
104
|
).pipe(Category.withAlreadyExistsError) {}
|
|
@@ -109,7 +109,7 @@ export class AlreadyExists extends Schema.TaggedErrorClass<AlreadyExists>()(
|
|
|
109
109
|
* Faucet limit exceeded — too many faucet requests.
|
|
110
110
|
* errorType: "faucet_limit_exceeded"
|
|
111
111
|
*/
|
|
112
|
-
export class FaucetLimitExceeded extends Schema.
|
|
112
|
+
export class FaucetLimitExceeded extends Schema.TaggedError<FaucetLimitExceeded>()(
|
|
113
113
|
"FaucetLimitExceeded",
|
|
114
114
|
CoinbaseErrorFields,
|
|
115
115
|
).pipe(Category.withQuotaError) {}
|
|
@@ -120,7 +120,7 @@ export class FaucetLimitExceeded extends Schema.TaggedErrorClass<FaucetLimitExce
|
|
|
120
120
|
* Invalid SQL query — the underlying SQL string is invalid.
|
|
121
121
|
* errorType: "invalid_sql_query"
|
|
122
122
|
*/
|
|
123
|
-
export class InvalidSqlQuery extends Schema.
|
|
123
|
+
export class InvalidSqlQuery extends Schema.TaggedError<InvalidSqlQuery>()(
|
|
124
124
|
"InvalidSqlQuery",
|
|
125
125
|
CoinbaseErrorFields,
|
|
126
126
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -131,7 +131,7 @@ export class InvalidSqlQuery extends Schema.TaggedErrorClass<InvalidSqlQuery>()(
|
|
|
131
131
|
* Invalid signature — the transaction or message signature is invalid.
|
|
132
132
|
* errorType: "invalid_signature"
|
|
133
133
|
*/
|
|
134
|
-
export class InvalidSignature extends Schema.
|
|
134
|
+
export class InvalidSignature extends Schema.TaggedError<InvalidSignature>()(
|
|
135
135
|
"InvalidSignature",
|
|
136
136
|
CoinbaseErrorFields,
|
|
137
137
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -140,7 +140,7 @@ export class InvalidSignature extends Schema.TaggedErrorClass<InvalidSignature>(
|
|
|
140
140
|
* Malformed transaction — the transaction data is malformed.
|
|
141
141
|
* errorType: "malformed_transaction"
|
|
142
142
|
*/
|
|
143
|
-
export class MalformedTransaction extends Schema.
|
|
143
|
+
export class MalformedTransaction extends Schema.TaggedError<MalformedTransaction>()(
|
|
144
144
|
"MalformedTransaction",
|
|
145
145
|
CoinbaseErrorFields,
|
|
146
146
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -149,7 +149,7 @@ export class MalformedTransaction extends Schema.TaggedErrorClass<MalformedTrans
|
|
|
149
149
|
* Settlement failed — payment settlement could not be completed.
|
|
150
150
|
* errorType: "settlement_failed"
|
|
151
151
|
*/
|
|
152
|
-
export class SettlementFailed extends Schema.
|
|
152
|
+
export class SettlementFailed extends Schema.TaggedError<SettlementFailed>()(
|
|
153
153
|
"SettlementFailed",
|
|
154
154
|
CoinbaseErrorFields,
|
|
155
155
|
).pipe(Category.withServerError) {}
|
|
@@ -160,7 +160,7 @@ export class SettlementFailed extends Schema.TaggedErrorClass<SettlementFailed>(
|
|
|
160
160
|
* Request timed out — the server did not respond in time.
|
|
161
161
|
* errorType: "timed_out"
|
|
162
162
|
*/
|
|
163
|
-
export class TimedOut extends Schema.
|
|
163
|
+
export class TimedOut extends Schema.TaggedError<TimedOut>()(
|
|
164
164
|
"TimedOut",
|
|
165
165
|
CoinbaseErrorFields,
|
|
166
166
|
).pipe(Category.withTimeoutError, Category.withRetryable()) {}
|
|
@@ -169,7 +169,7 @@ export class TimedOut extends Schema.TaggedErrorClass<TimedOut>()(
|
|
|
169
169
|
* Client closed request — the client disconnected before the response.
|
|
170
170
|
* errorType: "client_closed_request"
|
|
171
171
|
*/
|
|
172
|
-
export class ClientClosedRequest extends Schema.
|
|
172
|
+
export class ClientClosedRequest extends Schema.TaggedError<ClientClosedRequest>()(
|
|
173
173
|
"ClientClosedRequest",
|
|
174
174
|
CoinbaseErrorFields,
|
|
175
175
|
).pipe(Category.withAbortedError) {}
|
|
@@ -178,7 +178,7 @@ export class ClientClosedRequest extends Schema.TaggedErrorClass<ClientClosedReq
|
|
|
178
178
|
* Request canceled — the request was canceled.
|
|
179
179
|
* errorType: "request_canceled"
|
|
180
180
|
*/
|
|
181
|
-
export class RequestCanceled extends Schema.
|
|
181
|
+
export class RequestCanceled extends Schema.TaggedError<RequestCanceled>()(
|
|
182
182
|
"RequestCanceled",
|
|
183
183
|
CoinbaseErrorFields,
|
|
184
184
|
).pipe(Category.withAbortedError) {}
|
|
@@ -189,7 +189,7 @@ export class RequestCanceled extends Schema.TaggedErrorClass<RequestCanceled>()(
|
|
|
189
189
|
* Policy violation — the request violated an account or project policy.
|
|
190
190
|
* errorType: "policy_violation"
|
|
191
191
|
*/
|
|
192
|
-
export class PolicyViolation extends Schema.
|
|
192
|
+
export class PolicyViolation extends Schema.TaggedError<PolicyViolation>()(
|
|
193
193
|
"PolicyViolation",
|
|
194
194
|
CoinbaseErrorFields,
|
|
195
195
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -198,7 +198,7 @@ export class PolicyViolation extends Schema.TaggedErrorClass<PolicyViolation>()(
|
|
|
198
198
|
* Policy in use — the policy cannot be deleted because it's in use.
|
|
199
199
|
* errorType: "policy_in_use"
|
|
200
200
|
*/
|
|
201
|
-
export class PolicyInUse extends Schema.
|
|
201
|
+
export class PolicyInUse extends Schema.TaggedError<PolicyInUse>()(
|
|
202
202
|
"PolicyInUse",
|
|
203
203
|
CoinbaseErrorFields,
|
|
204
204
|
).pipe(Category.withConflictError) {}
|
|
@@ -209,7 +209,7 @@ export class PolicyInUse extends Schema.TaggedErrorClass<PolicyInUse>()(
|
|
|
209
209
|
* Account limit exceeded — too many accounts created.
|
|
210
210
|
* errorType: "account_limit_exceeded"
|
|
211
211
|
*/
|
|
212
|
-
export class AccountLimitExceeded extends Schema.
|
|
212
|
+
export class AccountLimitExceeded extends Schema.TaggedError<AccountLimitExceeded>()(
|
|
213
213
|
"AccountLimitExceeded",
|
|
214
214
|
CoinbaseErrorFields,
|
|
215
215
|
).pipe(Category.withQuotaError) {}
|
|
@@ -218,7 +218,7 @@ export class AccountLimitExceeded extends Schema.TaggedErrorClass<AccountLimitEx
|
|
|
218
218
|
* Insufficient balance — the account does not have enough funds.
|
|
219
219
|
* errorType: "insufficient_balance"
|
|
220
220
|
*/
|
|
221
|
-
export class InsufficientBalance extends Schema.
|
|
221
|
+
export class InsufficientBalance extends Schema.TaggedError<InsufficientBalance>()(
|
|
222
222
|
"InsufficientBalance",
|
|
223
223
|
CoinbaseErrorFields,
|
|
224
224
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -227,7 +227,7 @@ export class InsufficientBalance extends Schema.TaggedErrorClass<InsufficientBal
|
|
|
227
227
|
* Account not ready — the account is not in a ready state for the operation.
|
|
228
228
|
* errorType: "account_not_ready"
|
|
229
229
|
*/
|
|
230
|
-
export class AccountNotReady extends Schema.
|
|
230
|
+
export class AccountNotReady extends Schema.TaggedError<AccountNotReady>()(
|
|
231
231
|
"AccountNotReady",
|
|
232
232
|
CoinbaseErrorFields,
|
|
233
233
|
).pipe(Category.withRetryableError, Category.withRetryable()) {}
|
|
@@ -238,7 +238,7 @@ export class AccountNotReady extends Schema.TaggedErrorClass<AccountNotReady>()(
|
|
|
238
238
|
* MFA required — multi-factor authentication is required.
|
|
239
239
|
* errorType: "mfa_required"
|
|
240
240
|
*/
|
|
241
|
-
export class MfaRequired extends Schema.
|
|
241
|
+
export class MfaRequired extends Schema.TaggedError<MfaRequired>()(
|
|
242
242
|
"MfaRequired",
|
|
243
243
|
CoinbaseErrorFields,
|
|
244
244
|
).pipe(Category.withAuthError) {}
|
|
@@ -247,7 +247,7 @@ export class MfaRequired extends Schema.TaggedErrorClass<MfaRequired>()(
|
|
|
247
247
|
* MFA already enrolled — the user already has MFA set up.
|
|
248
248
|
* errorType: "mfa_already_enrolled"
|
|
249
249
|
*/
|
|
250
|
-
export class MfaAlreadyEnrolled extends Schema.
|
|
250
|
+
export class MfaAlreadyEnrolled extends Schema.TaggedError<MfaAlreadyEnrolled>()(
|
|
251
251
|
"MfaAlreadyEnrolled",
|
|
252
252
|
CoinbaseErrorFields,
|
|
253
253
|
).pipe(Category.withConflictError) {}
|
|
@@ -256,7 +256,7 @@ export class MfaAlreadyEnrolled extends Schema.TaggedErrorClass<MfaAlreadyEnroll
|
|
|
256
256
|
* MFA invalid code — the provided MFA code is incorrect.
|
|
257
257
|
* errorType: "mfa_invalid_code"
|
|
258
258
|
*/
|
|
259
|
-
export class MfaInvalidCode extends Schema.
|
|
259
|
+
export class MfaInvalidCode extends Schema.TaggedError<MfaInvalidCode>()(
|
|
260
260
|
"MfaInvalidCode",
|
|
261
261
|
CoinbaseErrorFields,
|
|
262
262
|
).pipe(Category.withAuthError) {}
|
|
@@ -265,7 +265,7 @@ export class MfaInvalidCode extends Schema.TaggedErrorClass<MfaInvalidCode>()(
|
|
|
265
265
|
* MFA flow expired — the MFA verification flow has expired.
|
|
266
266
|
* errorType: "mfa_flow_expired"
|
|
267
267
|
*/
|
|
268
|
-
export class MfaFlowExpired extends Schema.
|
|
268
|
+
export class MfaFlowExpired extends Schema.TaggedError<MfaFlowExpired>()(
|
|
269
269
|
"MfaFlowExpired",
|
|
270
270
|
CoinbaseErrorFields,
|
|
271
271
|
).pipe(Category.withAuthError) {}
|
|
@@ -274,7 +274,7 @@ export class MfaFlowExpired extends Schema.TaggedErrorClass<MfaFlowExpired>()(
|
|
|
274
274
|
* MFA not enrolled — the user has not set up MFA.
|
|
275
275
|
* errorType: "mfa_not_enrolled"
|
|
276
276
|
*/
|
|
277
|
-
export class MfaNotEnrolled extends Schema.
|
|
277
|
+
export class MfaNotEnrolled extends Schema.TaggedError<MfaNotEnrolled>()(
|
|
278
278
|
"MfaNotEnrolled",
|
|
279
279
|
CoinbaseErrorFields,
|
|
280
280
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -285,7 +285,7 @@ export class MfaNotEnrolled extends Schema.TaggedErrorClass<MfaNotEnrolled>()(
|
|
|
285
285
|
* Network not tradable — the specified network does not support trading.
|
|
286
286
|
* errorType: "network_not_tradable"
|
|
287
287
|
*/
|
|
288
|
-
export class NetworkNotTradable extends Schema.
|
|
288
|
+
export class NetworkNotTradable extends Schema.TaggedError<NetworkNotTradable>()(
|
|
289
289
|
"NetworkNotTradable",
|
|
290
290
|
CoinbaseErrorFields,
|
|
291
291
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -296,7 +296,7 @@ export class NetworkNotTradable extends Schema.TaggedErrorClass<NetworkNotTradab
|
|
|
296
296
|
* Guest permission denied — the guest user does not have permission for this action.
|
|
297
297
|
* errorType: "guest_permission_denied"
|
|
298
298
|
*/
|
|
299
|
-
export class GuestPermissionDenied extends Schema.
|
|
299
|
+
export class GuestPermissionDenied extends Schema.TaggedError<GuestPermissionDenied>()(
|
|
300
300
|
"GuestPermissionDenied",
|
|
301
301
|
CoinbaseErrorFields,
|
|
302
302
|
).pipe(Category.withAuthError) {}
|
|
@@ -305,7 +305,7 @@ export class GuestPermissionDenied extends Schema.TaggedErrorClass<GuestPermissi
|
|
|
305
305
|
* Guest region forbidden — the guest user's region is not supported.
|
|
306
306
|
* errorType: "guest_region_forbidden"
|
|
307
307
|
*/
|
|
308
|
-
export class GuestRegionForbidden extends Schema.
|
|
308
|
+
export class GuestRegionForbidden extends Schema.TaggedError<GuestRegionForbidden>()(
|
|
309
309
|
"GuestRegionForbidden",
|
|
310
310
|
CoinbaseErrorFields,
|
|
311
311
|
).pipe(Category.withAuthError) {}
|
|
@@ -314,7 +314,7 @@ export class GuestRegionForbidden extends Schema.TaggedErrorClass<GuestRegionFor
|
|
|
314
314
|
* Guest transaction limit — the guest user has exceeded their transaction amount limit.
|
|
315
315
|
* errorType: "guest_transaction_limit"
|
|
316
316
|
*/
|
|
317
|
-
export class GuestTransactionLimit extends Schema.
|
|
317
|
+
export class GuestTransactionLimit extends Schema.TaggedError<GuestTransactionLimit>()(
|
|
318
318
|
"GuestTransactionLimit",
|
|
319
319
|
CoinbaseErrorFields,
|
|
320
320
|
).pipe(Category.withQuotaError) {}
|
|
@@ -323,7 +323,7 @@ export class GuestTransactionLimit extends Schema.TaggedErrorClass<GuestTransact
|
|
|
323
323
|
* Guest transaction count — the guest user has exceeded their transaction count limit.
|
|
324
324
|
* errorType: "guest_transaction_count"
|
|
325
325
|
*/
|
|
326
|
-
export class GuestTransactionCount extends Schema.
|
|
326
|
+
export class GuestTransactionCount extends Schema.TaggedError<GuestTransactionCount>()(
|
|
327
327
|
"GuestTransactionCount",
|
|
328
328
|
CoinbaseErrorFields,
|
|
329
329
|
).pipe(Category.withQuotaError) {}
|
|
@@ -334,7 +334,7 @@ export class GuestTransactionCount extends Schema.TaggedErrorClass<GuestTransact
|
|
|
334
334
|
* Phone number verification expired — the phone number verification has expired.
|
|
335
335
|
* errorType: "phone_number_verification_expired"
|
|
336
336
|
*/
|
|
337
|
-
export class PhoneNumberVerificationExpired extends Schema.
|
|
337
|
+
export class PhoneNumberVerificationExpired extends Schema.TaggedError<PhoneNumberVerificationExpired>()(
|
|
338
338
|
"PhoneNumberVerificationExpired",
|
|
339
339
|
CoinbaseErrorFields,
|
|
340
340
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -343,7 +343,7 @@ export class PhoneNumberVerificationExpired extends Schema.TaggedErrorClass<Phon
|
|
|
343
343
|
* Document verification failed — the document verification check failed.
|
|
344
344
|
* errorType: "document_verification_failed"
|
|
345
345
|
*/
|
|
346
|
-
export class DocumentVerificationFailed extends Schema.
|
|
346
|
+
export class DocumentVerificationFailed extends Schema.TaggedError<DocumentVerificationFailed>()(
|
|
347
347
|
"DocumentVerificationFailed",
|
|
348
348
|
CoinbaseErrorFields,
|
|
349
349
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -354,7 +354,7 @@ export class DocumentVerificationFailed extends Schema.TaggedErrorClass<Document
|
|
|
354
354
|
* Recipient allowlist violation — the recipient address is not on the allowlist.
|
|
355
355
|
* errorType: "recipient_allowlist_violation"
|
|
356
356
|
*/
|
|
357
|
-
export class RecipientAllowlistViolation extends Schema.
|
|
357
|
+
export class RecipientAllowlistViolation extends Schema.TaggedError<RecipientAllowlistViolation>()(
|
|
358
358
|
"RecipientAllowlistViolation",
|
|
359
359
|
CoinbaseErrorFields,
|
|
360
360
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -363,7 +363,7 @@ export class RecipientAllowlistViolation extends Schema.TaggedErrorClass<Recipie
|
|
|
363
363
|
* Recipient allowlist pending — the recipient address is pending allowlist approval.
|
|
364
364
|
* errorType: "recipient_allowlist_pending"
|
|
365
365
|
*/
|
|
366
|
-
export class RecipientAllowlistPending extends Schema.
|
|
366
|
+
export class RecipientAllowlistPending extends Schema.TaggedError<RecipientAllowlistPending>()(
|
|
367
367
|
"RecipientAllowlistPending",
|
|
368
368
|
CoinbaseErrorFields,
|
|
369
369
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -374,7 +374,7 @@ export class RecipientAllowlistPending extends Schema.TaggedErrorClass<Recipient
|
|
|
374
374
|
* Travel rules recipient violation — the recipient violates travel rule requirements.
|
|
375
375
|
* errorType: "travel_rules_recipient_violation"
|
|
376
376
|
*/
|
|
377
|
-
export class TravelRulesRecipientViolation extends Schema.
|
|
377
|
+
export class TravelRulesRecipientViolation extends Schema.TaggedError<TravelRulesRecipientViolation>()(
|
|
378
378
|
"TravelRulesRecipientViolation",
|
|
379
379
|
CoinbaseErrorFields,
|
|
380
380
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -383,7 +383,7 @@ export class TravelRulesRecipientViolation extends Schema.TaggedErrorClass<Trave
|
|
|
383
383
|
* Travel rules field missing — a required travel rules field is missing.
|
|
384
384
|
* errorType: "travel_rules_field_missing"
|
|
385
385
|
*/
|
|
386
|
-
export class TravelRulesFieldMissing extends Schema.
|
|
386
|
+
export class TravelRulesFieldMissing extends Schema.TaggedError<TravelRulesFieldMissing>()(
|
|
387
387
|
"TravelRulesFieldMissing",
|
|
388
388
|
CoinbaseErrorFields,
|
|
389
389
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -394,7 +394,7 @@ export class TravelRulesFieldMissing extends Schema.TaggedErrorClass<TravelRules
|
|
|
394
394
|
* Source account invalid — the source account is not valid for this operation.
|
|
395
395
|
* errorType: "source_account_invalid"
|
|
396
396
|
*/
|
|
397
|
-
export class SourceAccountInvalid extends Schema.
|
|
397
|
+
export class SourceAccountInvalid extends Schema.TaggedError<SourceAccountInvalid>()(
|
|
398
398
|
"SourceAccountInvalid",
|
|
399
399
|
CoinbaseErrorFields,
|
|
400
400
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -403,7 +403,7 @@ export class SourceAccountInvalid extends Schema.TaggedErrorClass<SourceAccountI
|
|
|
403
403
|
* Target account invalid — the target account is not valid for this operation.
|
|
404
404
|
* errorType: "target_account_invalid"
|
|
405
405
|
*/
|
|
406
|
-
export class TargetAccountInvalid extends Schema.
|
|
406
|
+
export class TargetAccountInvalid extends Schema.TaggedError<TargetAccountInvalid>()(
|
|
407
407
|
"TargetAccountInvalid",
|
|
408
408
|
CoinbaseErrorFields,
|
|
409
409
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -412,7 +412,7 @@ export class TargetAccountInvalid extends Schema.TaggedErrorClass<TargetAccountI
|
|
|
412
412
|
* Source account not found — the source account does not exist.
|
|
413
413
|
* errorType: "source_account_not_found"
|
|
414
414
|
*/
|
|
415
|
-
export class SourceAccountNotFound extends Schema.
|
|
415
|
+
export class SourceAccountNotFound extends Schema.TaggedError<SourceAccountNotFound>()(
|
|
416
416
|
"SourceAccountNotFound",
|
|
417
417
|
CoinbaseErrorFields,
|
|
418
418
|
).pipe(Category.withNotFoundError) {}
|
|
@@ -421,7 +421,7 @@ export class SourceAccountNotFound extends Schema.TaggedErrorClass<SourceAccount
|
|
|
421
421
|
* Target account not found — the target account does not exist.
|
|
422
422
|
* errorType: "target_account_not_found"
|
|
423
423
|
*/
|
|
424
|
-
export class TargetAccountNotFound extends Schema.
|
|
424
|
+
export class TargetAccountNotFound extends Schema.TaggedError<TargetAccountNotFound>()(
|
|
425
425
|
"TargetAccountNotFound",
|
|
426
426
|
CoinbaseErrorFields,
|
|
427
427
|
).pipe(Category.withNotFoundError) {}
|
|
@@ -432,7 +432,7 @@ export class TargetAccountNotFound extends Schema.TaggedErrorClass<TargetAccount
|
|
|
432
432
|
* Source asset not supported — the source asset is not supported for this operation.
|
|
433
433
|
* errorType: "source_asset_not_supported"
|
|
434
434
|
*/
|
|
435
|
-
export class SourceAssetNotSupported extends Schema.
|
|
435
|
+
export class SourceAssetNotSupported extends Schema.TaggedError<SourceAssetNotSupported>()(
|
|
436
436
|
"SourceAssetNotSupported",
|
|
437
437
|
CoinbaseErrorFields,
|
|
438
438
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -441,7 +441,7 @@ export class SourceAssetNotSupported extends Schema.TaggedErrorClass<SourceAsset
|
|
|
441
441
|
* Target asset not supported — the target asset is not supported for this operation.
|
|
442
442
|
* errorType: "target_asset_not_supported"
|
|
443
443
|
*/
|
|
444
|
-
export class TargetAssetNotSupported extends Schema.
|
|
444
|
+
export class TargetAssetNotSupported extends Schema.TaggedError<TargetAssetNotSupported>()(
|
|
445
445
|
"TargetAssetNotSupported",
|
|
446
446
|
CoinbaseErrorFields,
|
|
447
447
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -450,7 +450,7 @@ export class TargetAssetNotSupported extends Schema.TaggedErrorClass<TargetAsset
|
|
|
450
450
|
* Transfer asset not supported — the asset is not supported for transfers.
|
|
451
451
|
* errorType: "transfer_asset_not_supported"
|
|
452
452
|
*/
|
|
453
|
-
export class TransferAssetNotSupported extends Schema.
|
|
453
|
+
export class TransferAssetNotSupported extends Schema.TaggedError<TransferAssetNotSupported>()(
|
|
454
454
|
"TransferAssetNotSupported",
|
|
455
455
|
CoinbaseErrorFields,
|
|
456
456
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -459,7 +459,7 @@ export class TransferAssetNotSupported extends Schema.TaggedErrorClass<TransferA
|
|
|
459
459
|
* Asset mismatch — the source and target assets do not match as expected.
|
|
460
460
|
* errorType: "asset_mismatch"
|
|
461
461
|
*/
|
|
462
|
-
export class AssetMismatch extends Schema.
|
|
462
|
+
export class AssetMismatch extends Schema.TaggedError<AssetMismatch>()(
|
|
463
463
|
"AssetMismatch",
|
|
464
464
|
CoinbaseErrorFields,
|
|
465
465
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -470,7 +470,7 @@ export class AssetMismatch extends Schema.TaggedErrorClass<AssetMismatch>()(
|
|
|
470
470
|
* Target email invalid — the target email address is not valid.
|
|
471
471
|
* errorType: "target_email_invalid"
|
|
472
472
|
*/
|
|
473
|
-
export class TargetEmailInvalid extends Schema.
|
|
473
|
+
export class TargetEmailInvalid extends Schema.TaggedError<TargetEmailInvalid>()(
|
|
474
474
|
"TargetEmailInvalid",
|
|
475
475
|
CoinbaseErrorFields,
|
|
476
476
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -479,7 +479,7 @@ export class TargetEmailInvalid extends Schema.TaggedErrorClass<TargetEmailInval
|
|
|
479
479
|
* Target onchain address invalid — the target onchain address is not valid.
|
|
480
480
|
* errorType: "target_onchain_address_invalid"
|
|
481
481
|
*/
|
|
482
|
-
export class TargetOnchainAddressInvalid extends Schema.
|
|
482
|
+
export class TargetOnchainAddressInvalid extends Schema.TaggedError<TargetOnchainAddressInvalid>()(
|
|
483
483
|
"TargetOnchainAddressInvalid",
|
|
484
484
|
CoinbaseErrorFields,
|
|
485
485
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -488,7 +488,7 @@ export class TargetOnchainAddressInvalid extends Schema.TaggedErrorClass<TargetO
|
|
|
488
488
|
* Transfer amount invalid — the transfer amount is not valid.
|
|
489
489
|
* errorType: "transfer_amount_invalid"
|
|
490
490
|
*/
|
|
491
|
-
export class TransferAmountInvalid extends Schema.
|
|
491
|
+
export class TransferAmountInvalid extends Schema.TaggedError<TransferAmountInvalid>()(
|
|
492
492
|
"TransferAmountInvalid",
|
|
493
493
|
CoinbaseErrorFields,
|
|
494
494
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -499,7 +499,7 @@ export class TransferAmountInvalid extends Schema.TaggedErrorClass<TransferAmoun
|
|
|
499
499
|
* Metadata too many entries — too many metadata entries were provided.
|
|
500
500
|
* errorType: "metadata_too_many_entries"
|
|
501
501
|
*/
|
|
502
|
-
export class MetadataTooManyEntries extends Schema.
|
|
502
|
+
export class MetadataTooManyEntries extends Schema.TaggedError<MetadataTooManyEntries>()(
|
|
503
503
|
"MetadataTooManyEntries",
|
|
504
504
|
CoinbaseErrorFields,
|
|
505
505
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -508,7 +508,7 @@ export class MetadataTooManyEntries extends Schema.TaggedErrorClass<MetadataTooM
|
|
|
508
508
|
* Metadata key too long — a metadata key exceeds the maximum length.
|
|
509
509
|
* errorType: "metadata_key_too_long"
|
|
510
510
|
*/
|
|
511
|
-
export class MetadataKeyTooLong extends Schema.
|
|
511
|
+
export class MetadataKeyTooLong extends Schema.TaggedError<MetadataKeyTooLong>()(
|
|
512
512
|
"MetadataKeyTooLong",
|
|
513
513
|
CoinbaseErrorFields,
|
|
514
514
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -517,7 +517,7 @@ export class MetadataKeyTooLong extends Schema.TaggedErrorClass<MetadataKeyTooLo
|
|
|
517
517
|
* Metadata value too long — a metadata value exceeds the maximum length.
|
|
518
518
|
* errorType: "metadata_value_too_long"
|
|
519
519
|
*/
|
|
520
|
-
export class MetadataValueTooLong extends Schema.
|
|
520
|
+
export class MetadataValueTooLong extends Schema.TaggedError<MetadataValueTooLong>()(
|
|
521
521
|
"MetadataValueTooLong",
|
|
522
522
|
CoinbaseErrorFields,
|
|
523
523
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -528,7 +528,7 @@ export class MetadataValueTooLong extends Schema.TaggedErrorClass<MetadataValueT
|
|
|
528
528
|
* Order quote expired — the order quote has expired and must be refreshed.
|
|
529
529
|
* errorType: "order_quote_expired"
|
|
530
530
|
*/
|
|
531
|
-
export class OrderQuoteExpired extends Schema.
|
|
531
|
+
export class OrderQuoteExpired extends Schema.TaggedError<OrderQuoteExpired>()(
|
|
532
532
|
"OrderQuoteExpired",
|
|
533
533
|
CoinbaseErrorFields,
|
|
534
534
|
).pipe(Category.withBadRequestError) {}
|
|
@@ -537,7 +537,7 @@ export class OrderQuoteExpired extends Schema.TaggedErrorClass<OrderQuoteExpired
|
|
|
537
537
|
* Order already filled — the order has already been filled.
|
|
538
538
|
* errorType: "order_already_filled"
|
|
539
539
|
*/
|
|
540
|
-
export class OrderAlreadyFilled extends Schema.
|
|
540
|
+
export class OrderAlreadyFilled extends Schema.TaggedError<OrderAlreadyFilled>()(
|
|
541
541
|
"OrderAlreadyFilled",
|
|
542
542
|
CoinbaseErrorFields,
|
|
543
543
|
).pipe(Category.withConflictError) {}
|
|
@@ -546,7 +546,7 @@ export class OrderAlreadyFilled extends Schema.TaggedErrorClass<OrderAlreadyFill
|
|
|
546
546
|
* Order already canceled — the order has already been canceled.
|
|
547
547
|
* errorType: "order_already_canceled"
|
|
548
548
|
*/
|
|
549
|
-
export class OrderAlreadyCanceled extends Schema.
|
|
549
|
+
export class OrderAlreadyCanceled extends Schema.TaggedError<OrderAlreadyCanceled>()(
|
|
550
550
|
"OrderAlreadyCanceled",
|
|
551
551
|
CoinbaseErrorFields,
|
|
552
552
|
).pipe(Category.withConflictError) {}
|
|
@@ -682,7 +682,7 @@ export const ERROR_TYPE_MAP: Record<string, new (props: any) => unknown> = {
|
|
|
682
682
|
/**
|
|
683
683
|
* Unknown Coinbase error — returned when an errorType is not recognized.
|
|
684
684
|
*/
|
|
685
|
-
export class UnknownCoinbaseError extends Schema.
|
|
685
|
+
export class UnknownCoinbaseError extends Schema.TaggedError<UnknownCoinbaseError>()(
|
|
686
686
|
"UnknownCoinbaseError",
|
|
687
687
|
{
|
|
688
688
|
...CoinbaseErrorFields,
|
|
@@ -693,7 +693,7 @@ export class UnknownCoinbaseError extends Schema.TaggedErrorClass<UnknownCoinbas
|
|
|
693
693
|
/**
|
|
694
694
|
* Schema parse error wrapper — returned when the response body fails schema decoding.
|
|
695
695
|
*/
|
|
696
|
-
export class CoinbaseParseError extends Schema.
|
|
696
|
+
export class CoinbaseParseError extends Schema.TaggedError<CoinbaseParseError>()(
|
|
697
697
|
"CoinbaseParseError",
|
|
698
698
|
{
|
|
699
699
|
body: Schema.Unknown,
|
package/src/services/cdp.ts
CHANGED
|
@@ -568,15 +568,8 @@ export const MFAMethodsTotp = /*@__PURE__*/ S.suspend(() =>
|
|
|
568
568
|
).annotate({ identifier: "MFAMethodsTotp" }) as any as S.Schema<MFAMethodsTotp>;
|
|
569
569
|
|
|
570
570
|
/** An object containing information about the end user's SMS MFA enrollment. */
|
|
571
|
-
export
|
|
572
|
-
|
|
573
|
-
enrolledAt: string;
|
|
574
|
-
}
|
|
575
|
-
export const MFAMethodsSms = /*@__PURE__*/ S.suspend(() =>
|
|
576
|
-
S.Struct({
|
|
577
|
-
enrolledAt: S.String,
|
|
578
|
-
}),
|
|
579
|
-
).annotate({ identifier: "MFAMethodsSms" }) as any as S.Schema<MFAMethodsSms>;
|
|
571
|
+
export type MFAMethodsSms = MFAMethodsTotp;
|
|
572
|
+
export const MFAMethodsSms = MFAMethodsTotp;
|
|
580
573
|
|
|
581
574
|
/** Information about the end user's MFA enrollments. */
|
|
582
575
|
export interface MFAMethods {
|
|
@@ -585,13 +578,13 @@ export interface MFAMethods {
|
|
|
585
578
|
/** An object containing information about the end user's TOTP enrollment. */
|
|
586
579
|
totp?: MFAMethodsTotp;
|
|
587
580
|
/** An object containing information about the end user's SMS MFA enrollment. */
|
|
588
|
-
sms?:
|
|
581
|
+
sms?: MFAMethodsTotp;
|
|
589
582
|
}
|
|
590
583
|
export const MFAMethods = /*@__PURE__*/ S.suspend(() =>
|
|
591
584
|
S.Struct({
|
|
592
585
|
enrollmentPromptedAt: S.optional(S.String),
|
|
593
586
|
totp: S.optional(MFAMethodsTotp),
|
|
594
|
-
sms: S.optional(
|
|
587
|
+
sms: S.optional(MFAMethodsTotp),
|
|
595
588
|
}),
|
|
596
589
|
).annotate({ identifier: "MFAMethods" }) as any as S.Schema<MFAMethods>;
|
|
597
590
|
|
|
@@ -4870,74 +4863,24 @@ export const GetEvmSwapPriceRequest = /*@__PURE__*/ S.suspend(() =>
|
|
|
4870
4863
|
}) as any as S.Schema<GetEvmSwapPriceRequest>;
|
|
4871
4864
|
|
|
4872
4865
|
/** The estimated fees for the swap. */
|
|
4873
|
-
export
|
|
4874
|
-
|
|
4875
|
-
gasFee: TokenFee | null;
|
|
4876
|
-
/** The estimated protocol fee for the swap. */
|
|
4877
|
-
protocolFee: TokenFee | null;
|
|
4878
|
-
}
|
|
4879
|
-
export const GetSwapPriceResponseFees = /*@__PURE__*/ S.suspend(() =>
|
|
4880
|
-
S.Struct({
|
|
4881
|
-
gasFee: S.NullOr(TokenFee),
|
|
4882
|
-
protocolFee: S.NullOr(TokenFee),
|
|
4883
|
-
}),
|
|
4884
|
-
).annotate({
|
|
4885
|
-
identifier: "GetSwapPriceResponseFees",
|
|
4886
|
-
}) as any as S.Schema<GetSwapPriceResponseFees>;
|
|
4866
|
+
export type GetSwapPriceResponseFees = CreateSwapQuoteResponseFees;
|
|
4867
|
+
export const GetSwapPriceResponseFees = CreateSwapQuoteResponseFees;
|
|
4887
4868
|
|
|
4888
4869
|
/** Details of the allowances that the taker must set in order to execute the swap successfully. Null if no allowance is required. */
|
|
4889
|
-
export
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
spender: string;
|
|
4894
|
-
}
|
|
4895
|
-
export const GetSwapPriceResponseIssuesAllowance = /*@__PURE__*/ S.suspend(() =>
|
|
4896
|
-
S.Struct({
|
|
4897
|
-
currentAllowance: S.String,
|
|
4898
|
-
spender: S.String,
|
|
4899
|
-
}),
|
|
4900
|
-
).annotate({
|
|
4901
|
-
identifier: "GetSwapPriceResponseIssuesAllowance",
|
|
4902
|
-
}) as any as S.Schema<GetSwapPriceResponseIssuesAllowance>;
|
|
4870
|
+
export type GetSwapPriceResponseIssuesAllowance =
|
|
4871
|
+
CreateSwapQuoteResponseIssuesAllowance;
|
|
4872
|
+
export const GetSwapPriceResponseIssuesAllowance =
|
|
4873
|
+
CreateSwapQuoteResponseIssuesAllowance;
|
|
4903
4874
|
|
|
4904
4875
|
/** Details of the balance of the `fromToken` that the `taker` must hold. Null if the `taker` has a sufficient balance. */
|
|
4905
|
-
export
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
currentBalance: string;
|
|
4910
|
-
/** The amount of the token that the `taker` must hold. */
|
|
4911
|
-
requiredBalance: string;
|
|
4912
|
-
}
|
|
4913
|
-
export const GetSwapPriceResponseIssuesBalance = /*@__PURE__*/ S.suspend(() =>
|
|
4914
|
-
S.Struct({
|
|
4915
|
-
token: S.String,
|
|
4916
|
-
currentBalance: S.String,
|
|
4917
|
-
requiredBalance: S.String,
|
|
4918
|
-
}),
|
|
4919
|
-
).annotate({
|
|
4920
|
-
identifier: "GetSwapPriceResponseIssuesBalance",
|
|
4921
|
-
}) as any as S.Schema<GetSwapPriceResponseIssuesBalance>;
|
|
4876
|
+
export type GetSwapPriceResponseIssuesBalance =
|
|
4877
|
+
CreateSwapQuoteResponseIssuesBalance;
|
|
4878
|
+
export const GetSwapPriceResponseIssuesBalance =
|
|
4879
|
+
CreateSwapQuoteResponseIssuesBalance;
|
|
4922
4880
|
|
|
4923
4881
|
/** An object containing potential issues discovered during validation that could prevent the swap from being executed successfully. */
|
|
4924
|
-
export
|
|
4925
|
-
|
|
4926
|
-
allowance: GetSwapPriceResponseIssuesAllowance | null;
|
|
4927
|
-
/** Details of the balance of the `fromToken` that the `taker` must hold. Null if the `taker` has a sufficient balance. */
|
|
4928
|
-
balance: GetSwapPriceResponseIssuesBalance | null;
|
|
4929
|
-
/** This is set to true when the transaction cannot be validated. This can happen when the taker has an insufficient balance of the `fromToken`. Note that this does not necessarily mean that the trade will revert. */
|
|
4930
|
-
simulationIncomplete: boolean;
|
|
4931
|
-
}
|
|
4932
|
-
export const GetSwapPriceResponseIssues = /*@__PURE__*/ S.suspend(() =>
|
|
4933
|
-
S.Struct({
|
|
4934
|
-
allowance: S.NullOr(GetSwapPriceResponseIssuesAllowance),
|
|
4935
|
-
balance: S.NullOr(GetSwapPriceResponseIssuesBalance),
|
|
4936
|
-
simulationIncomplete: S.Boolean,
|
|
4937
|
-
}),
|
|
4938
|
-
).annotate({
|
|
4939
|
-
identifier: "GetSwapPriceResponseIssues",
|
|
4940
|
-
}) as any as S.Schema<GetSwapPriceResponseIssues>;
|
|
4882
|
+
export type GetSwapPriceResponseIssues = CreateSwapQuoteResponseIssues;
|
|
4883
|
+
export const GetSwapPriceResponseIssues = CreateSwapQuoteResponseIssues;
|
|
4941
4884
|
|
|
4942
4885
|
export interface GetSwapPriceResponse {
|
|
4943
4886
|
/** The block number at which the liquidity conditions were examined. */
|
|
@@ -4947,9 +4890,9 @@ export interface GetSwapPriceResponse {
|
|
|
4947
4890
|
/** The 0x-prefixed contract address of the token that will be received. */
|
|
4948
4891
|
toToken: string;
|
|
4949
4892
|
/** The estimated fees for the swap. */
|
|
4950
|
-
fees:
|
|
4893
|
+
fees: CreateSwapQuoteResponseFees;
|
|
4951
4894
|
/** An object containing potential issues discovered during validation that could prevent the swap from being executed successfully. */
|
|
4952
|
-
issues:
|
|
4895
|
+
issues: CreateSwapQuoteResponseIssues;
|
|
4953
4896
|
/** Whether sufficient liquidity is available to settle the swap. All other fields in the response will be empty if this is false. */
|
|
4954
4897
|
liquidityAvailable: boolean;
|
|
4955
4898
|
/** The minimum amount of the `toToken` that must be received for the swap to succeed, in atomic units of the `toToken`. For example, `1000000000000000000` when receiving ETH equates to 1 ETH, `1000000` when receiving USDC equates to 1 USDC, etc. This value is influenced by the `slippageBps` parameter. */
|
|
@@ -4968,8 +4911,8 @@ export const GetSwapPriceResponse = /*@__PURE__*/ S.suspend(() =>
|
|
|
4968
4911
|
blockNumber: S.String,
|
|
4969
4912
|
toAmount: S.String,
|
|
4970
4913
|
toToken: S.String,
|
|
4971
|
-
fees:
|
|
4972
|
-
issues:
|
|
4914
|
+
fees: CreateSwapQuoteResponseFees,
|
|
4915
|
+
issues: CreateSwapQuoteResponseIssues,
|
|
4973
4916
|
liquidityAvailable: S.Boolean,
|
|
4974
4917
|
minToAmount: S.String,
|
|
4975
4918
|
fromAmount: S.String,
|