mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-20 11:45:50 +00:00
chore(sample-docs): unify error handling with panic(err).
This commit is contained in:
@@ -31,24 +31,20 @@ func main() {
|
||||
// Create and fund the NFT minter wallet
|
||||
nftMinter, err := wallet.New(crypto.ED25519())
|
||||
if err != nil {
|
||||
fmt.Println("Error creating NFT minter wallet:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if err := client.FundWallet(&nftMinter); err != nil {
|
||||
fmt.Println("Error funding NFT minter wallet:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println("NFT minter wallet funded!")
|
||||
|
||||
// Create and fund the NFT buyer wallet
|
||||
nftBuyer, err := wallet.New(crypto.ED25519())
|
||||
if err != nil {
|
||||
fmt.Println("Error creating NFT buyer wallet:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if err := client.FundWallet(&nftBuyer); err != nil {
|
||||
fmt.Println("Error funding NFT buyer wallet:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println("NFT buyer wallet funded!")
|
||||
fmt.Println()
|
||||
@@ -73,8 +69,7 @@ func main() {
|
||||
Wallet: &nftMinter,
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println("Error minting NFT:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if !responseMint.Validated {
|
||||
fmt.Println("NFTokenMint txn is not in a validated ledger", responseMint)
|
||||
@@ -117,8 +112,7 @@ func main() {
|
||||
Wallet: &nftBuyer,
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println("Error accepting NFT offer:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if !response.Validated {
|
||||
fmt.Println("NFTokenAcceptOffer txn is not in a validated ledger", response)
|
||||
|
||||
@@ -23,8 +23,7 @@ func main() {
|
||||
defer client.Disconnect()
|
||||
|
||||
if err := client.Connect(); err != nil {
|
||||
fmt.Println("Error connecting to devnet:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if !client.IsConnected() {
|
||||
@@ -40,24 +39,20 @@ func main() {
|
||||
// Create and fund the NFT minter wallet
|
||||
nftMinter, err := wallet.New(crypto.ED25519())
|
||||
if err != nil {
|
||||
fmt.Println("Error creating NFT minter wallet:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if err := client.FundWallet(&nftMinter); err != nil {
|
||||
fmt.Println("Error funding NFT minter wallet:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println("NFT minter wallet funded!")
|
||||
|
||||
// Create and fund the NFT buyer wallet
|
||||
nftBuyer, err := wallet.New(crypto.ED25519())
|
||||
if err != nil {
|
||||
fmt.Println("Error creating NFT buyer wallet:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if err := client.FundWallet(&nftBuyer); err != nil {
|
||||
fmt.Println("Error funding NFT buyer wallet:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println("NFT buyer wallet funded!")
|
||||
fmt.Println()
|
||||
@@ -81,8 +76,7 @@ func main() {
|
||||
Wallet: &nftMinter,
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println("Error minting NFT:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if !responseMint.Validated {
|
||||
fmt.Println("NFTokenMint transaction is not in a validated ledger:", responseMint)
|
||||
@@ -122,8 +116,7 @@ func main() {
|
||||
Wallet: &nftBuyer,
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println("Error accepting NFT offer:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if !response.Validated {
|
||||
fmt.Println("NFTokenAcceptOffer transaction is not in a validated ledger:", response)
|
||||
|
||||
@@ -31,12 +31,10 @@ func main() {
|
||||
// Create and fund the NFT minter wallet
|
||||
nftMinter, err := wallet.New(crypto.ED25519())
|
||||
if err != nil {
|
||||
fmt.Println("Error creating NFT minter wallet:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if err := client.FundWallet(&nftMinter); err != nil {
|
||||
fmt.Println("Error funding NFT minter wallet:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println("NFT minter wallet funded!")
|
||||
fmt.Println()
|
||||
@@ -59,8 +57,7 @@ func main() {
|
||||
Wallet: &nftMinter,
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println("Error minting NFT:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if !responseMint.Validated {
|
||||
fmt.Println("NFTokenMint txn is not in a validated ledger", responseMint)
|
||||
@@ -103,8 +100,7 @@ func main() {
|
||||
Wallet: &nftMinter,
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println("Error burning NFT:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if !responseBurn.Validated {
|
||||
fmt.Println("NFTokenBurn transactiob is not in a validated ledger", responseBurn)
|
||||
|
||||
@@ -23,8 +23,7 @@ func main() {
|
||||
defer client.Disconnect()
|
||||
|
||||
if err := client.Connect(); err != nil {
|
||||
fmt.Println("Error connecting to devnet:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if !client.IsConnected() {
|
||||
@@ -40,12 +39,10 @@ func main() {
|
||||
// Create and fund the NFT minter wallet
|
||||
nftMinter, err := wallet.New(crypto.ED25519())
|
||||
if err != nil {
|
||||
fmt.Println("Error creating NFT minter wallet:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if err := client.FundWallet(&nftMinter); err != nil {
|
||||
fmt.Println("Error funding NFT minter wallet:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println("NFT minter wallet funded!")
|
||||
fmt.Println()
|
||||
@@ -68,8 +65,7 @@ func main() {
|
||||
Wallet: &nftMinter,
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println("Error minting NFT:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if !responseMint.Validated {
|
||||
fmt.Println("NFTokenMint txn is not in a validated ledger", responseMint)
|
||||
@@ -112,8 +108,7 @@ func main() {
|
||||
Wallet: &nftMinter,
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println("Error burning NFT:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if !responseBurn.Validated {
|
||||
fmt.Println("NFTokenBurn transactiob is not in a validated ledger", responseBurn)
|
||||
|
||||
@@ -31,12 +31,10 @@ func main() {
|
||||
// Create and fund the NFT minter wallet
|
||||
nftMinter, err := wallet.New(crypto.ED25519())
|
||||
if err != nil {
|
||||
fmt.Println("Error creating NFT minter wallet:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if err := client.FundWallet(&nftMinter); err != nil {
|
||||
fmt.Println("Error funding NFT minter wallet:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println("NFT minter wallet funded!")
|
||||
|
||||
@@ -58,8 +56,7 @@ func main() {
|
||||
Wallet: &nftMinter,
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println("Error minting first NFT:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if !responseMint.Validated {
|
||||
fmt.Println("First NFTokenMint transaction is not in a validated ledger", responseMint)
|
||||
@@ -105,8 +102,7 @@ func main() {
|
||||
Wallet: &nftMinter,
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println("Error minting second NFT:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if !responseMint.Validated {
|
||||
fmt.Println("Second NFTokenMint transaction is not in a validated ledger", responseMint)
|
||||
@@ -152,8 +148,7 @@ func main() {
|
||||
Wallet: &nftMinter,
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println("Error canceling NFT offers:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if !response.Validated {
|
||||
fmt.Println("NFTokenCancelOffer transaction is not in a validated ledger", response)
|
||||
|
||||
@@ -23,8 +23,7 @@ func main() {
|
||||
defer client.Disconnect()
|
||||
|
||||
if err := client.Connect(); err != nil {
|
||||
fmt.Println("Error connecting to devnet:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if !client.IsConnected() {
|
||||
@@ -40,12 +39,10 @@ func main() {
|
||||
// Create and fund the NFT minter wallet
|
||||
nftMinter, err := wallet.New(crypto.ED25519())
|
||||
if err != nil {
|
||||
fmt.Println("Error creating NFT minter wallet:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if err := client.FundWallet(&nftMinter); err != nil {
|
||||
fmt.Println("Error funding NFT minter wallet:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println("NFT minter wallet funded!")
|
||||
|
||||
@@ -67,8 +64,7 @@ func main() {
|
||||
Wallet: &nftMinter,
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println("Error minting first NFT:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if !responseMint.Validated {
|
||||
fmt.Println("First NFTokenMint transaction is not in a validated ledger", responseMint)
|
||||
@@ -114,8 +110,7 @@ func main() {
|
||||
Wallet: &nftMinter,
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println("Error minting second NFT:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if !responseMint.Validated {
|
||||
fmt.Println("Second NFTokenMint transaction is not in a validated ledger", responseMint)
|
||||
@@ -161,8 +156,7 @@ func main() {
|
||||
Wallet: &nftMinter,
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println("Error canceling NFT offers:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if !response.Validated {
|
||||
fmt.Println("NFTokenCancelOffer transaction is not in a validated ledger", response)
|
||||
|
||||
@@ -29,12 +29,10 @@ func main() {
|
||||
// Create and fund the nft wallet
|
||||
nftWallet, err := wallet.New(crypto.ED25519())
|
||||
if err != nil {
|
||||
fmt.Println("Error creating nft wallet:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if err := client.FundWallet(&nftWallet); err != nil {
|
||||
fmt.Println("Error funding nft wallet:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println("NFT wallet funded: ", nftWallet.ClassicAddress)
|
||||
fmt.Println()
|
||||
@@ -56,8 +54,7 @@ func main() {
|
||||
Wallet: &nftWallet,
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println("Error minting NFT:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if !responseMint.Validated {
|
||||
fmt.Println("NFTokenMint txn is not in a validated ledger", responseMint)
|
||||
@@ -96,8 +93,7 @@ func main() {
|
||||
Wallet: &nftWallet,
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println("Error modifying NFT:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if !responseModify.Validated {
|
||||
fmt.Println("NFTokenModify txn is not in a validated ledger", responseModify)
|
||||
|
||||
@@ -23,8 +23,7 @@ func main() {
|
||||
defer client.Disconnect()
|
||||
|
||||
if err := client.Connect(); err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if !client.IsConnected() {
|
||||
@@ -39,12 +38,10 @@ func main() {
|
||||
fmt.Println("Funding wallet...")
|
||||
nftWallet, err := wallet.New(crypto.ED25519())
|
||||
if err != nil {
|
||||
fmt.Println("Error creating nft wallet:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if err := client.FundWallet(&nftWallet); err != nil {
|
||||
fmt.Println("Error funding nft wallet:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println("NFT wallet funded!")
|
||||
fmt.Println()
|
||||
@@ -66,8 +63,7 @@ func main() {
|
||||
Wallet: &nftWallet,
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println("Error minting NFT:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if !responseMint.Validated {
|
||||
fmt.Println("NFTokenMint txn is not in a validated ledger", responseMint)
|
||||
@@ -106,8 +102,7 @@ func main() {
|
||||
Wallet: &nftWallet,
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println("Error modifying NFT:", err)
|
||||
return
|
||||
panic(err)
|
||||
}
|
||||
if !responseModify.Validated {
|
||||
fmt.Println("NFTokenModify txn is not in a validated ledger", responseModify)
|
||||
|
||||
Reference in New Issue
Block a user