Skip to content
This repository was archived by the owner on Apr 8, 2024. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
7b93b6b
[devops:bot] update rhino-core in nix/sources.json
May 8, 2023
94fdcf9
Merge pull request #473 from rhinofi/devops-bot/update-nix-deps-from_…
dvf-ci May 8, 2023
8316673
[devops] fix piping into .github/netrc-create.sh
adrian-gierakowski May 15, 2023
fc1f9eb
[devops] load github token via GCP secret manager
adrian-gierakowski May 15, 2023
e9c0cd0
[devops] update gh action step versions
adrian-gierakowski May 15, 2023
848db39
[devops:bot] update rhino-core in nix/sources.json
May 15, 2023
5f5e9d5
Merge pull request #482 from rhinofi/devops/load-github-token-via-gcp…
rhino-ci May 15, 2023
73c142b
Merge pull request #484 from rhinofi/devops-bot/update-nix-deps-from_…
dvf-ci May 15, 2023
d91cb13
[devops:bot] update rhino-core in nix/sources.json
May 22, 2023
809d7a9
Merge pull request #488 from rhinofi/devops-bot/update-nix-deps-from_…
dvf-ci May 22, 2023
98c7051
[devops:bot] update rhino-core in nix/sources.json
May 25, 2023
e278395
ENGAGE-526 - remove blocker when transaction send never resolves
May 31, 2023
8a2d04b
Merge pull request #491 from rhinofi/devops-bot/update-nix-deps-from_…
adrian-gierakowski May 31, 2023
508f78d
ENGAGE-526 - do not throw when promise result does not have a status
Jun 6, 2023
29a79ad
Merge pull request #493 from rhinofi/ENGAGE-526-walletconnect-send-ne…
Jun 6, 2023
2d43d1e
ENGAGE-555 - adapt withdrawOnChain as it doesnt receive a PromiEvent …
Jun 13, 2023
d2c0077
ENGAGE-555 - bump version
Jun 13, 2023
4d76944
Merge pull request #494 from rhinofi/ENGAGE-555-fix-regular-withdrawal
Jun 13, 2023
7654d18
[devops:bot] update rhino-core in nix/sources.json
Jun 13, 2023
430bff6
Merge pull request #497 from rhinofi/devops-bot/update-nix-deps-from_…
adrian-gierakowski Jun 13, 2023
aecac7b
[CHAIN-718] Mark fastWithdrawalFee depricated
sjpbeale Jun 14, 2023
d158663
[CHAIN-718] Add getWithdrawalQuote
sjpbeale Jun 14, 2023
3f16444
[CHAIN-718] Use getWithdrawalQuote in createFastWithdrawalPayload
sjpbeale Jun 14, 2023
0dfd5c1
[CHAIN-718] Version bump
sjpbeale Jun 14, 2023
935e5e2
[CHAIN-718] Add task for todo
sjpbeale Jun 14, 2023
0fb973a
Merge pull request #498 from rhinofi/feature/CHAIN-718-FW-use-withdra…
sjpbeale Jun 14, 2023
b8125ed
[CHAIN-630] Remove bridge withdraw isFeeUsd
sjpbeale Jun 19, 2023
745617e
Merge pull request #500 from rhinofi/feature/CHAIN-630-remove-bridge-…
sjpbeale Jun 19, 2023
2a66966
[devops:bot] update rhino-core in nix/sources.json
Jun 20, 2023
0cd9148
Merge pull request #503 from rhinofi/devops-bot/update-nix-deps-from_…
adrian-gierakowski Jun 20, 2023
0773eee
[deps] use @rhino.fi/aigle
adrian-gierakowski Jun 26, 2023
424a8ab
[release] bump version
adrian-gierakowski Jun 26, 2023
0b4c577
Merge pull request #505 from rhinofi/deps/use-rhino-fi-aigle
adrian-gierakowski Jun 28, 2023
cd84e69
[devops:bot] update rhino-core in nix/sources.json
dvf-ci Jul 4, 2023
3357d4e
Merge pull request #516 from dvf-ci/devops-bot/update-nix-deps-from_r…
adrian-gierakowski Jul 4, 2023
9ebbd05
[devops:bot] update rhino-core in nix/sources.json
dvf-ci Jul 5, 2023
0a4ddd8
Merge pull request #517 from dvf-ci/devops-bot/update-nix-deps-from_r…
adrian-gierakowski Jul 5, 2023
f536de1
ENGAGE-631 Allow deposit execution to happen only on-chain, extract b…
Matko95 Jul 18, 2023
3d3e846
ENGAGE-631 Fix path
Matko95 Jul 18, 2023
7f50dc8
Merge branch 'dev' of github.com:DeversiFi/dvf-client-js into ENGAGE-…
Matko95 Jul 18, 2023
d55efe7
ENGAGE-631 Update import
Matko95 Jul 18, 2023
a39cbf5
Merge pull request #545 from rhinofi/ENGAGE-631-improve-bridge-ux-by-…
Matko95 Jul 19, 2023
50836a0
ENGAGE-631 Bump version
Matko95 Jul 19, 2023
ec99d6d
Merge pull request #546 from rhinofi/ENGAGE-631-improve-bridge-ux-by-…
Matko95 Jul 19, 2023
c00a109
ENGAGE-631 Fix issue, bump version
Matko95 Jul 19, 2023
7666d0d
Merge pull request #547 from rhinofi/ENGAGE-631-improve-bridge-ux-by-…
Matko95 Jul 19, 2023
2a0a20a
[devops] fix call to gh-with-ci-creds in ci.deploy-step
adrian-gierakowski Jul 19, 2023
a268b33
PI-163 Extend toBaseUnitAmount to accept custom token info, properly …
Matko95 Jul 21, 2023
486b175
Merge branch 'dev' of github.com:DeversiFi/dvf-client-js into PI-163-…
Matko95 Jul 21, 2023
5b2f411
Merge pull request #549 from rhinofi/PI-163-deposit-hangs-as-the-amou…
Matko95 Jul 21, 2023
0ab9e2c
ENGAGE-673 Bump ledger deps to match portal
Matko95 Jul 27, 2023
d676c69
ENGAGE-673 Sort out yarn.lock
Matko95 Jul 27, 2023
83f061a
ENGAGE-673 Bump version
Matko95 Jul 27, 2023
aaddb7b
Merge pull request #551 from rhinofi/ENGAGE-673-ledger-user-cant-make…
Matko95 Jul 27, 2023
8ef7c8d
[PI-139]: Generate stark signature
arijoon Jul 25, 2023
a7a42f2
[PI-139]: Code cleanup and refactor
arijoon Jul 26, 2023
9a8ebc1
[PI-139]: Add a single function for backup in clientjs
arijoon Aug 3, 2023
95fab7f
[PI-139]: Add ledger support
arijoon Aug 3, 2023
33391c0
[PI-139]: Fix the API call function
arijoon Aug 3, 2023
811115c
[PI-139]: Add example source to the generator
arijoon Aug 4, 2023
1c14268
[PI-139]: Remove the type declaration file and embed in jsdocs
arijoon Aug 4, 2023
497ab74
Merge pull request #550 from rhinofi/feat/PI-139-registration-payload
arijoon Aug 7, 2023
7fa603a
[PI-139]: Do not mutate the object config during l1 storage
arijoon Aug 8, 2023
a23deb6
Merge pull request #552 from rhinofi/fix/PI-139-config-fetch-without-…
arijoon Aug 8, 2023
ac567f7
Merge branch 'master' into dev
adrian-gierakowski Aug 8, 2023
6837c64
[BRIDGES-1225]: Update the bridge contract ABI
arijoon Aug 22, 2023
ccf3e37
Merge pull request #553 from rhinofi/feat/BRIDGES-1225-bridge-gas-opt…
arijoon Aug 22, 2023
4ed53b6
removed undeclared vars
Dynki Aug 30, 2023
299b08f
replace request-promise with request
Dynki Aug 30, 2023
fc49b79
changed to use post and get generic
Dynki Aug 31, 2023
a51ee78
Merge pull request #554 from rhinofi/feature/PI-386-removed-undeclare…
adrian-gierakowski Aug 31, 2023
682c4fe
changes related to use of request from dvf utils
Dynki Aug 31, 2023
bccda57
removed parsing of response as not required
Dynki Aug 31, 2023
37433fd
[PI-387] fix submitOrder
adrian-gierakowski Aug 31, 2023
e10df97
issue params when using post/get generic
Dynki Aug 31, 2023
060b915
Merge branch 'feature/PI-387-use-fetch-instead-of-request-promise' of…
Dynki Aug 31, 2023
65b5e36
[PI-387] add example for estimatedNextBatchTime
adrian-gierakowski Aug 31, 2023
cf8c7c7
[PI-387] bump version 5.2.2 => 5.3.0
adrian-gierakowski Aug 31, 2023
7faf8d4
Merge pull request #555 from rhinofi/feature/PI-387-use-fetch-instead…
adrian-gierakowski Aug 31, 2023
cabf557
[PI-387] remove request-promise from package.json and bump version
adrian-gierakowski Aug 31, 2023
0d2fc30
removed reference to ledger node-hid package
Dynki Sep 1, 2023
4e59be3
updated minor version to 5.4.0
Dynki Sep 1, 2023
624fec0
Merge pull request #557 from rhinofi/feature/PI-390-remove-node-hid-p…
Dynki Sep 4, 2023
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
13 changes: 10 additions & 3 deletions .github/workflows/test-and-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,26 @@ jobs:

- id: auth
name: Authenticate to Google Cloud
uses: google-github-actions/auth@v0
uses: google-github-actions/auth@v1.1.1
with:
workload_identity_provider: projects/1000420590118/locations/global/workloadIdentityPools/github-workflows/providers/github-workflows
service_account: [email protected]

- uses: cachix/install-nix-action@v19
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
experimental-features = nix-command

- id: secrets
uses: google-github-actions/[email protected]
with:
secrets: github_token:dvf-shared/GITHUB_TOKEN_ALL_REPOS_READ

- name: Bootstrap nix config
run: echo ${{ secrets.CI_GITHUB_TOKEN }} | ./nix/netrc-create.sh
env:
GITHUB_TOKEN: '${{ steps.secrets.outputs.github_token }}'
run: ./nix/netrc-create.sh

- name: Run pr-step
run: nix run --impure -f nix/pkgs-private.nix ci.pr-step
Expand Down
2 changes: 1 addition & 1 deletion env/test
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Add Web3 url
RPC_URL=https://ropsten.infura.io/v3/7bfab7398ae84af3b1b70c955cfd9491
RPC_URL=https://goerli.infura.io/v3/3d572ae9b01e45c789c3214696bb02d4
# Add GAS STATION API KEY
# Ethereum private key prefixed with 0x
PRIVATE_ETH_KEY=0x49e4d1e2aa7d026188251392dd2d335c176d846d8a894a8092c835f3b345e2ad
Expand Down
2 changes: 1 addition & 1 deletion examples/00.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
const fs = require('fs')
const readline = require('readline')
const Web3 = require('web3')
const P = require('aigle')
const P = require('@rhino.fi/aigle')
const saveAsJson = require('./helpers/saveAsJson')

const RPC_URL = process.argv[2]
Expand Down
2 changes: 1 addition & 1 deletion examples/08.cancelOrder.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const rhinofiConfig = {
;(async () => {
const rhinofi = await RhinofiClientFactory(web3, rhinofiConfig)

const P = require('aigle')
const P = require('@rhino.fi/aigle')
let order
const orders = await rhinofi.getOrders()

Expand Down
1 change: 1 addition & 0 deletions examples/25.fastWithdrawalFee.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const rhinofiConfig = {
;(async () => {
const rhinofi = await RhinofiClientFactory(web3, rhinofiConfig)

// NOTE: fastWithdrawalFee method as been deprecated
const response = await rhinofi.fastWithdrawalFee('ETH')

logExampleResult(response)
Expand Down
2 changes: 1 addition & 1 deletion examples/28.ammWithdrawal.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const rhinofiConfig = {
ammDepositOrderData
)

const P = require('aigle')
const P = require('@rhino.fi/aigle')

await P.retry(
{ times: 360, interval: 1000 },
Expand Down
65 changes: 65 additions & 0 deletions examples/33.generateL1RegistrationPayload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/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 { 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
})
})()
.catch(error => {
console.error(error)
process.exit(1)
})
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)
})
2 changes: 2 additions & 0 deletions examples/helpers/examplesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ module.exports = Object.freeze([
'publicPermissions',
'transfer',
'getRegistrationStatuses',
'generateL1RegistrationPayload',
'estimatedNextBatchTime',
// TODO
// 'submitBuyOrder',
// 'submitSellOrder',
Expand Down
2 changes: 1 addition & 1 deletion examples/helpers/getOrCreateActiveOrder.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const P = require('aigle')
const P = require('@rhino.fi/aigle')

const defaultOrderProps = Object.freeze({
cid: 'mycid-' + Math.random().toString(36).substring(7),
Expand Down
2 changes: 1 addition & 1 deletion examples/helpers/logMyIP.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S yarn node

const P = require('aigle')
const P = require('@rhino.fi/aigle')

const request = require('./request')

Expand Down
2 changes: 1 addition & 1 deletion examples/helpers/waitForDepositCreditedOnChain.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const P = require('aigle')
const P = require('@rhino.fi/aigle')

module.exports = async (rhinofi, deposit) => {
console.log('waiting for deposit to be credited on chain...')
Expand Down
2 changes: 1 addition & 1 deletion examples/src/ammWithdrawal.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const ammDeposit = await rhinofi.postAmmFundingOrders(
ammDepositOrderData
)

const P = require('aigle')
const P = require('@rhino.fi/aigle')

await P.retry(
{ times: 360, interval: 1000 },
Expand Down
2 changes: 1 addition & 1 deletion examples/src/cancelOrder.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const P = require('aigle')
const P = require('@rhino.fi/aigle')
let order
const orders = await rhinofi.getOrders()

Expand Down
1 change: 1 addition & 0 deletions examples/src/fastWithdrawalFee.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// NOTE: fastWithdrawalFee method as been deprecated
const response = await rhinofi.fastWithdrawalFee('ETH')

logExampleResult(response)
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
})
6 changes: 4 additions & 2 deletions nix/netrc-create.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/usr/bin/env bash
set -ueo pipefail

github_token=''${GITHUB_TOKEN-}
github_token=${GITHUB_TOKEN-}

if [[ -z $github_token ]]; then
read -s github_token
while read -r github_token; do
break
done
fi

github_user=${1:-dvf-ci}
Expand Down
6 changes: 3 additions & 3 deletions nix/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
"homepage": "",
"owner": "rhinofi",
"repo": "rhino-core",
"rev": "c2183a731421203e076c7dba37d339fa15e70b1d",
"sha256": "0ygx4q7pna7qr8d8wx42ynk7ygz3cpz8zjd7hz1nz3wx39d4ps9h",
"rev": "8424a851d2bd6913bbf111859e2aeda2a8924c7a",
"sha256": "1zvk99gfa5lfzvkyzjxlpp05abfvvyixzwhhshr3nc5gjq8yiiwb",
"type": "tarball",
"url": "https://github.com/rhinofi/rhino-core/archive/c2183a731421203e076c7dba37d339fa15e70b1d.tar.gz",
"url": "https://github.com/rhinofi/rhino-core/archive/8424a851d2bd6913bbf111859e2aeda2a8924c7a.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"yarn-berry-cjs-rhinofi": {
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rhino.fi/client-js",
"version": "5.1.1",
"version": "5.4.0",
"main": "src/index.js",
"files": [
"src",
Expand All @@ -10,7 +10,8 @@
"scripts": {
"test": "env-cmd -f ./env/test jest --testTimeout 10000",
"test:watch": "env-cmd -f ./env/test jest --watch --testTimeout 10000 --verbose true",
"test:coverage": "env-cmd -f ./env/test jest --testTimeout 10000 --coverage"
"test:coverage": "env-cmd -f ./env/test jest --testTimeout 10000 --coverage",
"link-rhino-portal": "rm -rf ../rhino-portal/node_modules/@rhino.fi/client-js && rm -rf ../rhino-portal/node_modules/.cache && cp -r . ../rhino-portal/node_modules/@rhino.fi/client-js"
},
"jest": {
"coverageReporters": [
Expand All @@ -27,18 +28,17 @@
"homepage": "https://github.com/rhinofi/client-js",
"license": "MIT",
"dependencies": {
"@ledgerhq/hw-app-eth": "6.23.0",
"@ledgerhq/hw-transport-webhid": "6.20.0",
"@ledgerhq/hw-app-eth": "6.28.1",
"@ledgerhq/hw-transport-webhid": "6.27.1",
"@rhino.fi/aigle": "^1.15.0-alpha.3",
"@rhino.fi/dvf-utils": "^1.4.5",
"@rhino.fi/starkware-crypto": "^0.1.7",
"aigle": "suguru03/aigle#8739846ba9d4cfc116e1546da1181c73564cae0b",
"aware": "^0.3.1",
"bignumber.js": "^9.0.0",
"eip-712": "1.0.0",
"lodash": "^4.17.20",
"ramda": "^0.27.1",
"request": "^2.88.2",
"request-promise": "^4.2.6",
"web3": "^1.7.5",
"web3-utils": "^1.3.0"
},
Expand All @@ -47,6 +47,7 @@
"@truffle/hdwallet-provider": "^2.0.13",
"env-cmd": "^10.1.0",
"jest": "^26.4.2",
"jest-environment-jsdom": "25",
"mustache": "^4.0.0",
"nock": "^13.0.4",
"solc": "^0.4.24"
Expand Down
18 changes: 8 additions & 10 deletions src/api/bridgedDeposit.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const validateArg0 = validateWithJoi(schema)('INVALID_METHOD_ARGUMENT')({
const endpoint = '/v1/trading/bridgedDeposits'
const validationEndpoint = '/v1/trading/deposits-validate'

module.exports = async (dvf, data, nonce, signature, txHashCb) => {
module.exports = async (dvf, data, nonce, signature, txHashCb, onlyOnChain) => {
const { chain, token, amount, web3Options, permitParams, referralId } = validateArg0(data)

const tokenInfo = dvf.token.getTokenInfoOrThrow(token)
Expand All @@ -37,7 +37,7 @@ module.exports = async (dvf, data, nonce, signature, txHashCb) => {

// Base units should be using the execution chain
const tokenChainInfo = dvf.token.getTokenInfoForChainOrThrow(token, chain)
const baseUnitAmount = toBN(amount).shiftedBy(tokenChainInfo.decimals).toString()
const baseUnitAmount = dvf.token.toBaseUnitAmount(token, amount, tokenChainInfo)

// Force the use of header (instead of payload) for authentication.
dvf = FP.set('config.useAuthHeader', true, dvf)
Expand Down Expand Up @@ -73,6 +73,11 @@ module.exports = async (dvf, data, nonce, signature, txHashCb) => {

const { transactionHash, clearCallback } = await transactionHashPromise

if (onlyOnChain) {
await onChainDepositPromise
return { transactionHash }
}

const payload = {
chain,
token,
Expand All @@ -82,17 +87,10 @@ module.exports = async (dvf, data, nonce, signature, txHashCb) => {
}
const httpDeposit = await post(dvf, endpoint, nonce, signature, payload)

const onChainDeposit = await onChainDepositPromise
await onChainDepositPromise
if (typeof clearCallback === 'function') {
clearCallback()
}

if (!onChainDeposit.status) {
throw new DVFError('ERR_ONCHAIN_BRIDGED_DEPOSIT', {
httpDeposit,
onChainDeposit
})
}

return { ...httpDeposit, transactionHash }
}
Loading