2022-02-23 05:51:12 -08:00
|
|
|
/*
|
|
|
|
|
Mocks for the Adapter library.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
const BCHJS = require('@psf/bch-js')
|
|
|
|
|
const bchjs = new BCHJS()
|
|
|
|
|
|
|
|
|
|
const ipfs = {
|
|
|
|
|
ipfsAdapter: {
|
|
|
|
|
ipfs: {}
|
|
|
|
|
},
|
|
|
|
|
ipfsCoordAdapter: {
|
|
|
|
|
ipfsCoord: {
|
|
|
|
|
useCases: {
|
|
|
|
|
peer: {
|
2022-03-09 09:37:17 -08:00
|
|
|
sendPrivateMessage: () => {
|
|
|
|
|
}
|
2022-02-23 05:51:12 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const localdb = {
|
|
|
|
|
Users: class Users {
|
|
|
|
|
static findById () {}
|
|
|
|
|
static find () {}
|
|
|
|
|
static findOne () {
|
|
|
|
|
return {
|
|
|
|
|
validatePassword: localdb.validatePassword
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async save () {
|
|
|
|
|
return {}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
generateToken () {
|
|
|
|
|
return '123'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
toJSON () {
|
|
|
|
|
return {}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async remove () {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async validatePassword () {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
validatePassword: () => {
|
|
|
|
|
return true
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
Entry: class Entry {
|
|
|
|
|
constructor (obj) {
|
|
|
|
|
;(this._id = 'id'), (this.entry = obj.entry)
|
|
|
|
|
this.slpAddress = obj.slpAddress
|
|
|
|
|
this.description = obj.description
|
|
|
|
|
this.signature = obj.signature
|
|
|
|
|
this.category = obj.category
|
|
|
|
|
this.balance = obj.balance
|
|
|
|
|
this.merit = obj.merit
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static findById () {}
|
|
|
|
|
static find () {}
|
|
|
|
|
static findOne () {}
|
|
|
|
|
|
|
|
|
|
async save () {
|
|
|
|
|
return {}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
Order: class Order {
|
|
|
|
|
constructor (obj) {}
|
|
|
|
|
|
|
|
|
|
static findById () {}
|
|
|
|
|
static find () {}
|
|
|
|
|
static findOne () {}
|
|
|
|
|
|
|
|
|
|
async save () {
|
|
|
|
|
return {}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const bch = {
|
|
|
|
|
getMerit: async () => {
|
|
|
|
|
return 100
|
|
|
|
|
},
|
|
|
|
|
getPSFTokenBalance: async () => {
|
|
|
|
|
return 100
|
|
|
|
|
},
|
|
|
|
|
_verifySignature: () => {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// const wallet = {
|
|
|
|
|
// burnPsf: async () => {},
|
|
|
|
|
// generateSignature: async () => {}
|
|
|
|
|
// }
|
|
|
|
|
const { MockBchWallet } = require('./wallet')
|
|
|
|
|
const wallet = {
|
2022-03-09 09:37:17 -08:00
|
|
|
burnPsf: async () => {
|
|
|
|
|
},
|
|
|
|
|
generateSignature: async () => {
|
|
|
|
|
},
|
2022-02-23 05:51:12 -08:00
|
|
|
getKeyPair: async () => {
|
|
|
|
|
return { cashAddress: 'fakeAddr', wif: 'fakeWif', hdIndex: 1 }
|
|
|
|
|
},
|
|
|
|
|
bchWallet: new MockBchWallet()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const p2wdb = {
|
2022-03-09 09:37:17 -08:00
|
|
|
write: async () => {
|
|
|
|
|
},
|
|
|
|
|
checkForSufficientFunds: async () => true
|
2022-02-23 05:51:12 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-09 09:37:17 -08:00
|
|
|
module.exports = { ipfs, localdb, bch, wallet, p2wdb, bchjs}
|