@ar.io/sdk 2.0.0-alpha.2 → 2.0.0-alpha.3

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.
@@ -15,7 +15,7 @@
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
  import { isProcessConfiguration, isProcessIdConfiguration, } from '../types.js';
18
- import { AoANTReadable, AoANTWriteable, InvalidContractConfigurationError, } from './index.js';
18
+ import { AOProcess, InvalidContractConfigurationError } from './index.js';
19
19
  export class ANT {
20
20
  static init({ signer, ...config }) {
21
21
  // ao supported implementation
@@ -28,3 +28,292 @@ export class ANT {
28
28
  throw new InvalidContractConfigurationError();
29
29
  }
30
30
  }
31
+ export class AoANTReadable {
32
+ process;
33
+ constructor(config) {
34
+ if (isProcessConfiguration(config)) {
35
+ this.process = config.process;
36
+ }
37
+ else if (isProcessIdConfiguration(config)) {
38
+ this.process = new AOProcess({
39
+ processId: config.processId,
40
+ });
41
+ }
42
+ else {
43
+ throw new InvalidContractConfigurationError();
44
+ }
45
+ }
46
+ async getState() {
47
+ const tags = [{ name: 'Action', value: 'State' }];
48
+ const res = await this.process.read({
49
+ tags,
50
+ });
51
+ return res;
52
+ }
53
+ async getInfo() {
54
+ const tags = [{ name: 'Action', value: 'Info' }];
55
+ const info = await this.process.read({
56
+ tags,
57
+ });
58
+ return info;
59
+ }
60
+ /**
61
+ * @param undername @type {string} The domain name.
62
+ * @returns {Promise<ANTRecord>} The record of the undername domain.
63
+ * @example
64
+ * Get the current record
65
+ * ```ts
66
+ * ant.getRecord({ undername: "john" });
67
+ * ```
68
+ */
69
+ async getRecord({ undername }) {
70
+ const tags = [
71
+ { name: 'Sub-Domain', value: undername },
72
+ { name: 'Action', value: 'Record' },
73
+ ];
74
+ const record = await this.process.read({
75
+ tags,
76
+ });
77
+ return record;
78
+ }
79
+ /**
80
+ * @returns {Promise<Record<string, ANTRecord>>} All the undernames managed by the ANT.
81
+ * @example
82
+ * Get the current records
83
+ * ```ts
84
+ * ant.getRecords();
85
+ * ````
86
+ */
87
+ async getRecords() {
88
+ const tags = [{ name: 'Action', value: 'Records' }];
89
+ const records = await this.process.read({
90
+ tags,
91
+ });
92
+ return records;
93
+ }
94
+ /**
95
+ * @returns {Promise<string>} The owner of the ANT.
96
+ * @example
97
+ * Get the current owner
98
+ * ```ts
99
+ * ant.getOwner();
100
+ * ```
101
+ */
102
+ async getOwner() {
103
+ const info = await this.getInfo();
104
+ return info.Owner;
105
+ }
106
+ /**
107
+ * @returns {Promise<string[]>} The controllers of the ANT.
108
+ * @example
109
+ * Get the controllers of the ANT.
110
+ * ```ts
111
+ * ant.getControllers();
112
+ * ```
113
+ */
114
+ async getControllers() {
115
+ const tags = [{ name: 'Action', value: 'Controllers' }];
116
+ const controllers = await this.process.read({
117
+ tags,
118
+ });
119
+ return controllers;
120
+ }
121
+ /**
122
+ * @returns {Promise<string>} The name of the ANT (not the same as ArNS name).
123
+ * @example
124
+ * Get the current name
125
+ * ```ts
126
+ * ant.getName();
127
+ * ```
128
+ */
129
+ async getName() {
130
+ const info = await this.getInfo();
131
+ return info.Name;
132
+ }
133
+ /**
134
+ * @returns {Promise<string>} The name of the ANT (not the same as ArNS name).
135
+ * @example
136
+ * The current ticker of the ANT.
137
+ * ```ts
138
+ * ant.getTicker();
139
+ * ```
140
+ */
141
+ async getTicker() {
142
+ const info = await this.getInfo();
143
+ return info.Ticker;
144
+ }
145
+ /**
146
+ * @returns {Promise<Record<WalletAddress, number>>} The balances of the ANT
147
+ * @example
148
+ * The current balances of the ANT.
149
+ * ```ts
150
+ * ant.getBalances();
151
+ * ```
152
+ */
153
+ async getBalances() {
154
+ const tags = [{ name: 'Action', value: 'Balances' }];
155
+ const balances = await this.process.read({
156
+ tags,
157
+ });
158
+ return balances;
159
+ }
160
+ /**
161
+ * @param address @type {string} The address of the account you want the balance of.
162
+ * @returns {Promise<number>} The balance of the provided address
163
+ * @example
164
+ * The current balance of the address.
165
+ * ```ts
166
+ * ant.getBalance({ address });
167
+ * ```
168
+ */
169
+ async getBalance({ address }) {
170
+ const tags = [
171
+ { name: 'Action', value: 'Balance' },
172
+ { name: 'Recipient', value: address },
173
+ ];
174
+ const balance = await this.process.read({
175
+ tags,
176
+ });
177
+ return balance;
178
+ }
179
+ }
180
+ export class AoANTWriteable extends AoANTReadable {
181
+ signer;
182
+ constructor({ signer, ...config }) {
183
+ super(config);
184
+ this.signer = signer;
185
+ }
186
+ /**
187
+ * @param target @type {string} The address of the account you want to transfer the ANT to.
188
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
189
+ * @example
190
+ * ```ts
191
+ * ant.transfer({ target: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
192
+ * ```
193
+ */
194
+ async transfer({ target }) {
195
+ const tags = [
196
+ { name: 'Action', value: 'Transfer' },
197
+ { name: 'Recipient', value: target },
198
+ ];
199
+ return this.process.send({
200
+ tags,
201
+ data: {},
202
+ signer: this.signer,
203
+ });
204
+ }
205
+ /**
206
+ * @param controller @type {string} The address of the account you want to set as a controller.
207
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
208
+ * @example
209
+ * ```ts
210
+ * ant.setController({ controller: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
211
+ * ```
212
+ */
213
+ async addController({ controller, }) {
214
+ const tags = [
215
+ { name: 'Action', value: 'Add-Controller' },
216
+ { name: 'Controller', value: controller },
217
+ ];
218
+ return this.process.send({
219
+ tags,
220
+ data: {},
221
+ signer: this.signer,
222
+ });
223
+ }
224
+ /**
225
+ * @param controller @type {string} The address of the account you want to remove from the controllers list
226
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
227
+ * @example
228
+ * ```ts
229
+ * ant.removeController({ controller: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
230
+ * ```
231
+ */
232
+ async removeController({ controller, }) {
233
+ const tags = [
234
+ { name: 'Action', value: 'Remove-Controller' },
235
+ { name: 'Controller', value: controller },
236
+ ];
237
+ return this.process.send({
238
+ tags,
239
+ data: {},
240
+ signer: this.signer,
241
+ });
242
+ }
243
+ /**
244
+ * @param undername @type {string} The record you want to set the transactionId and ttlSeconds of.
245
+ * @param transactionId @type {string} The transactionId of the record.
246
+ * @param ttlSeconds @type {number} The time to live of the record.
247
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
248
+ * @example
249
+ * ```ts
250
+ * ant.setController({ controller: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
251
+ * ```
252
+ */
253
+ async setRecord({ undername, transactionId, ttlSeconds, }) {
254
+ return this.process.send({
255
+ tags: [
256
+ { name: 'Action', value: 'Set-Record' },
257
+ { name: 'Sub-Domain', value: undername },
258
+ { name: 'Transaction-Id', value: transactionId },
259
+ { name: 'TTL-Seconds', value: ttlSeconds.toString() },
260
+ ],
261
+ data: { transactionId, ttlSeconds },
262
+ signer: this.signer,
263
+ });
264
+ }
265
+ /**
266
+ * @param undername @type {string} The record you want to remove.
267
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
268
+ * @example
269
+ * ```ts
270
+ * ant.removeRecord({ subDomain: "shorts" });
271
+ * ```
272
+ */
273
+ async removeRecord({ undername, }) {
274
+ return this.process.send({
275
+ tags: [
276
+ { name: 'Action', value: 'Remove-Record' },
277
+ { name: 'Sub-Domain', value: undername },
278
+ ],
279
+ data: { undername },
280
+ signer: this.signer,
281
+ });
282
+ }
283
+ /**
284
+ * @param ticker @type {string} Sets the ANT Ticker.
285
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
286
+ * @example
287
+ * ```ts
288
+ * ant.setTicker({ ticker: "KAPOW" });
289
+ * ```
290
+ */
291
+ async setTicker({ ticker }) {
292
+ return this.process.send({
293
+ tags: [
294
+ { name: 'Action', value: 'Set-Ticker' },
295
+ { name: 'Ticker', value: ticker },
296
+ ],
297
+ data: { ticker },
298
+ signer: this.signer,
299
+ });
300
+ }
301
+ /**
302
+ * @param name @type {string} Sets the Name of the ANT.
303
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
304
+ * @example
305
+ * ```ts
306
+ * ant.setName({ name: "ships at sea" });
307
+ * ```
308
+ */
309
+ async setName({ name }) {
310
+ return this.process.send({
311
+ tags: [
312
+ { name: 'Action', value: 'Set-Name' },
313
+ { name: 'Name', value: name },
314
+ ],
315
+ data: { name },
316
+ signer: this.signer,
317
+ });
318
+ }
319
+ }
@@ -19,12 +19,12 @@ import { createData } from 'arbundles';
19
19
  import { safeDecode } from '../../utils/json.js';
20
20
  import { version } from '../../version.js';
21
21
  import { WriteInteractionError } from '../error.js';
22
- import { DefaultLogger } from '../logger.js';
22
+ import { Logger } from '../logger.js';
23
23
  export class AOProcess {
24
24
  logger;
25
25
  processId;
26
26
  ao;
27
- constructor({ processId, ao = connect(), logger = new DefaultLogger({ level: 'info' }), }) {
27
+ constructor({ processId, ao = connect(), logger = Logger.default, }) {
28
28
  this.processId = processId;
29
29
  this.logger = logger;
30
30
  this.ao = ao;
@@ -1,11 +1,10 @@
1
1
  import { createAxiosInstance } from '../utils/index.js';
2
2
  import { FailedRequestError, NotFound, UnknownError } from './error.js';
3
- import { DefaultLogger } from './logger.js';
3
+ import { Logger } from './logger.js';
4
4
  export class AxiosHTTPService {
5
5
  axios;
6
6
  logger;
7
- // TODO: re-implement axios-retry. Currently that package is broken for nodenext.
8
- constructor({ url, logger = new DefaultLogger(), }) {
7
+ constructor({ url, logger = Logger.default, }) {
9
8
  this.logger = logger;
10
9
  this.axios = createAxiosInstance({
11
10
  axiosConfig: {
@@ -19,5 +19,4 @@ export * from './logger.js';
19
19
  export * from './ant.js';
20
20
  // ao
21
21
  export * from './io.js';
22
- export * from './ant-ao.js';
23
22
  export * from './contracts/ao-process.js';
@@ -19,7 +19,6 @@ import { IO_TESTNET_PROCESS_ID } from '../constants.js';
19
19
  import { isProcessConfiguration, isProcessIdConfiguration, } from '../io.js';
20
20
  import { AOProcess } from './contracts/ao-process.js';
21
21
  import { InvalidContractConfigurationError } from './error.js';
22
- import { DefaultLogger } from './logger.js';
23
22
  export class IO {
24
23
  static init(config) {
25
24
  if (config && config.signer) {
@@ -47,9 +46,6 @@ export class IOReadable {
47
46
  else if (isProcessIdConfiguration(config)) {
48
47
  this.process = new AOProcess({
49
48
  processId: config.processId,
50
- logger: new DefaultLogger({
51
- level: 'info',
52
- }),
53
49
  });
54
50
  }
55
51
  else {
@@ -14,11 +14,12 @@
14
14
  * You should have received a copy of the GNU Affero General Public License
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
- import { createLogger, format, transports } from 'winston';
17
+ import { createLogger, format, transports, } from 'winston';
18
18
  import { version } from '../version.js';
19
- export class DefaultLogger {
19
+ export class Logger {
20
20
  logger;
21
21
  silent = false;
22
+ static default = new Logger();
22
23
  constructor({ level = 'info', } = {}) {
23
24
  if (level === 'none') {
24
25
  this.silent = true;
@@ -67,7 +68,6 @@ export class DefaultLogger {
67
68
  setLogLevel(level) {
68
69
  if ('silent' in this.logger) {
69
70
  this.logger.silent = level === 'none';
70
- return;
71
71
  }
72
72
  if ('level' in this.logger) {
73
73
  this.logger.level = level;
@@ -16,9 +16,9 @@
16
16
  */
17
17
  import axios from 'axios';
18
18
  import axiosRetry from 'axios-retry';
19
- import { DefaultLogger } from '../common/logger.js';
19
+ import { Logger } from '../common/logger.js';
20
20
  import { version } from '../version.js';
21
- export const createAxiosInstance = ({ axiosConfig = {}, logger = new DefaultLogger(), retryConfig = {
21
+ export const createAxiosInstance = ({ axiosConfig = {}, logger = Logger.default, retryConfig = {
22
22
  retries: 5,
23
23
  retryDelay: axiosRetry.exponentialDelay,
24
24
  retryCondition: (error) => axiosRetry.isRetryableError(error),
@@ -15,4 +15,4 @@
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
18
- export const version = '2.0.0-alpha.2';
18
+ export const version = '2.0.0-alpha.3';
@@ -14,7 +14,8 @@
14
14
  * You should have received a copy of the GNU Affero General Public License
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
- import { AoANTRead, AoANTWrite, ProcessConfiguration, WithSigner } from '../types.js';
17
+ import { ANTRecord, AoANTRead, AoANTState, AoANTWrite, AoMessageResult, ProcessConfiguration, WalletAddress, WithSigner } from '../types.js';
18
+ import { AOProcess } from './index.js';
18
19
  export declare class ANT {
19
20
  /**
20
21
  * Initializes an ANT instance.
@@ -45,3 +46,177 @@ export declare class ANT {
45
46
  }): AoANTRead;
46
47
  static init({ signer, ...config }: WithSigner<Required<ProcessConfiguration>>): AoANTWrite;
47
48
  }
49
+ export declare class AoANTReadable implements AoANTRead {
50
+ protected process: AOProcess;
51
+ constructor(config: Required<ProcessConfiguration>);
52
+ getState(): Promise<AoANTState>;
53
+ getInfo(): Promise<{
54
+ Name: string;
55
+ Ticker: string;
56
+ Denomination: number;
57
+ Owner: string;
58
+ }>;
59
+ /**
60
+ * @param undername @type {string} The domain name.
61
+ * @returns {Promise<ANTRecord>} The record of the undername domain.
62
+ * @example
63
+ * Get the current record
64
+ * ```ts
65
+ * ant.getRecord({ undername: "john" });
66
+ * ```
67
+ */
68
+ getRecord({ undername }: {
69
+ undername: string;
70
+ }): Promise<ANTRecord>;
71
+ /**
72
+ * @returns {Promise<Record<string, ANTRecord>>} All the undernames managed by the ANT.
73
+ * @example
74
+ * Get the current records
75
+ * ```ts
76
+ * ant.getRecords();
77
+ * ````
78
+ */
79
+ getRecords(): Promise<Record<string, ANTRecord>>;
80
+ /**
81
+ * @returns {Promise<string>} The owner of the ANT.
82
+ * @example
83
+ * Get the current owner
84
+ * ```ts
85
+ * ant.getOwner();
86
+ * ```
87
+ */
88
+ getOwner(): Promise<string>;
89
+ /**
90
+ * @returns {Promise<string[]>} The controllers of the ANT.
91
+ * @example
92
+ * Get the controllers of the ANT.
93
+ * ```ts
94
+ * ant.getControllers();
95
+ * ```
96
+ */
97
+ getControllers(): Promise<WalletAddress[]>;
98
+ /**
99
+ * @returns {Promise<string>} The name of the ANT (not the same as ArNS name).
100
+ * @example
101
+ * Get the current name
102
+ * ```ts
103
+ * ant.getName();
104
+ * ```
105
+ */
106
+ getName(): Promise<string>;
107
+ /**
108
+ * @returns {Promise<string>} The name of the ANT (not the same as ArNS name).
109
+ * @example
110
+ * The current ticker of the ANT.
111
+ * ```ts
112
+ * ant.getTicker();
113
+ * ```
114
+ */
115
+ getTicker(): Promise<string>;
116
+ /**
117
+ * @returns {Promise<Record<WalletAddress, number>>} The balances of the ANT
118
+ * @example
119
+ * The current balances of the ANT.
120
+ * ```ts
121
+ * ant.getBalances();
122
+ * ```
123
+ */
124
+ getBalances(): Promise<Record<string, number>>;
125
+ /**
126
+ * @param address @type {string} The address of the account you want the balance of.
127
+ * @returns {Promise<number>} The balance of the provided address
128
+ * @example
129
+ * The current balance of the address.
130
+ * ```ts
131
+ * ant.getBalance({ address });
132
+ * ```
133
+ */
134
+ getBalance({ address }: {
135
+ address: string;
136
+ }): Promise<number>;
137
+ }
138
+ export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite {
139
+ private signer;
140
+ constructor({ signer, ...config }: WithSigner<Required<ProcessConfiguration>>);
141
+ /**
142
+ * @param target @type {string} The address of the account you want to transfer the ANT to.
143
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
144
+ * @example
145
+ * ```ts
146
+ * ant.transfer({ target: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
147
+ * ```
148
+ */
149
+ transfer({ target }: {
150
+ target: string;
151
+ }): Promise<AoMessageResult>;
152
+ /**
153
+ * @param controller @type {string} The address of the account you want to set as a controller.
154
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
155
+ * @example
156
+ * ```ts
157
+ * ant.setController({ controller: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
158
+ * ```
159
+ */
160
+ addController({ controller, }: {
161
+ controller: string;
162
+ }): Promise<AoMessageResult>;
163
+ /**
164
+ * @param controller @type {string} The address of the account you want to remove from the controllers list
165
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
166
+ * @example
167
+ * ```ts
168
+ * ant.removeController({ controller: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
169
+ * ```
170
+ */
171
+ removeController({ controller, }: {
172
+ controller: string;
173
+ }): Promise<AoMessageResult>;
174
+ /**
175
+ * @param undername @type {string} The record you want to set the transactionId and ttlSeconds of.
176
+ * @param transactionId @type {string} The transactionId of the record.
177
+ * @param ttlSeconds @type {number} The time to live of the record.
178
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
179
+ * @example
180
+ * ```ts
181
+ * ant.setController({ controller: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
182
+ * ```
183
+ */
184
+ setRecord({ undername, transactionId, ttlSeconds, }: {
185
+ undername: string;
186
+ transactionId: string;
187
+ ttlSeconds: number;
188
+ }): Promise<AoMessageResult>;
189
+ /**
190
+ * @param undername @type {string} The record you want to remove.
191
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
192
+ * @example
193
+ * ```ts
194
+ * ant.removeRecord({ subDomain: "shorts" });
195
+ * ```
196
+ */
197
+ removeRecord({ undername, }: {
198
+ undername: string;
199
+ }): Promise<AoMessageResult>;
200
+ /**
201
+ * @param ticker @type {string} Sets the ANT Ticker.
202
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
203
+ * @example
204
+ * ```ts
205
+ * ant.setTicker({ ticker: "KAPOW" });
206
+ * ```
207
+ */
208
+ setTicker({ ticker }: {
209
+ ticker: string;
210
+ }): Promise<AoMessageResult>;
211
+ /**
212
+ * @param name @type {string} Sets the Name of the ANT.
213
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
214
+ * @example
215
+ * ```ts
216
+ * ant.setName({ name: "ships at sea" });
217
+ * ```
218
+ */
219
+ setName({ name }: {
220
+ name: string;
221
+ }): Promise<AoMessageResult>;
222
+ }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { AOContract, AoClient, ContractSigner } from '../../types.js';
3
- import { DefaultLogger } from '../logger.js';
3
+ import { ILogger } from '../logger.js';
4
4
  export declare class AOProcess implements AOContract {
5
5
  private logger;
6
6
  private processId;
@@ -8,7 +8,7 @@ export declare class AOProcess implements AOContract {
8
8
  constructor({ processId, ao, logger, }: {
9
9
  processId: string;
10
10
  ao?: AoClient;
11
- logger?: DefaultLogger;
11
+ logger?: ILogger;
12
12
  });
13
13
  static createAoSigner(signer: ContractSigner): Promise<(args: {
14
14
  data: string | Buffer;
@@ -1,11 +1,12 @@
1
1
  /// <reference types="node" />
2
- import { HTTPClient, Logger } from '../types.js';
2
+ import { HTTPClient } from '../types.js';
3
+ import { ILogger } from './logger.js';
3
4
  export declare class AxiosHTTPService implements HTTPClient {
4
5
  private axios;
5
6
  private logger;
6
7
  constructor({ url, logger, }: {
7
8
  url: string;
8
- logger?: Logger;
9
+ logger?: ILogger;
9
10
  });
10
11
  get<I, K>({ endpoint, signal, allowedStatuses, headers, params, }: {
11
12
  endpoint: string;
@@ -18,5 +18,4 @@ export * from './error.js';
18
18
  export * from './logger.js';
19
19
  export * from './ant.js';
20
20
  export * from './io.js';
21
- export * from './ant-ao.js';
22
21
  export * from './contracts/ao-process.js';
@@ -1,7 +1,14 @@
1
- import { Logger as ILogger } from '../types.js';
2
- export declare class DefaultLogger implements ILogger {
1
+ export interface ILogger {
2
+ setLogLevel: (level: 'info' | 'debug' | 'error' | 'warn' | 'none') => void;
3
+ info: (message: string, ...args: unknown[]) => void;
4
+ warn: (message: string, ...args: unknown[]) => void;
5
+ error: (message: string, ...args: unknown[]) => void;
6
+ debug: (message: string, ...args: unknown[]) => void;
7
+ }
8
+ export declare class Logger implements ILogger {
3
9
  private logger;
4
10
  private silent;
11
+ static default: Logger;
5
12
  constructor({ level, }?: {
6
13
  level?: 'info' | 'debug' | 'error' | 'warn' | 'none';
7
14
  });
@@ -9,5 +16,5 @@ export declare class DefaultLogger implements ILogger {
9
16
  warn(message: string, ...args: unknown[]): void;
10
17
  error(message: string, ...args: unknown[]): void;
11
18
  debug(message: string, ...args: unknown[]): void;
12
- setLogLevel(level: string): void;
19
+ setLogLevel(level: 'info' | 'debug' | 'error' | 'warn' | 'none'): void;
13
20
  }
@@ -72,13 +72,6 @@ export type AtLeastOne<T, U = {
72
72
  [K in keyof T]-?: Record<K, T[K]>;
73
73
  }> = Partial<T> & U[keyof U];
74
74
  export type UpdateGatewaySettingsParams = AtLeastOne<UpdateGatewaySettingsParamsBase>;
75
- export interface Logger {
76
- setLogLevel: (level: string) => void;
77
- info: (message: string, ...args: unknown[]) => void;
78
- warn: (message: string, ...args: unknown[]) => void;
79
- error: (message: string, ...args: unknown[]) => void;
80
- debug: (message: string, ...args: unknown[]) => void;
81
- }
82
75
  export interface HTTPClient {
83
76
  get<I, K>({ endpoint, signal, headers, allowedStatuses, params, }: {
84
77
  endpoint: string;
@@ -16,10 +16,10 @@
16
16
  */
17
17
  import { AxiosInstance, AxiosRequestConfig } from 'axios';
18
18
  import { IAxiosRetryConfig } from 'axios-retry';
19
- import { Logger } from '../types.js';
19
+ import { ILogger } from '../common/logger.js';
20
20
  export interface AxiosInstanceParameters {
21
21
  axiosConfig?: Omit<AxiosRequestConfig, 'validateStatus'>;
22
22
  retryConfig?: IAxiosRetryConfig;
23
- logger?: Logger;
23
+ logger?: ILogger;
24
24
  }
25
25
  export declare const createAxiosInstance: ({ axiosConfig, logger, retryConfig, }?: AxiosInstanceParameters) => AxiosInstance;
@@ -14,4 +14,4 @@
14
14
  * You should have received a copy of the GNU Affero General Public License
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
- export declare const version = "2.0.0-alpha.1";
17
+ export declare const version = "2.0.0-alpha.2";