Ver código fonte

adjust to guides

tonyboylehub 1 ano atrás
pai
commit
37052b7158

+ 13 - 34
src/pages/core/guides/javascript/how-to-create-a-core-nft-asset.md

@@ -117,9 +117,8 @@ const signer = generateSigner(umi)
 
 // You will need to us fs and navigate the filesystem to
 // load the wallet you wish to use via relative pathing.
-const walletFile = const imageFile = fs.readFileSync(
-    path.join(__dirname, './keypair.json')
-  )
+const walletFile = fs.readFileSync('./keypair.json')
+  
 
 // Convert your walletFile onto a keypair.
 let keypair = umi.eddsa.createKeypairFromSecretKey(new Uint8Array(walletFile));
@@ -143,9 +142,7 @@ This example is using a local script/node.js approach using Irys to upload to Ar
 ```ts
 // use `fs` to read file via a string path.
 
-const imageFile = fs.readFileSync(
-  path.join(__dirname, '..', '/assets/my-image.jpg')
-)
+const imageFile = fs.readFileSync('./assets/my-image.jpg')
 
 // Use `createGenericFile` to transform the file into a `GenericFile` type
 // that umi can understand. Make sure you set the mimi tag type correctly
@@ -225,7 +222,7 @@ const metadataUri = await umi.uploader.uploadJson(metadata).catch((err) => {
 })
 ```
 
-Now if all has gone to play we should have the URI of JSON file stored in the `metadataUri` providing it did not throw any errors.
+Now if all has gone to plan we should have the URI of JSON file stored in the `metadataUri` providing it did not throw any errors.
 
 ### Minting the NFT Core Asset
 
@@ -239,34 +236,18 @@ const tx = await create(umi, {
   name: 'My NFT',
   uri: metadataUri,
 }).sendAndConfirm(umi)
-
-//
-// ** Logging out Details**
-//
-
-// Log out the signature and the links to the transaction and the NFT.
-console.log('\nNFT Created')
-console.log('View Transaction on SolanaFM')
-console.log(`https://solana.fm/tx/${signature}?cluster=devnet-alpha`)
-console.log('\n')
-console.log('View NFT on Metaplex Explorer')
-console.log(
-  `https://core.metaplex.com/explorer/${nftSigner.publicKey}?env=devnet`
-)
 ```
 
 ### Loggin Out The Details
 
 ```ts
-// Log out the signature and the links to the transaction and the NFT and our work.
-console.log('\nNFT Created')
-console.log('View Transaction on SolanaFM')
-console.log(`https://solana.fm/tx/${signature}?cluster=devnet-alpha`)
-console.log('\n')
-console.log('View NFT on Metaplex Explorer')
-console.log(
-  `https://core.metaplex.com/explorer/${nftSigner.publicKey}?env=devnet`
-)
+  // Log out the signature and the links to the transaction and the NFT.
+  console.log('\nNFT Created')
+  console.log('View Transaction on Solana Explorer')
+  console.log(`https://explorer.solana.com/tx/${signature}?cluster=devnet`)
+  console.log('\n')
+  console.log('View NFT on Metaplex Explorer')
+  console.log(`https://core.metaplex.com/explorer/${nftSigner.publicKey}?env=devnet`)
 ```
 
 ## Full Code Example
@@ -317,7 +298,7 @@ const createNft = async () => {
   // You will need to understand the concept of pathing from a computing perspective.
 
   const imageFile = fs.readFileSync(
-    path.join(__dirname, '../assets/images/0.png')
+    path.join('./assets/images/0.png')
   )
 
   // Use `createGenericFile` to transform the file into a `GenericFile` type
@@ -399,9 +380,7 @@ const createNft = async () => {
   console.log(`https://explorer.solana.com/tx/${signature}?cluster=devnet`)
   console.log('\n')
   console.log('View NFT on Metaplex Explorer')
-  console.log(
-    `https://core.metaplex.com/explorer/${nftSigner.publicKey}?env=devnet`
-  )
+  console.log(`https://core.metaplex.com/explorer/${nftSigner.publicKey}?env=devnet`)
 }
 
 createNft()

+ 5 - 9
src/pages/guides/javascript/how-to-create-an-spl-token-on-solana.md

@@ -122,9 +122,7 @@ const umi = createUmi('https://api.devnet.solana.com')
 
 // You will need to us fs and navigate the filesystem to
 // load the wallet you wish to use via relative pathing.
-const walletFile = const imageFile = fs.readFileSync(
-    path.join(__dirname, './keypair.json')
-  )
+const walletFile = const imageFile = fs.readFileSync('./keypair.json')
 
 // Convert your walletFile onto a keypair.
 let keypair = umi.eddsa.createKeypairFromSecretKey(new Uint8Array(walletFile));
@@ -149,15 +147,13 @@ This example is using a local script/node.js approach using Irys to upload to Ar
 ```ts
 // use `fs` to read file via a string path.
 
-const imageFile = fs.readFileSync(
-  path.join(__dirname, '..', '/assets/islandDao.jpg')
-)
+const imageFile = fs.readFileSync('./image.jpg')
 
 // Use `createGenericFile` to transform the file into a `GenericFile` type
 // that Umi can understand. Make sure you set the mimi tag type correctly
 // otherwise Arweave will not know how to display your image.
 
-const umiImageFile = createGenericFile(imageFile, 'island-dao.jpeg', {
+const umiImageFile = createGenericFile(imageFile, 'image.jpeg', {
   tags: [{ name: 'contentType', value: 'image/jpeg' }],
 })
 
@@ -350,13 +346,13 @@ const createAndMintTokens = async () => {
 
   // use `fs` to read file via a string path.
   
-  const imageFile = fs.readFileSync(path.join(__dirname, "../assets/images/1.png"));
+  const imageFile = fs.readFileSync("./image.jpg");
 
   // Use `createGenericFile` to transform the file into a `GenericFile` type
   // that umi can understand. Make sure you set the mimi tag type correctly
   // otherwise Arweave will not know how to display your image.
 
-  const umiImageFile = createGenericFile(imageFile, "1.png", {
+  const umiImageFile = createGenericFile(imageFile, "image.png", {
     tags: [{ name: "Content-Type", value: "image/png" }],
   });
 

+ 1 - 3
src/pages/guides/javascript/how-to-transfer-sol-on-solana.md

@@ -102,9 +102,7 @@ const umi = createUmi('https://api.devnet.solana.com')
 
 // You will need to us fs and navigate the filesystem to
 // load the wallet you wish to use via relative pathing.
-const walletFile = const imageFile = fs.readFileSync(
-    path.join(__dirname, './keypair.json')
-  )
+const walletFile = const imageFile = fs.readFileSync('./keypair.json')
 
 // Convert your walletFile onto a keypair.
 let keypair = umi.eddsa.createKeypairFromSecretKey(new Uint8Array(walletFile));

+ 1 - 1
src/pages/guides/javascript/how-to-transfer-spl-tokens-on-solana.md

@@ -64,7 +64,7 @@ const transferSplTokens = async () => {
   const umi = createUmi('https://api.devnet.solana.com').use(mplToolbox())
 
   // import a wallet that has the SPL Token you want to transfer
-  const walletFile = fs.readFileSync(path.join(__dirname, './keypair.json'))
+  const walletFile = fs.readFileSync('./keypair.json')
 
   // Convert your walletFile onto a keypair.
   let keypair = umi.eddsa.createKeypairFromSecretKey(new Uint8Array(walletFile))