Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor rpc config #70

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/constants.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const SPARK_VERSION = '1.11.3'
export const MAX_CAR_SIZE = 200 * 1024 * 1024 // 200 MB
export const APPROX_ROUND_LENGTH_IN_MS = 20 * 60_000 // 20 minutes

export const RPC_REQUEST = new Request('https://api.node.glif.io/')
export const RPC_URL = 'https://api.node.glif.io/'
export const RPC_AUTH = 'Bz8B9c8hKIp+/IyePpgORexkDDq+8c9atapgGuudtQ0='
6 changes: 3 additions & 3 deletions lib/miner-info.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RPC_REQUEST } from './constants.js'
import { RPC_URL, RPC_AUTH } from './constants.js'

/**
* @param {string} minerId A miner actor id, e.g. `f0142637`
Expand All @@ -19,12 +19,12 @@ export async function getMinerPeerId (minerId) {
* @param {unknown[]} params
*/
async function rpc (method, ...params) {
const req = new Request(RPC_REQUEST, {
const req = new Request(RPC_URL, {
method: 'POST',
headers: {
'content-type': 'application/json',
accepts: 'application/json',
authorization: 'Bearer Bz8B9c8hKIp+/IyePpgORexkDDq+8c9atapgGuudtQ0='
authorization: `Bearer ${RPC_AUTH}`
},
body: JSON.stringify({
jsonrpc: '2.0',
Expand Down