mirror of
https://github.com/Permissionless-Software-Foundation/ipfs-bch-wallet-consumer.git
synced 2026-09-21 16:52:03 -07:00
Fixing merge conflicts
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"email": "system@system.com",
|
"email": "system@system.com",
|
||||||
"name": "admin",
|
"name": "admin",
|
||||||
"password": "UdbCjMgm7T8efeyUfcdN",
|
"password": "NR0S1fPGLOAGUwPfKpJe",
|
||||||
"type": "admin",
|
"type": "admin",
|
||||||
"id": "68daea62e9b47af49f86dae9",
|
"id": "698277538440afae85603e83",
|
||||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY4ZGFlYTYyZTliNDdhZjQ5Zjg2ZGFlOSIsImlhdCI6MTc1OTE3NzMxNH0.-mFCzyDri0OLMz-oM03qyYPj7srEH_6HFLGzgCf_JLI"
|
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY5ODI3NzUzODQ0MGFmYWU4NTYwM2U4MyIsImlhdCI6MTc3MDE1NzkwN30.rBILkWIXFtj0OkGBQyJyf89i9S2SYhm4ETPhvevVwaQ"
|
||||||
}
|
}
|
||||||
Generated
+5460
-6559
File diff suppressed because it is too large
Load Diff
+15
-3
@@ -39,14 +39,14 @@
|
|||||||
"@libp2p/tcp": "10.1.2",
|
"@libp2p/tcp": "10.1.2",
|
||||||
"@libp2p/webrtc": "5.2.2",
|
"@libp2p/webrtc": "5.2.2",
|
||||||
"@libp2p/websockets": "9.2.2",
|
"@libp2p/websockets": "9.2.2",
|
||||||
"@multiformats/multiaddr": "12.3.5",
|
"@multiformats/multiaddr": "12.5.1",
|
||||||
"axios": "0.27.2",
|
"axios": "0.27.2",
|
||||||
"bcryptjs": "2.4.3",
|
"bcryptjs": "2.4.3",
|
||||||
"blockstore-fs": "2.0.2",
|
"blockstore-fs": "2.0.2",
|
||||||
"datastore-fs": "10.0.2",
|
"datastore-fs": "10.0.2",
|
||||||
"glob": "7.1.6",
|
"glob": "7.1.6",
|
||||||
"helia": "5.2.1",
|
"helia": "5.2.1",
|
||||||
"helia-coord": "1.7.2",
|
"helia-coord": "1.9.7",
|
||||||
"jsonrpc-lite": "2.2.0",
|
"jsonrpc-lite": "2.2.0",
|
||||||
"jsonwebtoken": "8.5.1",
|
"jsonwebtoken": "8.5.1",
|
||||||
"jwt-bch-lib": "1.3.0",
|
"jwt-bch-lib": "1.3.0",
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
"libp2p": "2.7.2",
|
"libp2p": "2.7.2",
|
||||||
"line-reader": "0.4.0",
|
"line-reader": "0.4.0",
|
||||||
"mime-types": "2.1.35",
|
"mime-types": "2.1.35",
|
||||||
"minimal-slp-wallet": "5.13.2",
|
"minimal-slp-wallet": "7.1.4",
|
||||||
"mongoose": "5.13.14",
|
"mongoose": "5.13.14",
|
||||||
"node-fetch": "npm:@achingbrain/node-fetch@2.6.7",
|
"node-fetch": "npm:@achingbrain/node-fetch@2.6.7",
|
||||||
"nodemailer": "6.7.5",
|
"nodemailer": "6.7.5",
|
||||||
@@ -105,5 +105,17 @@
|
|||||||
"ignore": [
|
"ignore": [
|
||||||
"/test/unit/mocks/**/*.js"
|
"/test/unit/mocks/**/*.js"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"overrides": {
|
||||||
|
"@multiformats/multiaddr-to-uri": "10.1.2",
|
||||||
|
"@multiformats/multiaddr-matcher": "1.6.0",
|
||||||
|
"@multiformats/multiaddr": "12.5.1",
|
||||||
|
"helia": {
|
||||||
|
"libp2p": "2.7.2",
|
||||||
|
"@libp2p/upnp-nat": "3.0.0"
|
||||||
|
},
|
||||||
|
"libp2p": {
|
||||||
|
"@multiformats/multiaddr": "12.5.1"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#IMAGE BUILD COMMANDS
|
#IMAGE BUILD COMMANDS
|
||||||
# ct-base-ubuntu = ubuntu 18.04 + nodejs v10 LTS
|
# ct-base-ubuntu = ubuntu 18.04 + nodejs v10 LTS
|
||||||
#FROM christroutner/ct-base-ubuntu
|
#FROM christroutner/ct-base-ubuntu
|
||||||
FROM ubuntu:20.04
|
FROM ubuntu:24.04
|
||||||
MAINTAINER Chris Troutner <chris.troutner@gmail.com>
|
MAINTAINER Chris Troutner <chris.troutner@gmail.com>
|
||||||
|
|
||||||
#Update the OS and install any OS packages needed.
|
#Update the OS and install any OS packages needed.
|
||||||
@@ -15,7 +15,7 @@ RUN apt-get install -y sudo git curl nano gnupg wget
|
|||||||
RUN sudo apt-get install -y ca-certificates curl gnupg
|
RUN sudo apt-get install -y ca-certificates curl gnupg
|
||||||
RUN sudo mkdir -p /etc/apt/keyrings
|
RUN sudo mkdir -p /etc/apt/keyrings
|
||||||
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
||||||
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
|
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
|
||||||
RUN sudo apt-get update
|
RUN sudo apt-get update
|
||||||
RUN sudo apt-get install -y nodejs build-essential
|
RUN sudo apt-get install -y nodejs build-essential
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class Adapters {
|
|||||||
this.passport = new Passport()
|
this.passport = new Passport()
|
||||||
this.nodemailer = new Nodemailer()
|
this.nodemailer = new Nodemailer()
|
||||||
this.jsonFiles = new JSONFiles()
|
this.jsonFiles = new JSONFiles()
|
||||||
this.bchjs = new BCHJS()
|
this.bchjs = new BCHJS({ restURL: config.apiServer })
|
||||||
this.config = config
|
this.config = config
|
||||||
this.bch = new BCH(localConfig)
|
this.bch = new BCH(localConfig)
|
||||||
this.p2wdb = new P2WDB(localConfig)
|
this.p2wdb = new P2WDB(localConfig)
|
||||||
|
|||||||
@@ -66,7 +66,26 @@ class IpfsRESTControllerLib {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return information on IPFS peers this node is connected to.
|
/**
|
||||||
|
* @api {post} /ipfs/peers Get information on IPFS peers this node is connected to
|
||||||
|
* @apiPermission public
|
||||||
|
* @apiName GetIpfsPeers
|
||||||
|
* @apiGroup REST IPFS
|
||||||
|
*
|
||||||
|
* @apiParam {Boolean} [showAll=false] Whether to include detailed peer data
|
||||||
|
*
|
||||||
|
* @apiExample Example usage:
|
||||||
|
* curl -H "Content-Type: application/json" -X POST localhost:5001/ipfs/peers \
|
||||||
|
* -d '{"showAll": false}'
|
||||||
|
*
|
||||||
|
* @apiSuccess {Object[]} peers Array of peer objects
|
||||||
|
* @apiSuccess {String} peers[].peer Peer ID
|
||||||
|
* @apiSuccess {String} peers[].name Peer name
|
||||||
|
* @apiSuccess {String} peers[].protocol Protocol used by the peer
|
||||||
|
* @apiSuccess {String} peers[].version Peer version
|
||||||
|
* @apiSuccess {String} peers[].connectionAddr Connection address
|
||||||
|
* @apiSuccess {Object} [peers[].peerData] Detailed peer data (when showAll=true)
|
||||||
|
*/
|
||||||
async getPeers (ctx) {
|
async getPeers (ctx) {
|
||||||
try {
|
try {
|
||||||
const showAll = ctx.request.body.showAll
|
const showAll = ctx.request.body.showAll
|
||||||
@@ -81,6 +100,24 @@ class IpfsRESTControllerLib {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @api {post} /ipfs/relays Get data about the known Circuit Relays
|
||||||
|
* @apiPermission public
|
||||||
|
* @apiName GetIpfsRelays
|
||||||
|
* @apiGroup REST IPFS
|
||||||
|
*
|
||||||
|
* @apiDescription Returns information about Circuit Relays, both v1 and v2, that this node knows about. V2 relays are hydrated with peer data from the connected peers list.
|
||||||
|
*
|
||||||
|
* @apiExample Example usage:
|
||||||
|
* curl -H "Content-Type: application/json" -X POST localhost:5001/ipfs/relays
|
||||||
|
*
|
||||||
|
* @apiSuccess {Object} relays Object containing relay information
|
||||||
|
* @apiSuccess {Object[]} relays.v2Relays Array of v2 Circuit Relay objects
|
||||||
|
* @apiSuccess {String} relays.v2Relays[].ipfsId IPFS ID of the relay
|
||||||
|
* @apiSuccess {String} relays.v2Relays[].name Name of the relay (hydrated from peer data)
|
||||||
|
* @apiSuccess {String} relays.v2Relays[].description Description of the relay (hydrated from peer data)
|
||||||
|
* @apiSuccess {Object[]} relays.v1Relays Array of v1 Circuit Relay configurations
|
||||||
|
*/
|
||||||
// Get data about the known Circuit Relays. Hydrate with data from peers list.
|
// Get data about the known Circuit Relays. Hydrate with data from peers list.
|
||||||
async getRelays (ctx) {
|
async getRelays (ctx) {
|
||||||
try {
|
try {
|
||||||
@@ -94,6 +131,24 @@ class IpfsRESTControllerLib {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @api {post} /ipfs/connect Connect to a specific IPFS peer
|
||||||
|
* @apiPermission public
|
||||||
|
* @apiName ConnectToIpfsPeer
|
||||||
|
* @apiGroup REST IPFS
|
||||||
|
*
|
||||||
|
* @apiDescription Attempts to establish a connection to a specific IPFS peer using the provided multiaddr. Optionally returns detailed information about the connection.
|
||||||
|
*
|
||||||
|
* @apiParam {String} multiaddr Multiaddress of the peer to connect to (required)
|
||||||
|
* @apiParam {Boolean} [getDetails=false] Whether to return detailed connection information
|
||||||
|
*
|
||||||
|
* @apiExample Example usage:
|
||||||
|
* curl -H "Content-Type: application/json" -X POST localhost:5001/ipfs/connect \
|
||||||
|
* -d '{"multiaddr": "/ip4/161.35.99.207/tcp/4001/p2p/12D3KooWDtj9cfj1SKuLbDNKvKRKSsGN8qivq9M8CYpLPDpcD5pu", "getDetails": false}'
|
||||||
|
*
|
||||||
|
* @apiSuccess {Boolean} success Indicates whether the connection attempt was successful
|
||||||
|
* @apiSuccess {Object} [details] Additional connection details (when getDetails=true)
|
||||||
|
*/
|
||||||
async connect (ctx) {
|
async connect (ctx) {
|
||||||
try {
|
try {
|
||||||
const multiaddr = ctx.request.body.multiaddr
|
const multiaddr = ctx.request.body.multiaddr
|
||||||
|
|||||||
@@ -14,13 +14,14 @@ describe('#adapters', () => {
|
|||||||
let uut, sandbox
|
let uut, sandbox
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
uut = new Adapters()
|
|
||||||
|
|
||||||
sandbox = sinon.createSandbox()
|
sandbox = sinon.createSandbox()
|
||||||
|
uut = new Adapters()
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
sandbox.restore()
|
if (sandbox) {
|
||||||
|
sandbox.restore()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('#start', () => {
|
describe('#start', () => {
|
||||||
|
|||||||
@@ -10,15 +10,24 @@ describe('#config', () => {
|
|||||||
before(() => {
|
before(() => {
|
||||||
// Backup the current environment setting.
|
// Backup the current environment setting.
|
||||||
currentEnv = process.env.CONSUMER_ENV
|
currentEnv = process.env.CONSUMER_ENV
|
||||||
|
|
||||||
|
// Clear CONSUMER_ENV for the first test to ensure default behavior
|
||||||
|
delete process.env.CONSUMER_ENV
|
||||||
})
|
})
|
||||||
|
|
||||||
after(() => {
|
after(() => {
|
||||||
// Restore the environment setting before starting these tests.
|
// Restore the environment setting before starting these tests.
|
||||||
process.env.CONSUMER_ENV = currentEnv
|
if (currentEnv) {
|
||||||
|
process.env.CONSUMER_ENV = currentEnv
|
||||||
|
} else {
|
||||||
|
delete process.env.CONSUMER_ENV
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should return development environment config by default', async () => {
|
it('Should return development environment config by default', async () => {
|
||||||
const importedConfig = await import('../../../config/index.js')
|
// Ensure CONSUMER_ENV is not set for this test
|
||||||
|
delete process.env.CONSUMER_ENV
|
||||||
|
const importedConfig = await import('../../../config/index.js?foo=bar0')
|
||||||
const config = importedConfig.default
|
const config = importedConfig.default
|
||||||
// console.log('config: ', config)
|
// console.log('config: ', config)
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class MockBchWallet {
|
|||||||
this.walletInfoPromise = true;
|
this.walletInfoPromise = true;
|
||||||
this.walletInfo = mockWallet;
|
this.walletInfo = mockWallet;
|
||||||
this.initialize = async () => {}
|
this.initialize = async () => {}
|
||||||
this.bchjs = new BCHJS();
|
this.bchjs = new BCHJS({ restURL: 'https://free-bch.fullstack.cash/' });
|
||||||
this.burnTokens = async () => {
|
this.burnTokens = async () => {
|
||||||
return { success: true, txid: 'txid' };
|
return { success: true, txid: 'txid' };
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import mongoose from 'mongoose'
|
import mongoose from 'mongoose'
|
||||||
import config from '../../config/index.js'
|
import config from '../../config/index.js'
|
||||||
import User from '../../src/models/users.js'
|
import User from '../../src/adapters/localdb/models/users.js'
|
||||||
|
|
||||||
async function getUsers () {
|
async function getUsers () {
|
||||||
// Connect to the Mongo Database.
|
// Connect to the Mongo Database.
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import mongoose from 'mongoose'
|
||||||
|
import config from '../../config/index.js'
|
||||||
|
import User from '../../src/adapters/localdb/models/users.js'
|
||||||
|
|
||||||
|
async function getUsers () {
|
||||||
|
// Connect to the Mongo Database.
|
||||||
|
mongoose.Promise = global.Promise
|
||||||
|
mongoose.set('useCreateIndex', true) // Stop deprecation warning.
|
||||||
|
await mongoose.connect(
|
||||||
|
config.database,
|
||||||
|
{ useNewUrlParser: true, useUnifiedTopology: true }
|
||||||
|
)
|
||||||
|
|
||||||
|
// Find the user by email.
|
||||||
|
const user = await User.findOne({
|
||||||
|
email: 'test@test.com'
|
||||||
|
}, '-password')
|
||||||
|
|
||||||
|
// Update the users password
|
||||||
|
// user.password = 'newpassword'
|
||||||
|
|
||||||
|
// Change the user to an admin
|
||||||
|
// user.type = 'admin'
|
||||||
|
|
||||||
|
// Save the changes to the database.
|
||||||
|
await user.save()
|
||||||
|
|
||||||
|
mongoose.connection.close()
|
||||||
|
}
|
||||||
|
getUsers()
|
||||||
Reference in New Issue
Block a user