Skip to content

Commit

Permalink
Getting it working with new address
Browse files Browse the repository at this point in the history
  • Loading branch information
christroutner committed Feb 14, 2021
1 parent febe091 commit 692054a
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 37 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ state.json
system-user-*.json

start-token-liquidity.sh
start-avax-bridge.sh

!README.md
docs
22 changes: 7 additions & 15 deletions config/bchjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,26 @@ const config = {}
if (RESTAPI === 'fullstack.cash') {
// config.BCHLIB = BCHJS.BitboxShim()
config.BCHLIB = BCHJS
config.MAINNET_REST = 'https://bchn.fullstack.cash/v3/'
config.TESTNET_REST = 'https://testnet3.fullstack.cash/v3/'
config.MAINNET_REST = 'https://bchn.fullstack.cash/v4/'
config.TESTNET_REST = 'https://testnet3.fullstack.cash/v4/'
config.RESTAPI = 'fullstack.cash'
}

// Use bch-js but use it with the bitcoin.com infrastructure.
if (RESTAPI === 'rest.bitcoin.com') {
config.BCHLIB = BCHJS.BitboxShim()
config.MAINNET_REST = 'https://rest.bitcoin.com/v2/'
config.TESTNET_REST = 'http://157.245.141.224:3000/v2/'
config.RESTAPI = 'rest.bitcoin.com'
}

// Use bch-js with local infrastructure.
if (RESTAPI === 'local') {
config.BCHLIB = BCHJS.BitboxShim()
// config.MAINNET_REST = `http://192.168.0.36:12400/v3/`
// config.TESTNET_REST = `http://192.168.0.38:13400/v3/`
config.MAINNET_REST = 'http://127.0.0.1:3000/v3/'
config.TESTNET_REST = 'http://decatur.hopto.org:13400/v3/'
config.TESTNET_REST = 'http://192.168.0.38:13400/v3/'
config.MAINNET_REST = 'http://127.0.0.1:3000/v4/'
// config.TESTNET_REST = 'http://decatur.hopto.org:13400/v4/'
config.RESTAPI = 'local'
}

// Use bch-js with decatur infrastructure.
if (RESTAPI === 'decatur') {
config.BCHLIB = BCHJS.BitboxShim()
config.MAINNET_REST = 'http://decatur.hopto.org:12400/v3/'
config.TESTNET_REST = 'http://decatur.hopto.org:13400/v3/'
config.MAINNET_REST = 'http://decatur.hopto.org:12400/v4/'
config.TESTNET_REST = 'http://decatur.hopto.org:13400/v4/'
config.RESTAPI = 'decatur'
}

Expand Down
31 changes: 14 additions & 17 deletions config/env/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,28 @@ if (NETWORK === 'mainnet') {
configOut = {
NETWORK: 'mainnet',
port: process.env.PORT || 5000,
BCH_ADDR: 'bitcoincash:qrnn49rx0p4xh78tts79utf0zv26vyru6vqtl9trd3',
SLP_ADDR: 'simpleledger:qzhrpmu7nruyfcemeanqh5leuqcnf6zkjqems7xqf3',

// 145 derivation address.
BCH_ADDR: 'bitcoincash:qq5f0qz09xfnu536eegkr879sxusrl2pvyzm9nhyeh',

// 245 derivation address
SLP_ADDR: 'simpleledger:qzd3jfcpy0kftnwqcrxkwsw360zl00c87ynv8ytppe',

TOKENS_QTY_ORIGINAL: 50000,
BCH_QTY_ORIGINAL: 250,
SLP_TOKEN_ID:
'38e97c5d7d3585a2cbf3f9580c82ca33985f9cb0845d4dcce220cb709f9538b0'
'69d9575df68d90b435186afc6c6ea3f7e898cb487adbd947dc7a5bb4e3789cbd'
}

// BCHN Mainnet test wallet
// configOut = {
// NETWORK: 'mainnet',
// port: process.env.PORT || 5000,
// BCH_ADDR: 'bitcoincash:qzdq6jzvyzhyuj639l72rmqfzu3vd7eux5nhdzndwm',
// SLP_ADDR: 'simpleledger:qq0qr5aqv6whvjrhfygk7s38qmuglf5sm5ufqqaqm5',
// TOKENS_QTY_ORIGINAL: 50000,
// BCH_QTY_ORIGINAL: 250,
// SLP_TOKEN_ID:
// 'd0ef4de95b78222bfee2326ab11382f4439aa0855936e2fe6ac129a8d778baa0'
// }
} else {
configOut = {
NETWORK: 'testnet',
port: process.env.PORT || 5100,
BCH_ADDR: 'bchtest:qpz5hez3qmzrnjzdfu03tf7fp6ca0rlsaqvrxmfpyd',
SLP_ADDR: 'slptest:qpt74e74f75w6s7cd8r9p5fumvdhqf995g69udvd5n',

// 145 derivation path
BCH_ADDR: 'bchtest:qpl7x6u3pmwhf7ekjgqpjgy9fawgy9k5du0z8a8szj',

// 245 derivation path
SLP_ADDR: 'slptest:qptg4zdvrtxhxw4dyhvrqsjkae0tp58efg5layz4n5',
TOKENS_QTY_ORIGINAL: 50000,
BCH_QTY_ORIGINAL: 250,
SLP_TOKEN_ID:
Expand Down
2 changes: 1 addition & 1 deletion config/env/development.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
module.exports = {
session: 'secret-boilerplate-token',
token: 'secret-jwt-token',
database: 'mongodb://localhost:27017/psf-token-server-dev',
database: 'mongodb://localhost:27017/psf-avax-bridge-dev',
env: 'dev'
}
2 changes: 1 addition & 1 deletion config/env/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
module.exports = {
session: 'secret-boilerplate-token',
token: 'secret-jwt-token',
database: 'mongodb://172.17.0.1:3500/psf-token-server-prod',
database: 'mongodb://172.17.0.1:3500/psf-avax-bridge-prod',
env: 'prod'
}
2 changes: 1 addition & 1 deletion config/env/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
module.exports = {
session: 'secret-boilerplate-token',
token: 'secret-jwt-token',
database: 'mongodb://localhost:27017/psf-token-server-test',
database: 'mongodb://localhost:27017/psf-avax-bridge-test',
env: 'test'
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Transfers tokens between the AVAX and BCH blockchains",
"main": "avax-bridge.js",
"scripts": {
"start": "NETWORK=mainnet node token-liquidity.js",
"start": "NETWORK=mainnet node avax-bridge.js",
"test": "export AB_ENV=test && npm run prep-test && NETWORK=testnet TEST_ENV=unit nyc --reporter=text mocha --exit --timeout 15000 test/unit",
"test:integration": "export AB_ENV=test && npm run prep-test && NETWORK=mainnet TEST_ENV=integration nyc --reporter=text mocha --exit --timeout 30000 test/unit",
"test:temp": "mocha -g '#token-liquidity' test/unit",
Expand Down
1 change: 1 addition & 0 deletions src/lib/token-liquidity.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ class TokenLiquidity {
return retObj
} catch (err) {
wlogger.error(`Error in token-liquidity.js/processTx(${inObj.txid})`)
console.log('Error in token-liquidity.js/processTx(): ', err)
throw err
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/users/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class UserController {
}
} catch (err) {
// console.log(`err.message: ${err.message}`)
console.log('err in POST /user: ', err)
// console.log('err in POST /user: ', err)
ctx.throw(422, err.message)
}
}
Expand Down

0 comments on commit 692054a

Please sign in to comment.