@@ -11,6 +11,7 @@ import { BlockchainClient, BlockchainInfo } from "./blockchain_client.ts";
11
11
import { Component } from "../../component.ts" ;
12
12
import { ErgomaticConfig } from "../../config.ts" ;
13
13
import axios , { AxiosInstance } from "axios" ;
14
+ import { ERGOMATIC_USER_AGENT } from "../../http.ts" ;
14
15
15
16
export class NodeClient extends Component implements BlockchainClient {
16
17
readonly #http: AxiosInstance ;
@@ -22,6 +23,9 @@ export class NodeClient extends Component implements BlockchainClient {
22
23
this . #timeoutMs = httpTimeoutMs ;
23
24
this . #http = axios . create ( {
24
25
baseURL : config . node . endpoint ,
26
+ headers : {
27
+ "User-Agent" : ERGOMATIC_USER_AGENT ,
28
+ } ,
25
29
} ) ;
26
30
}
27
31
@@ -44,17 +48,12 @@ export class NodeClient extends Component implements BlockchainClient {
44
48
}
45
49
46
50
async getInfo ( ) : Promise < BlockchainInfo > {
47
- const response = await this . #http. get (
48
- "/info" ,
49
- this . #defaultRequestConfig,
50
- ) ;
51
+ const response = await this . #http. get ( "/info" , this . #defaultRequestConfig) ;
51
52
52
53
return response . data ;
53
54
}
54
55
55
- async submitTx (
56
- signedTx : SignedTransaction ,
57
- ) : Promise < TransactionId > {
56
+ async submitTx ( signedTx : SignedTransaction ) : Promise < TransactionId > {
58
57
const response = await this . #http. post (
59
58
"/transactions" ,
60
59
signedTx ,
0 commit comments