@nina-protocol/nina-db 0.0.107 → 0.0.109

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -54,7 +54,7 @@ export default class Release extends Model {
54
54
  archived: { type: 'boolean' },
55
55
  },
56
56
  };
57
- static findOrCreate = async (publicKey, hubPublicKey = null, programId = process.env.NINA_PROGRAM_V2_ID) => {
57
+ static findOrCreate = async (publicKey, hubPublicKey = null, programId = process.env.NINA_PROGRAM_V2_ID, isLazy = false) => {
58
58
  try {
59
59
  console.log('Release.findOrCreate', publicKey, programId);
60
60
  let release = await Release.query().findOne({ publicKey });
@@ -114,6 +114,7 @@ export default class Release extends Model {
114
114
  publisherId: publisher.id,
115
115
  releaseAccount,
116
116
  programId,
117
+ solanaAddress: isLazy ? null : publicKey,
117
118
  });
118
119
  if (hubPublicKey) {
119
120
  const hub = await Hub.query().findOne({ publicKey: hubPublicKey });
@@ -132,7 +133,7 @@ export default class Release extends Model {
132
133
  return null;
133
134
  }
134
135
  };
135
- static createRelease = async ({ publicKey, mint, metadata, datetime, publisherId, releaseAccount, programId }) => {
136
+ static createRelease = async ({ publicKey, mint, metadata, datetime, publisherId, releaseAccount, programId, solanaAddress }) => {
136
137
  const slug = await this.generateSlug(metadata);
137
138
  const price = releaseAccount.account?.price?.toNumber() ||
138
139
  releaseAccount?.price?.toNumber() ||
@@ -150,6 +151,7 @@ export default class Release extends Model {
150
151
  paymentMint,
151
152
  archived: false,
152
153
  programId,
154
+ solanaAddress,
153
155
  });
154
156
  if (metadata.properties.tags) {
155
157
  for await (let tag of metadata.properties.tags) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nina-protocol/nina-db",
3
- "version": "0.0.107",
3
+ "version": "0.0.109",
4
4
  "description": "",
5
5
  "source": "src/index.js",
6
6
  "main": "dist/index.js",
@@ -58,7 +58,7 @@ export default class Release extends Model {
58
58
  },
59
59
  }
60
60
 
61
- static findOrCreate = async (publicKey, hubPublicKey=null, programId=process.env.NINA_PROGRAM_V2_ID) => {
61
+ static findOrCreate = async (publicKey, hubPublicKey=null, programId=process.env.NINA_PROGRAM_V2_ID, isLazy=false) => {
62
62
  try {
63
63
  console.log('Release.findOrCreate', publicKey, programId)
64
64
  let release = await Release.query().findOne({ publicKey });
@@ -140,6 +140,7 @@ export default class Release extends Model {
140
140
  publisherId: publisher.id,
141
141
  releaseAccount,
142
142
  programId,
143
+ solanaAddress: isLazy ? null : publicKey,
143
144
  });
144
145
 
145
146
  if (hubPublicKey) {
@@ -160,7 +161,7 @@ export default class Release extends Model {
160
161
  }
161
162
  };
162
163
 
163
- static createRelease = async ({publicKey, mint, metadata, datetime, publisherId, releaseAccount, programId}) => {
164
+ static createRelease = async ({publicKey, mint, metadata, datetime, publisherId, releaseAccount, programId, solanaAddress}) => {
164
165
  const slug = await this.generateSlug(metadata);
165
166
  const price =
166
167
  releaseAccount.account?.price?.toNumber() ||
@@ -180,6 +181,7 @@ export default class Release extends Model {
180
181
  paymentMint,
181
182
  archived: false,
182
183
  programId,
184
+ solanaAddress,
183
185
  })
184
186
  if (metadata.properties.tags) {
185
187
  for await (let tag of metadata.properties.tags) {