-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updating handlers to handle new wallet format #22
base: cleanup
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code seems generally fine, could use some more comments.
I don't understand how this fits into the larger system, maybe some info in the PR description could help.
@@ -21,7 +21,7 @@ func handleLatestTransactions(c *fiber.Ctx) error { | |||
|
|||
// Get the latest 10 transactions | |||
var transactions []types.WalletTransactions | |||
result := db.Order("date desc").Limit(10).Find(&transactions) | |||
result := db.Order("date desc").Limit(-1).Find(&transactions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does Limit(-1) do here? Also should update the comment @Maphikza
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I have recently moved back to relay code and this is no longer necessary as we are no longer setting limits.
This is how it looks now.
var transactions []types.WalletTransactions
result := db.Order("date desc").Find(&transactions)
"github.com/spf13/viper" | ||
) | ||
|
||
const envFile = ".env" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to use the config.json for this since we already store a private key there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kind 411 is also being worked on right now and already looks different. You can reject this part for now as I am working on it with Cypher.
const envFile = ".env" | ||
const nostrPrivateKeyVar = "NOSTR_PRIVATE_KEY" | ||
|
||
type RelayInfo struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should reuse the NIP11RelayInfo struct in websocket/types.go
And maybe that's not the right place for the struct if it gets used all over the app. We are using it in the dht code as well.
Let's put that refactor in a different PR, tho. No need to complicate this right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noted.
DHTkey string `json:"dhtkey,omitempty"` | ||
} | ||
|
||
func createKind411Event(privateKey *secp256k1.PrivateKey, publicKey *secp256k1.PublicKey, store stores.Store) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably have a place where we describe all non-standard kinds we support but can we have a comment in this file somewhere describing what this kind411 is and why we are overwriting old versions of them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.
return privateKey, publicKey, nil | ||
} | ||
|
||
func generateEd25519Keypair(privateKeyHex string) (ed25519.PrivateKey, ed25519.PublicKey, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may have been obsoleted by the client making the key now. Just guessing, tho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will look into it as well. If it is not necessary I will remove it.
@@ -104,6 +112,37 @@ func main() { | |||
queryCache := viper.GetStringMapString("query_cache") | |||
store.InitStore(queryCache) | |||
|
|||
// generate server priv key if it does not exist | |||
err := generateAndSaveNostrPrivateKey() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a function generateKey() in host.go, probably should reuse that if possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grandmaster stuff. Colby knew the code is due for refactoring but we hadn't had time for it yet. These are all good points. I will probably push small changes from tomorrow afternoon to make the next review quicker.
No description provided.