Skip to content

Commit 6d3de8c

Browse files
cursoragentnazreen
andcommitted
example(oft-solana): validate updates before rent transfer
Co-authored-by: nazreen.mohamad <nazreen.mohamad@layerzerolabs.org>
1 parent fc50ddf commit 6d3de8c

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

examples/oft-solana/tasks/solana/updateMetadata.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,11 @@ async function updateTokenExtensionsMetadata({
235235
throw new Error(`Mint account not found: ${mintStr}`)
236236
}
237237

238+
const hasFieldUpdates = Boolean(name || symbol || uri)
239+
if (!hasFieldUpdates) {
240+
throw new Error('At least one of --name, --symbol, or --uri must be provided')
241+
}
242+
238243
// Build instructions for each field that needs updating
239244
const instructions = []
240245

@@ -309,10 +314,6 @@ async function updateTokenExtensionsMetadata({
309314
)
310315
}
311316

312-
if (instructions.length === 0) {
313-
throw new Error('At least one of --name, --symbol, or --uri must be provided')
314-
}
315-
316317
const { blockhash } = await connection.getLatestBlockhash()
317318

318319
const message = new TransactionMessage({

0 commit comments

Comments
 (0)