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

Commit

Permalink
[PI-139]: Add example source to the generator
Browse files Browse the repository at this point in the history
  • Loading branch information
arijoon committed Aug 4, 2023
1 parent c06972e commit dff9561
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/33.generateL1RegistrationPayload.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Check README.md for more details.

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

const RhinofiClientFactory = require('../src')
const envVars = require('./helpers/loadFromEnvOrConfig')(
Expand Down Expand Up @@ -40,6 +39,7 @@ const rhinofiConfig = {

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

const { starkKeyHex, ethAddress } = await rhinofi.getUserConfig()

const l1RegistrationSignature = await rhinofi.stark.signRegistration(
Expand Down
1 change: 1 addition & 0 deletions examples/helpers/examplesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ module.exports = Object.freeze([
'publicPermissions',
'transfer',
'getRegistrationStatuses',
'generateL1RegistrationPayload',
// TODO
// 'submitBuyOrder',
// 'submitSellOrder',
Expand Down
18 changes: 18 additions & 0 deletions examples/src/generateL1RegistrationPayload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const { starkKeyHex, ethAddress } = await rhinofi.getUserConfig()

const l1RegistrationSignature = await rhinofi.stark.signRegistration(
ethAddress
)

const callData = await rhinofi.stark.l1RegistrationCallData(
starkKeyHex,
ethAddress,
l1RegistrationSignature
)

logExampleResult({
ethAddress,
starkKeyHex,
sig: l1RegistrationSignature,
callData
})
2 changes: 1 addition & 1 deletion src/api/storeStarkL1Registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
module.exports = async (dvf, nonce, signature) => {
const url = '/v1/trading/storeStarkL1Registration'

const { ethAddress } = await dvf.getUserConfig()
const { ethAddress } = await dvf.getUserConfig(nonce, signature)

const l1RegistrationSignature = await dvf.stark.signRegistration(
ethAddress
Expand Down

0 comments on commit dff9561

Please sign in to comment.