Skip to content

Commit 2917197

Browse files
committed
refactor rpc config
1 parent 650fefd commit 2917197

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/constants.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const SPARK_VERSION = '1.11.3'
22
export const MAX_CAR_SIZE = 200 * 1024 * 1024 // 200 MB
33
export const APPROX_ROUND_LENGTH_IN_MS = 20 * 60_000 // 20 minutes
4-
5-
export const RPC_REQUEST = new Request('https://api.node.glif.io/')
4+
export const RPC_URL = 'https://api.node.glif.io/'
5+
export const RPC_AUTH = 'Bz8B9c8hKIp+/IyePpgORexkDDq+8c9atapgGuudtQ0='

lib/miner-info.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { RPC_REQUEST } from './constants.js'
1+
import { RPC_URL, RPC_AUTH } from './constants.js'
22

33
/**
44
* @param {string} minerId A miner actor id, e.g. `f0142637`
@@ -19,12 +19,12 @@ export async function getMinerPeerId (minerId) {
1919
* @param {unknown[]} params
2020
*/
2121
async function rpc (method, ...params) {
22-
const req = new Request(RPC_REQUEST, {
22+
const req = new Request(RPC_URL, {
2323
method: 'POST',
2424
headers: {
2525
'content-type': 'application/json',
2626
accepts: 'application/json',
27-
authorization: 'Bearer Bz8B9c8hKIp+/IyePpgORexkDDq+8c9atapgGuudtQ0='
27+
authorization: `Bearer ${RPC_AUTH}`
2828
},
2929
body: JSON.stringify({
3030
jsonrpc: '2.0',

0 commit comments

Comments
 (0)