Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Commit

Permalink
[PI-387] add example for estimatedNextBatchTime
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-gierakowski committed Aug 31, 2023
1 parent 060b915 commit 65b5e36
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
51 changes: 51 additions & 0 deletions examples/34.estimatedNextBatchTime.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env -S yarn node
/* eslint-disable no-unused-vars */

/*
DO NOT EDIT THIS FILE BY HAND!
Examples are generated using helpers/buildExamples.js script.
Check README.md for more details.
*/

const sw = require('@rhino.fi/starkware-crypto')
const getWeb3 = require('./helpers/getWeb3')

const RhinofiClientFactory = require('../src')
const envVars = require('./helpers/loadFromEnvOrConfig')(
process.env.CONFIG_FILE_NAME
)
const logExampleResult = require('./helpers/logExampleResult')(__filename)

const ethPrivKey = envVars.ETH_PRIVATE_KEY
// NOTE: you can also generate a new key using:`
// const starkPrivKey = rhinofi.stark.createPrivateKey()
const starkPrivKey = envVars.STARK_PRIVATE_KEY
const rpcUrl = envVars.RPC_URL

const { web3, provider } = getWeb3(ethPrivKey, rpcUrl)

const rhinofiConfig = {
api: envVars.API_URL,
dataApi: envVars.DATA_API_URL,
useAuthHeader: true,
wallet: {
type: 'tradingKey',
meta: {
starkPrivateKey: starkPrivKey
}
}
// Add more variables to override default values
}

;(async () => {
const rhinofi = await RhinofiClientFactory(web3, rhinofiConfig)

const estimatedNextBatchTimeResponse = await rhinofi.estimatedNextBatchTime()

logExampleResult(estimatedNextBatchTimeResponse)

})()
.catch(error => {
console.error(error)
process.exit(1)
})
1 change: 1 addition & 0 deletions examples/helpers/examplesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module.exports = Object.freeze([
'transfer',
'getRegistrationStatuses',
'generateL1RegistrationPayload',
'estimatedNextBatchTime',
// TODO
// 'submitBuyOrder',
// 'submitSellOrder',
Expand Down

0 comments on commit 65b5e36

Please sign in to comment.