@circle-fin/developer-controlled-wallets 9.6.0 → 10.0.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/package.json +1 -1
- package/dist/developer-controlled-wallets.cjs.js +0 -57
- package/dist/developer-controlled-wallets.es.js +0 -57
- package/dist/types/clients/configurations.d.ts +0 -1614
- package/dist/types/clients/core.d.ts +0 -357
- package/dist/types/clients/developer-controlled-wallets.d.ts +0 -4806
- package/dist/types/developer-controlled-wallets.d.ts +0 -1530
|
@@ -1,357 +0,0 @@
|
|
|
1
|
-
import * as _shared_clients_configurations from './configurations';
|
|
2
|
-
import { ConfigurationsClient, Blockchain, TokenMonitorScope, TestnetBlockchain } from './configurations';
|
|
3
|
-
import * as axios from 'axios';
|
|
4
|
-
import { AxiosResponse } from 'axios';
|
|
5
|
-
|
|
6
|
-
type TrimDataResponse<T extends {
|
|
7
|
-
data?: unknown;
|
|
8
|
-
}> = Omit<AxiosResponse<T>, 'data'> & {
|
|
9
|
-
data?: T['data'];
|
|
10
|
-
};
|
|
11
|
-
interface Storage<TStoredData extends object = object> {
|
|
12
|
-
/**
|
|
13
|
-
* Retrieves the value associated with a given key from the storage.
|
|
14
|
-
* @param key - The key of the value to retrieve.
|
|
15
|
-
* @returns A promise that resolves to the corresponding value, or undefined if not found.
|
|
16
|
-
*/
|
|
17
|
-
get<TKey extends keyof TStoredData>(key: TKey): Promise<TStoredData[TKey] | undefined>;
|
|
18
|
-
/**
|
|
19
|
-
* Sets a value associated with a given key in the storage.
|
|
20
|
-
* @param key - The key of the value to set.
|
|
21
|
-
* @param value - The value to store.
|
|
22
|
-
* @returns A promise that resolves when the operation is complete.
|
|
23
|
-
*/
|
|
24
|
-
set<TKey extends keyof TStoredData>(key: TKey, value: TStoredData[TKey] | undefined): Promise<void>;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Represents pagination options for querying items.
|
|
28
|
-
*/
|
|
29
|
-
interface Pagination {
|
|
30
|
-
/**
|
|
31
|
-
* Start time of the query, inclusive.
|
|
32
|
-
*/
|
|
33
|
-
from?: string;
|
|
34
|
-
/**
|
|
35
|
-
* End time of the query, inclusive. Defaults to the current time.
|
|
36
|
-
*/
|
|
37
|
-
to?: string;
|
|
38
|
-
/**
|
|
39
|
-
* Used to return items before the specified item exclusively.
|
|
40
|
-
* SHOULD NOT be used in conjunction with `pageAfter`.
|
|
41
|
-
*/
|
|
42
|
-
pageBefore?: string;
|
|
43
|
-
/**
|
|
44
|
-
* Used to return items after the specified item exclusively.
|
|
45
|
-
* SHOULD NOT be used in conjunction with `pageBefore`.
|
|
46
|
-
*/
|
|
47
|
-
pageAfter?: string;
|
|
48
|
-
/**
|
|
49
|
-
* The number of items to return.
|
|
50
|
-
*/
|
|
51
|
-
pageSize?: number;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Common interface for all API requests.
|
|
55
|
-
*/
|
|
56
|
-
type Common = {
|
|
57
|
-
/**
|
|
58
|
-
* Developer-provided parameter used to identify this request.
|
|
59
|
-
*/
|
|
60
|
-
xRequestId?: string;
|
|
61
|
-
};
|
|
62
|
-
interface APIParams<TClient = unknown, TStoredData extends object = object> {
|
|
63
|
-
/**
|
|
64
|
-
* Storage solution for persisting data.
|
|
65
|
-
*/
|
|
66
|
-
storage?: Storage<TStoredData>;
|
|
67
|
-
/**
|
|
68
|
-
* An instance of the Main Client. Ready to be used.
|
|
69
|
-
*/
|
|
70
|
-
client: TClient;
|
|
71
|
-
/**
|
|
72
|
-
* An instance of the ConfigurationsClient. Ready to be used.
|
|
73
|
-
*/
|
|
74
|
-
configurationsClient: ConfigurationsClient;
|
|
75
|
-
}
|
|
76
|
-
interface ClientParams<TStoredData extends object = object> {
|
|
77
|
-
/**
|
|
78
|
-
* Api Key that is used to authenticate against Circle APIs.
|
|
79
|
-
*/
|
|
80
|
-
apiKey: string;
|
|
81
|
-
/**
|
|
82
|
-
* Optional base URL to override the default: `https://api.circle.com`.
|
|
83
|
-
*/
|
|
84
|
-
baseUrl?: string;
|
|
85
|
-
/**
|
|
86
|
-
* Optional custom user agent request header. We will prepend it to default user agent header if provided.
|
|
87
|
-
*/
|
|
88
|
-
userAgent?: string;
|
|
89
|
-
/**
|
|
90
|
-
* Optional custom storage solution for persisting data. We will fallback to InMemoryStorage if none was provided.
|
|
91
|
-
*/
|
|
92
|
-
storage?: Storage<TStoredData>;
|
|
93
|
-
/**
|
|
94
|
-
* Additional headers that should be added to each request.
|
|
95
|
-
*/
|
|
96
|
-
headers?: Record<string, string>;
|
|
97
|
-
}
|
|
98
|
-
type APIReturnType<T extends {
|
|
99
|
-
data?: unknown;
|
|
100
|
-
}> = Promise<TrimDataResponse<T>>;
|
|
101
|
-
/**
|
|
102
|
-
* Represents the configuration for setting fees.
|
|
103
|
-
* It can be either FeeLevelInput, GasInput, or FeeInput.
|
|
104
|
-
*/
|
|
105
|
-
type FeeConfiguration<TFeeLevel> = {
|
|
106
|
-
/**
|
|
107
|
-
* Use absolute numbers to determine the fees that should be paid.
|
|
108
|
-
*/
|
|
109
|
-
type: 'absolute';
|
|
110
|
-
config: {
|
|
111
|
-
/**
|
|
112
|
-
* The maximum price per gas unit (see gasLimit), in gwei.
|
|
113
|
-
* Requires priorityFee, and gasLimit, but incompatible with feeLevel or gasPrice.
|
|
114
|
-
* Use the Estimate Fee methods to get this fee's estimates.
|
|
115
|
-
*/
|
|
116
|
-
maxFee: string;
|
|
117
|
-
/**
|
|
118
|
-
* Requires maxFee, and gasLimit but incompatible with feeLevel or gasPrice.
|
|
119
|
-
* Use the Estimate Fee methods for fee estimates.
|
|
120
|
-
*/
|
|
121
|
-
priorityFee: string;
|
|
122
|
-
/**
|
|
123
|
-
* The maximum gas units for the transaction, required if feeLevel isn't provided.
|
|
124
|
-
* Use the Estimate Fee methods for this limit's estimation.
|
|
125
|
-
*/
|
|
126
|
-
gasLimit: string;
|
|
127
|
-
};
|
|
128
|
-
} | {
|
|
129
|
-
/**
|
|
130
|
-
* Use gasLimit and gasPrice for fee determination.
|
|
131
|
-
*/
|
|
132
|
-
type: 'gas';
|
|
133
|
-
config: {
|
|
134
|
-
/**
|
|
135
|
-
* The maximum gas units for the transaction, required if feeLevel is not provided.
|
|
136
|
-
* Use the Estimate Fee methods for this limit's estimation.
|
|
137
|
-
*/
|
|
138
|
-
gasLimit: string;
|
|
139
|
-
/**
|
|
140
|
-
* For EIP-1559 supported blockchains, it's the max gas price per gas unit (see gasLimit), in gwei.
|
|
141
|
-
* Requires gasLimit and incompatible with feeLevel, priorityFee, or maxFee.
|
|
142
|
-
* Use the Estimate Fee methods for fee estimates.
|
|
143
|
-
*/
|
|
144
|
-
gasPrice: string;
|
|
145
|
-
};
|
|
146
|
-
} | {
|
|
147
|
-
/**
|
|
148
|
-
* Use the fee level to configure the fees that will be paid.
|
|
149
|
-
*/
|
|
150
|
-
type: 'level';
|
|
151
|
-
config: {
|
|
152
|
-
/**
|
|
153
|
-
* A dynamic fee level setting (LOW, MEDIUM, HIGH) determining the gas price for the transaction,
|
|
154
|
-
* based on network conditions. Incompatible with gasLimit, gasPrice, priorityFee, or maxFee.
|
|
155
|
-
* Use the Estimate Fee methods for fee level estimates.
|
|
156
|
-
*/
|
|
157
|
-
feeLevel: TFeeLevel;
|
|
158
|
-
};
|
|
159
|
-
};
|
|
160
|
-
/**
|
|
161
|
-
* Represents the input to delete a monitored token.
|
|
162
|
-
*/
|
|
163
|
-
type DeleteMonitoredTokensInput = {
|
|
164
|
-
/**
|
|
165
|
-
* Token ids to be removed from the monitored tokens list. Once removed, these tokens will no longer be shown by default when fetching wallet balances.
|
|
166
|
-
*/
|
|
167
|
-
tokenIds: Array<string>;
|
|
168
|
-
};
|
|
169
|
-
/**
|
|
170
|
-
* Represents the input to list all monitored tokens.
|
|
171
|
-
*/
|
|
172
|
-
type ListMonitoredTokensInput = {
|
|
173
|
-
blockchain?: Blockchain;
|
|
174
|
-
tokenAddress?: string;
|
|
175
|
-
symbol?: string;
|
|
176
|
-
} & Pagination;
|
|
177
|
-
/**
|
|
178
|
-
* Represents the input to create monitored tokens.
|
|
179
|
-
*/
|
|
180
|
-
interface CreateMonitoredTokensInput {
|
|
181
|
-
/**
|
|
182
|
-
* The list of tokens to add to the monitored tokens list. When fetching wallet balances, only these tokens will be shown by default.
|
|
183
|
-
*/
|
|
184
|
-
tokenIds: Array<string>;
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Represents the input to update monitored tokens.
|
|
188
|
-
*/
|
|
189
|
-
interface UpdateMonitoredTokensInput {
|
|
190
|
-
/**
|
|
191
|
-
* The list of tokens that will be added to the monitored tokens list. When fetching wallet balances, these tokens will be shown by default.
|
|
192
|
-
*/
|
|
193
|
-
tokenIds?: Array<string>;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Represents the input select between monitoring all tokens or selected tokens added to the monitored tokens list.
|
|
197
|
-
*/
|
|
198
|
-
interface UpdateMonitoredTokensScopeInput {
|
|
199
|
-
/**
|
|
200
|
-
* Select between monitoring all tokens or selected tokens added to the monitored tokens list.
|
|
201
|
-
*/
|
|
202
|
-
scope: TokenMonitorScope;
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Required parameters to create a new subscription.
|
|
206
|
-
*/
|
|
207
|
-
interface CreateSubscriptionInput {
|
|
208
|
-
/**
|
|
209
|
-
* URL of the endpoint to subscribe to notifications. Must be publicly accessible, use HTTPS, and respond with a 2XX status to a POST request.
|
|
210
|
-
*/
|
|
211
|
-
endpoint: string;
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Represents the input to update a subscription .
|
|
215
|
-
*/
|
|
216
|
-
interface UpdateSubscriptionInput {
|
|
217
|
-
/**
|
|
218
|
-
* Subscription ID.
|
|
219
|
-
*/
|
|
220
|
-
id: string;
|
|
221
|
-
/**
|
|
222
|
-
* Name of the subscription.
|
|
223
|
-
*/
|
|
224
|
-
name: string;
|
|
225
|
-
/**
|
|
226
|
-
* Whether the subscription is enabled. `true` indicates the subscription is active.
|
|
227
|
-
*/
|
|
228
|
-
enabled: boolean;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
declare const getPublicKey: ({ configurationsClient }: APIParams) => () => Promise<TrimDataResponse<_shared_clients_configurations.PublicKey>>;
|
|
232
|
-
|
|
233
|
-
declare const createMonitoredTokens: ({ configurationsClient }: APIParams) => (input: CreateMonitoredTokensInput) => Promise<TrimDataResponse<_shared_clients_configurations.MonitoredTokens>>;
|
|
234
|
-
|
|
235
|
-
declare const deleteMonitoredTokens: ({ configurationsClient }: APIParams) => (input: DeleteMonitoredTokensInput) => Promise<axios.AxiosResponse<void, any, {}>>;
|
|
236
|
-
|
|
237
|
-
declare const listMonitoredTokens: ({ configurationsClient }: APIParams) => (input?: ListMonitoredTokensInput) => Promise<TrimDataResponse<_shared_clients_configurations.MonitoredTokens>>;
|
|
238
|
-
|
|
239
|
-
declare const updateMonitoredTokens: ({ configurationsClient }: APIParams) => (input: UpdateMonitoredTokensInput) => Promise<TrimDataResponse<_shared_clients_configurations.MonitoredTokens>>;
|
|
240
|
-
|
|
241
|
-
declare const updateMonitoredTokensScope: ({ configurationsClient, }: APIParams) => (input: UpdateMonitoredTokensScopeInput) => Promise<axios.AxiosResponse<void, any, {}>>;
|
|
242
|
-
|
|
243
|
-
declare const createSubscription: ({ configurationsClient }: APIParams) => (input: CreateSubscriptionInput) => Promise<TrimDataResponse<_shared_clients_configurations.SubscriptionResponse>>;
|
|
244
|
-
|
|
245
|
-
declare const deleteSubscription: ({ configurationsClient }: APIParams) => (subscriptionId: string) => Promise<axios.AxiosResponse<void, any, {}>>;
|
|
246
|
-
|
|
247
|
-
declare const getSubscription: ({ configurationsClient }: APIParams) => (subscriptionId: string) => Promise<TrimDataResponse<_shared_clients_configurations.SubscriptionResponse>>;
|
|
248
|
-
|
|
249
|
-
declare const getNotificationSignature: ({ configurationsClient, }: APIParams) => (subscriptionId: string) => Promise<TrimDataResponse<_shared_clients_configurations.NotificationSignaturePublicKey>>;
|
|
250
|
-
|
|
251
|
-
declare const listSubscriptions: ({ configurationsClient }: APIParams) => () => Promise<TrimDataResponse<_shared_clients_configurations.Subscriptions>>;
|
|
252
|
-
|
|
253
|
-
declare const updateSubscription: ({ configurationsClient }: APIParams) => ({ id, ...input }: UpdateSubscriptionInput) => Promise<TrimDataResponse<_shared_clients_configurations.SubscriptionResponse>>;
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Utility function to sanitize the Axios response object by:
|
|
257
|
-
* - removing the redundant 'data' property when calling the 'data' property again on the Axios response
|
|
258
|
-
* - casting the headers to `Record<string, string>` for better type assertion.
|
|
259
|
-
* @param response - The Axios response object.
|
|
260
|
-
* @returns - The sanitized response object.
|
|
261
|
-
*/
|
|
262
|
-
declare const trimData: <T extends {
|
|
263
|
-
data?: unknown;
|
|
264
|
-
}>(response: AxiosResponse<T>) => TrimDataResponse<T>;
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* Resolves an absolute file path based on a relative path from the application's root directory.
|
|
268
|
-
* @param relativePath - The relative path from the application's root directory.
|
|
269
|
-
* @returns The absolute path resolved from the application's root directory.
|
|
270
|
-
*/
|
|
271
|
-
declare const resolvePathRelativeToAppDir: (relativePath: string) => string;
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* Represents an in-memory storage implementation.
|
|
275
|
-
*/
|
|
276
|
-
declare class InMemoryStorage<TStoredData extends object> implements Storage<TStoredData> {
|
|
277
|
-
private data;
|
|
278
|
-
/**
|
|
279
|
-
* Retrieves the value associated with the given key.
|
|
280
|
-
* @param key - The key of the value to retrieve.
|
|
281
|
-
* @returns A Promise that resolves to the value associated with the key, or undefined if the key doesn't exist.
|
|
282
|
-
*/
|
|
283
|
-
get<TKey extends keyof TStoredData>(key: TKey): Promise<TStoredData[TKey] | undefined>;
|
|
284
|
-
/**
|
|
285
|
-
* Sets the value associated with the given key.
|
|
286
|
-
* @param key - The key of the value to set.
|
|
287
|
-
* @param value - The value to associate with the key. Use undefined to remove the key from the storage.
|
|
288
|
-
* @returns A Promise that resolves once the value is set.
|
|
289
|
-
*/
|
|
290
|
-
set<TKey extends keyof TStoredData>(key: TKey, value: TStoredData[TKey] | undefined): Promise<void>;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
interface WithIdempotencyKey {
|
|
294
|
-
/**
|
|
295
|
-
* The optional idempotency key.
|
|
296
|
-
* An idempotency key is a unique identifier used to identify and handle duplicate requests
|
|
297
|
-
* in order to ensure idempotent behavior, where multiple identical requests have the same effect as a single request.
|
|
298
|
-
*
|
|
299
|
-
* We will generate one if you do not provide it.
|
|
300
|
-
*/
|
|
301
|
-
idempotencyKey?: string;
|
|
302
|
-
}
|
|
303
|
-
type Cache = {
|
|
304
|
-
/**
|
|
305
|
-
* Public key of the entity.
|
|
306
|
-
*/
|
|
307
|
-
publicKey: string;
|
|
308
|
-
};
|
|
309
|
-
type APIParamsWithEntitySecret<TStoredData extends Cache = Cache> = APIParams<unknown, TStoredData> & {
|
|
310
|
-
/**
|
|
311
|
-
* Your configured entity secret.
|
|
312
|
-
*/
|
|
313
|
-
entitySecret: string;
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* Method for securely encrypting an entity secret with a public key.
|
|
318
|
-
* If the public key is not already stored, it fetches and stores it for future use.
|
|
319
|
-
* @param params - Contains the entity secret and methods for managing storage.
|
|
320
|
-
* @returns The encrypted entity secret, returned as a cipher text.
|
|
321
|
-
*/
|
|
322
|
-
declare const generateEntitySecretCiphertext: (params: APIParamsWithEntitySecret) => () => Promise<string>;
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
* Generates a unique idempotency key using the crypto library.
|
|
326
|
-
* @returns A randomly generated idempotency key in UUID format.
|
|
327
|
-
*/
|
|
328
|
-
declare const generateIdempotencyKey: () => `${string}-${string}-${string}-${string}-${string}`;
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* Represents the input parameters for requesting testnet tokens for your wallet.
|
|
332
|
-
*/
|
|
333
|
-
interface RequestTestnetTokensInput {
|
|
334
|
-
/**
|
|
335
|
-
* The address of the wallet that should receive the tokens.
|
|
336
|
-
*/
|
|
337
|
-
address: string;
|
|
338
|
-
/**
|
|
339
|
-
* The blockchain the wallet that should receive the tokens is currently on.
|
|
340
|
-
*/
|
|
341
|
-
blockchain: TestnetBlockchain;
|
|
342
|
-
/**
|
|
343
|
-
* Request native testnet tokens.
|
|
344
|
-
*/
|
|
345
|
-
native?: boolean;
|
|
346
|
-
/**
|
|
347
|
-
* Request USDC testnet tokens.
|
|
348
|
-
*/
|
|
349
|
-
usdc?: boolean;
|
|
350
|
-
/**
|
|
351
|
-
* Request EURC testnet tokens.
|
|
352
|
-
*/
|
|
353
|
-
eurc?: boolean;
|
|
354
|
-
}
|
|
355
|
-
declare const requestTestnetTokens: ({ configurationsClient }: APIParams) => (input: RequestTestnetTokensInput) => Promise<axios.AxiosResponse<void, any, {}>>;
|
|
356
|
-
|
|
357
|
-
export { type APIParams, type APIReturnType, type ClientParams, type Common, type CreateMonitoredTokensInput, type CreateSubscriptionInput, type DeleteMonitoredTokensInput, type FeeConfiguration, InMemoryStorage, type ListMonitoredTokensInput, type Pagination, type RequestTestnetTokensInput, type Storage, type TrimDataResponse, type UpdateMonitoredTokensInput, type UpdateMonitoredTokensScopeInput, type UpdateSubscriptionInput, type WithIdempotencyKey, createMonitoredTokens, createSubscription, deleteMonitoredTokens, deleteSubscription, generateEntitySecretCiphertext, generateIdempotencyKey, getNotificationSignature, getPublicKey, getSubscription, listMonitoredTokens, listSubscriptions, requestTestnetTokens, resolvePathRelativeToAppDir, trimData, updateMonitoredTokens, updateMonitoredTokensScope, updateSubscription };
|