Compare commits

...
25 Commits
Author SHA1 Message Date
Chris Troutner ac83827fca Merge branch 'master' into fullstack 2025-12-04 15:29:13 +00:00
Chris Troutner 0811024030 Merge pull request #123 from Permissionless-Software-Foundation/dh-token-data
feat(offer): Added tokenData to offer model
2025-12-04 08:08:45 -07:00
Daniel Gonzalez 737d35463d feat(offer): Added tokenData to offer model 2025-12-03 19:21:40 -04:00
Chris Troutner 2ed1eaba9c Merge branch 'master' into fullstack 2025-11-26 14:16:56 +00:00
Chris Troutner 9681def3e0 Merge branch 'master' into fullstack 2025-11-14 19:24:38 +00:00
Chris Troutner 42f228af0e Merge branch 'master' into fullstack 2025-11-05 18:50:34 +00:00
Chris Troutner 4ac7f59378 Merge branch 'master' into fullstack 2025-10-25 18:30:01 +00:00
Chris Troutner 725c1c39a5 Merge branch 'master' into fullstack 2025-10-09 15:09:25 +00:00
Chris Troutner 7290c8db30 Merge branch 'master' into fullstack 2025-08-10 18:11:09 +00:00
Chris Troutner 36e1ec1f8e Merge branch 'master' into fullstack 2025-07-28 18:19:52 +00:00
Chris Troutner baa574a93e Merge branch 'master' into fullstack 2025-07-08 23:56:41 +00:00
Chris Troutner 8333563d98 Merge branch 'master' into fullstack 2025-07-06 21:44:33 +00:00
Chris Troutner 99fd116b6d Merge branch 'master' into fullstack 2025-06-27 16:28:28 +00:00
Chris Troutner ccae89ad01 Merge branch 'master' into fullstack 2025-06-06 18:53:44 +00:00
Chris Troutner 0ecae58be2 Merge branch 'master' into fullstack 2025-06-02 01:52:27 +00:00
Chris Troutner 5f442835e5 Customizing scrips 2025-05-20 19:38:16 +00:00
Chris Troutner aa8fd89227 Merge branch 'master' into fullstack 2025-05-19 22:45:42 +00:00
Chris Troutner 3da7432273 Building UI from psfoundation branch 2025-05-16 17:10:43 +00:00
Chris Troutner 61c1dd5878 Merge branch 'master' into fullstack 2025-05-16 14:56:09 +00:00
Chris Troutner c095e7af39 noop 2025-05-16 14:55:57 +00:00
Chris Troutner fb9612bb65 Using ct-unstable branch 2025-05-16 02:22:19 +00:00
Chris Troutner e4a37b1c10 Merge branch 'ct-unstable' into fullstack 2025-05-16 00:58:49 +00:00
Chris Troutner ba4f847e57 Merge branch 'master' into fullstack 2025-05-16 00:39:57 +00:00
Chris Troutner 81e623e35f Merge branch 'ct-unstable' into fullstack 2025-03-09 01:10:05 +00:00
Chris Troutner db1da9172c Using fullstack branch of UI 2024-12-29 09:37:28 -08:00
7 changed files with 56 additions and 8 deletions
+1 -1
View File
@@ -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
+11
View File
@@ -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
}
+1
View File
@@ -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
+2
View File
@@ -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') {
+34 -3
View File
@@ -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 () => {
+4 -4
View File
@@ -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 {