mirror of
https://github.com/Permissionless-Software-Foundation/ipfs-bch-wallet-service.git
synced 2026-09-21 16:52:03 -07:00
140 lines
2.0 KiB
JavaScript
140 lines
2.0 KiB
JavaScript
/*
|
|
Mocks for the Adapter library.
|
|
*/
|
|
|
|
class IpfsAdapter {
|
|
constructor () {
|
|
this.ipfs = {
|
|
files: {
|
|
stat: () => {}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
class IpfsCoordAdapter {
|
|
constructor () {
|
|
this.ipfsCoord = {
|
|
adapters: {
|
|
ipfs: {
|
|
connectToPeer: async () => {}
|
|
}
|
|
},
|
|
useCases: {
|
|
peer: {
|
|
sendPrivateMessage: () => {}
|
|
}
|
|
},
|
|
thisNode: {}
|
|
}
|
|
}
|
|
}
|
|
|
|
const ipfs = {
|
|
ipfsAdapter: new IpfsAdapter(),
|
|
ipfsCoordAdapter: new IpfsCoordAdapter(),
|
|
getStatus: async () => {},
|
|
getPeers: async () => {},
|
|
getRelays: async () => {}
|
|
}
|
|
ipfs.ipfs = ipfs.ipfsAdapter.ipfs
|
|
|
|
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
|
|
}
|
|
},
|
|
|
|
Usage: class Usage {
|
|
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
|
|
}
|
|
static async deleteMany(){
|
|
return true
|
|
}
|
|
},
|
|
|
|
validatePassword: () => {
|
|
return true
|
|
}
|
|
}
|
|
|
|
const bchjs = {
|
|
Electrumx: {
|
|
transactions: () => {},
|
|
balance: () => {},
|
|
sortAllTxs: () => {}
|
|
},
|
|
Utxo: {
|
|
get: () => {},
|
|
isValid: () => true
|
|
},
|
|
Transaction: {
|
|
get: () => {}
|
|
},
|
|
RawTransactions: {
|
|
sendRawTransaction: () => {}
|
|
},
|
|
encryption: {
|
|
getPubKey: () => {}
|
|
},
|
|
Util: {
|
|
chunk100: () => {}
|
|
},
|
|
PsfSlpIndexer: {
|
|
getTokenData: () => {},
|
|
getTokenData2: () => {}
|
|
}
|
|
}
|
|
|
|
export default { ipfs, localdb, bchjs };
|