mirror of
https://github.com/Permissionless-Software-Foundation/bch-dex.git
synced 2026-09-22 09:11:59 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac83827fca | ||
|
|
0811024030 | ||
|
|
737d35463d | ||
|
|
2ed1eaba9c | ||
|
|
9681def3e0 | ||
|
|
42f228af0e | ||
|
|
4ac7f59378 | ||
|
|
725c1c39a5 | ||
|
|
7290c8db30 | ||
|
|
36e1ec1f8e | ||
|
|
baa574a93e | ||
|
|
8333563d98 | ||
|
|
99fd116b6d | ||
|
|
ccae89ad01 | ||
|
|
0ecae58be2 | ||
|
|
5f442835e5 | ||
|
|
aa8fd89227 | ||
|
|
3da7432273 | ||
|
|
61c1dd5878 | ||
|
|
c095e7af39 | ||
|
|
fb9612bb65 | ||
|
|
e4a37b1c10 | ||
|
|
ba4f847e57 | ||
|
|
81e623e35f | ||
|
|
db1da9172c |
@@ -53,7 +53,7 @@ RUN git clone https://github.com/Permissionless-Software-Foundation/bch-dex-ui-v
|
|||||||
WORKDIR /home/safeuser/bch-dex-ui-v3
|
WORKDIR /home/safeuser/bch-dex-ui-v3
|
||||||
|
|
||||||
# For development: switch to unstable branch
|
# For development: switch to unstable branch
|
||||||
RUN git checkout ct-unstable
|
RUN git checkout psfoundation
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
#RUN mkdir .ipfsdata
|
#RUN mkdir .ipfsdata
|
||||||
|
|||||||
@@ -31,4 +31,7 @@ export APP_ID=bch-dex-001
|
|||||||
|
|
||||||
#export P2WDB_URL=http://172.17.0.1:5667
|
#export P2WDB_URL=http://172.17.0.1:5667
|
||||||
|
|
||||||
|
export DISABLE_NEW_ACCOUNTS=true
|
||||||
|
export ADMIN_PASSWORD=decatur
|
||||||
|
|
||||||
npm start
|
npm start
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"privateKey": "L4VyBDiWYYeeZhkM3xE3nsZigXJYmvRM29YBxoC7da4FzvubjxFo",
|
||||||
|
"publicKey": "028d6c77d865e6140db4b879a9bdf69ee4846593c0b6c48a82c448d5792806aab1",
|
||||||
|
"mnemonic": "split title trigger soda execute frost brush labor vague protect bicycle fiscal",
|
||||||
|
"cashAddress": "bitcoincash:qprrdk7en7m774gsafkycxcymc9ry209jus5v8wx5z",
|
||||||
|
"address": "bitcoincash:qprrdk7en7m774gsafkycxcymc9ry209jus5v8wx5z",
|
||||||
|
"legacyAddress": "17QG25rNUfnfj2NtdaFiyiqKSJatvEnMYd",
|
||||||
|
"hdPath": "m/44'/245'/0'/0/0",
|
||||||
|
"slpAddress": "simpleledger:qprrdk7en7m774gsafkycxcymc9ry209juu08umx2u",
|
||||||
|
"nextAddress": 1
|
||||||
|
}
|
||||||
@@ -46,6 +46,7 @@ const Offer = new mongoose.Schema({
|
|||||||
immutableDataCid: { type: String, default: null },
|
immutableDataCid: { type: String, default: null },
|
||||||
mutableDataCid: { type: String, default: null },
|
mutableDataCid: { type: String, default: null },
|
||||||
tokenIconUrl: { type: String, default: null },
|
tokenIconUrl: { type: String, default: null },
|
||||||
|
tokenData: { type: Object },
|
||||||
tokenCategories: { type: Array, default: [] },
|
tokenCategories: { type: Array, default: [] },
|
||||||
tokenTags: { type: Array, default: [] },
|
tokenTags: { type: Array, default: [] },
|
||||||
userDataStr: { type: String }, // Token user data
|
userDataStr: { type: String }, // Token user data
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ class OfferUseCases {
|
|||||||
const immutableDataCid = tokenData.immutableData
|
const immutableDataCid = tokenData.immutableData
|
||||||
offerEntity.mutableDataCid = mutableDataCid
|
offerEntity.mutableDataCid = mutableDataCid
|
||||||
offerEntity.immutableDataCid = immutableDataCid
|
offerEntity.immutableDataCid = immutableDataCid
|
||||||
|
offerEntity.tokenData = tokenData
|
||||||
|
|
||||||
// Get the mutable data from the cid if it exists.
|
// Get the mutable data from the cid if it exists.
|
||||||
if (mutableDataCid && typeof mutableDataCid === 'string') {
|
if (mutableDataCid && typeof mutableDataCid === 'string') {
|
||||||
@@ -1000,6 +1001,7 @@ class OfferUseCases {
|
|||||||
const immutableDataCid = tokenData.immutableData
|
const immutableDataCid = tokenData.immutableData
|
||||||
offer.mutableDataCid = mutableDataCid
|
offer.mutableDataCid = mutableDataCid
|
||||||
offer.immutableDataCid = immutableDataCid
|
offer.immutableDataCid = immutableDataCid
|
||||||
|
offer.tokenData = tokenData
|
||||||
|
|
||||||
// Get the mutable data from the cid if it exists.
|
// Get the mutable data from the cid if it exists.
|
||||||
if (mutableDataCid && typeof mutableDataCid === 'string') {
|
if (mutableDataCid && typeof mutableDataCid === 'string') {
|
||||||
|
|||||||
@@ -107,14 +107,14 @@ describe('#offer-use-case', () => {
|
|||||||
const result = await uut.createOffer(offerObj)
|
const result = await uut.createOffer(offerObj)
|
||||||
assert.isFalse(result)
|
assert.isFalse(result)
|
||||||
})
|
})
|
||||||
|
it('should create offer with token data', async () => {
|
||||||
it('should create offer with mutable data', async () => {
|
|
||||||
const tokenDataMock = mockData.nftTokenData01
|
const tokenDataMock = mockData.nftTokenData01
|
||||||
const offerObj = mockData.offerMockData
|
const offerObj = mockData.offerMockData
|
||||||
const mutableDataMock = mockData.mutableDataMock
|
const mutableDataMock = mockData.mutableDataMock
|
||||||
|
const offerEntityMock = Object.assign({}, mockData.offerMockData.data)
|
||||||
|
|
||||||
// Mock dependencies
|
// Mock dependencies
|
||||||
// sandbox.stub(uut.adapters.wallet.bchWallet, 'utxoIsValid').resolves(false)
|
sandbox.stub(uut.offerEntity, 'validate').returns(offerEntityMock)
|
||||||
sandbox.stub(uut, 'findOfferByTxid').throws(new Error('offer not found'))
|
sandbox.stub(uut, 'findOfferByTxid').throws(new Error('offer not found'))
|
||||||
sandbox.stub(uut.retryQueue, 'addToQueue')
|
sandbox.stub(uut.retryQueue, 'addToQueue')
|
||||||
.onCall(0).resolves({}) // Utxo Status call
|
.onCall(0).resolves({}) // Utxo Status call
|
||||||
@@ -123,6 +123,31 @@ describe('#offer-use-case', () => {
|
|||||||
|
|
||||||
const result = await uut.createOffer(offerObj)
|
const result = await uut.createOffer(offerObj)
|
||||||
assert.isTrue(result)
|
assert.isTrue(result)
|
||||||
|
console.log('offerEntityMock', offerEntityMock)
|
||||||
|
assert.property(offerEntityMock, 'tokenData')
|
||||||
|
})
|
||||||
|
it('should create offer with mutable data', async () => {
|
||||||
|
const tokenDataMock = mockData.nftTokenData01
|
||||||
|
const offerObj = mockData.offerMockData
|
||||||
|
const mutableDataMock = mockData.mutableDataMock
|
||||||
|
const offerEntityMock = Object.assign({}, mockData.offerMockData.data)
|
||||||
|
|
||||||
|
// Mock dependencies
|
||||||
|
sandbox.stub(uut.offerEntity, 'validate').returns(offerEntityMock)
|
||||||
|
sandbox.stub(uut, 'findOfferByTxid').throws(new Error('offer not found'))
|
||||||
|
sandbox.stub(uut.retryQueue, 'addToQueue')
|
||||||
|
.onCall(0).resolves({}) // Utxo Status call
|
||||||
|
.onCall(1).resolves(tokenDataMock) // Token Data call
|
||||||
|
.onCall(2).resolves(mutableDataMock)
|
||||||
|
|
||||||
|
const result = await uut.createOffer(offerObj)
|
||||||
|
assert.isTrue(result)
|
||||||
|
console.log('offerEntityMock', offerEntityMock)
|
||||||
|
|
||||||
|
assert.property(offerEntityMock, 'tokenIconUrl')
|
||||||
|
assert.property(offerEntityMock, 'tokenCategories')
|
||||||
|
assert.property(offerEntityMock, 'tokenTags')
|
||||||
|
assert.property(offerEntityMock, 'lastUpdatedTokenData')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should skip userData stringify error', async () => {
|
it('should skip userData stringify error', async () => {
|
||||||
@@ -1106,6 +1131,12 @@ describe('#offer-use-case', () => {
|
|||||||
const offer = await uut.syncOfferMutableData('tokenId')
|
const offer = await uut.syncOfferMutableData('tokenId')
|
||||||
assert.isObject(offer)
|
assert.isObject(offer)
|
||||||
assert.isNumber(offer.lastUpdatedTokenData)
|
assert.isNumber(offer.lastUpdatedTokenData)
|
||||||
|
|
||||||
|
assert.property(offer, 'tokenData')
|
||||||
|
assert.property(offer, 'tokenIconUrl')
|
||||||
|
assert.property(offer, 'tokenCategories')
|
||||||
|
assert.property(offer, 'tokenTags')
|
||||||
|
assert.property(offer, 'lastUpdatedTokenData')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should skip userData stringify error', async () => {
|
it('should skip userData stringify error', async () => {
|
||||||
|
|||||||
@@ -11,12 +11,12 @@ import axios from 'axios'
|
|||||||
// import User from '../../../src/adapters/localdb/models/users.js'
|
// import User from '../../../src/adapters/localdb/models/users.js'
|
||||||
|
|
||||||
// Customize these variables
|
// Customize these variables
|
||||||
const EMAIL = 'someone@somewhere.com'
|
const EMAIL = 'chris.troutner@gmail.com'
|
||||||
const NAME = 'Someone'
|
const NAME = 'Chris'
|
||||||
const PASSWORD = 'test'
|
const PASSWORD = '0mega16'
|
||||||
|
|
||||||
const ADMIN_EMAIL = 'system@system.com'
|
const ADMIN_EMAIL = 'system@system.com'
|
||||||
const ADMIN_PASSWORD = 'admin'
|
const ADMIN_PASSWORD = 'decatur'
|
||||||
|
|
||||||
async function createUser () {
|
async function createUser () {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user