Skip to content
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

feat(webhook): add webhook #2538

Merged
merged 38 commits into from
May 9, 2024
Merged
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
6074411
add models and endpoint, lacking logic
shampoobera Apr 29, 2024
31aab47
just stuff
shampoobera Apr 29, 2024
b5e989a
just stuff
shampoobera Apr 29, 2024
715a453
made general db interface
shampoobera Apr 29, 2024
e2a6214
cleanup
shampoobera Apr 29, 2024
cd41cbc
trying to test
shampoobera Apr 29, 2024
444428b
trying to test
shampoobera Apr 29, 2024
18c0d51
trying ot fix test
shampoobera Apr 29, 2024
799f646
remove interface{} from gorm models, start tests, rework db interface
shampoobera Apr 29, 2024
c22d3c9
add signature
shampoobera Apr 30, 2024
6e0d109
secret
shampoobera Apr 30, 2024
9af0630
look away for now
shampoobera Apr 30, 2024
b5a29e1
finish db test
shampoobera Apr 30, 2024
496d67a
finish tests
golangisfun123 Apr 30, 2024
df7ffc6
add auth
golangisfun123 Apr 30, 2024
0b7b3e9
remove debugging log
golangisfun123 Apr 30, 2024
8b8297a
comments and nits
golangisfun123 Apr 30, 2024
f8a833b
lint
golangisfun123 Apr 30, 2024
d4ac8d6
appsecret and appid
golangisfun123 May 1, 2024
01f8b57
resolve comments
golangisfun123 May 1, 2024
7f81c14
swagger, lint
golangisfun123 May 1, 2024
1c55e8b
feat(synapse-interface): maintenance aggregator using PAUSED_CHAINS (…
bigboydiamonds Apr 30, 2024
a5a3120
Publish
bigboydiamonds Apr 30, 2024
a7e239e
Exempt gh pages (#2541)
trajan0x May 1, 2024
7d2117a
Deploy: `FastBridge` to Scroll (#2525)
ChiTimesChi May 1, 2024
4c7538c
Publish
ChiTimesChi May 1, 2024
6fec3a5
fix: update `forge-std` to 1.8.1, remove `ds-test`, use `solhint` for…
ChiTimesChi May 1, 2024
200eb8b
Publish
ChiTimesChi May 1, 2024
5dc99e4
chore: remove submodules from `contracts-rfq` (#2547)
ChiTimesChi May 1, 2024
1a3000a
Publish
ChiTimesChi May 1, 2024
b40e602
gogenerate
golangisfun123 May 1, 2024
f241759
Revert "gogenerate"
golangisfun123 May 1, 2024
d9e99a0
im dumb
golangisfun123 May 1, 2024
d7963fa
generate
golangisfun123 May 1, 2024
652b099
tidy
golangisfun123 May 1, 2024
d390ea0
update swagger doc
golangisfun123 May 1, 2024
8c215e4
[goreleaser]
trajan0x May 1, 2024
498a067
[goreleaser]
golangisfun123 May 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove debugging log
golangisfun123 committed Apr 30, 2024
commit 0b7b3e9551d936d8f18044bf6336fd4f87e3105c
2 changes: 1 addition & 1 deletion contrib/screener-api/screener/screener.go
Original file line number Diff line number Diff line change
@@ -79,7 +79,7 @@

screener.db, err = sql.Connect(ctx, dbType, cfg.Database.DSN, metricHandler)
if err != nil {
return nil, fmt.Errorf("could not connect to rules db: %w", err)

Check warning on line 82 in contrib/screener-api/screener/screener.go

Codecov / codecov/patch

contrib/screener-api/screener/screener.go#L82

Added line #L82 was not covered by tests
trajan0x marked this conversation as resolved.
Show resolved Hide resolved
golangisfun123 marked this conversation as resolved.
Show resolved Hide resolved
}

screener.router = ginhelper.New(logger)
@@ -128,9 +128,9 @@

// Grab the body of the JSON request and unmarshal it into the blacklistBody struct.
if err := c.ShouldBindBodyWith(&blacklistBody, binding.JSON); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
}

Check warning on line 133 in contrib/screener-api/screener/screener.go

Codecov / codecov/patch

contrib/screener-api/screener/screener.go#L131-L133

Added lines #L131 - L133 were not covered by tests

blacklistedAddress := db.BlacklistedAddress{
TypeReq: blacklistBody.TypeReq,
@@ -145,34 +145,34 @@
switch blacklistBody.TypeReq {
case "create":
if err := s.db.PutBlacklistedAddress(c, blacklistedAddress); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}

Check warning on line 150 in contrib/screener-api/screener/screener.go

Codecov / codecov/patch

contrib/screener-api/screener/screener.go#L148-L150

Added lines #L148 - L150 were not covered by tests

c.JSON(http.StatusOK, gin.H{"status": "success"})
return

case "update":
if err := s.db.UpdateBlacklistedAddress(c, blacklistedAddress.Id, blacklistedAddress); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}

Check warning on line 159 in contrib/screener-api/screener/screener.go

Codecov / codecov/patch

contrib/screener-api/screener/screener.go#L157-L159

Added lines #L157 - L159 were not covered by tests

c.JSON(http.StatusOK, gin.H{"status": "success"})
return

case "delete":
if err := s.db.DeleteBlacklistedAddress(c, blacklistedAddress.Address); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}

Check warning on line 168 in contrib/screener-api/screener/screener.go

Codecov / codecov/patch

contrib/screener-api/screener/screener.go#L166-L168

Added lines #L166 - L168 were not covered by tests

c.JSON(http.StatusOK, gin.H{"status": "success"})
return

default:
c.JSON(http.StatusBadRequest, gin.H{"error": "invalid type"})
return

Check warning on line 175 in contrib/screener-api/screener/screener.go

Codecov / codecov/patch

contrib/screener-api/screener/screener.go#L173-L175

Added lines #L173 - L175 were not covered by tests
}

}
@@ -184,29 +184,29 @@
var blacklistBody client.BlackListBody

if err := c.ShouldBindBodyWith(&blacklistBody, binding.JSON); err != nil {
c.JSON(http.StatusBadGateway, gin.H{"error": err.Error()})
c.Abort()
return
}

Check warning on line 190 in contrib/screener-api/screener/screener.go

Codecov / codecov/patch

contrib/screener-api/screener/screener.go#L187-L190

Added lines #L187 - L190 were not covered by tests

nonce := c.GetHeader("nonce")
timestamp := c.GetHeader("timestamp")
appid := c.GetHeader("appid")
queryString := c.GetHeader("queryString")
if nonce == "" || timestamp == "" || appid == "" {
c.JSON(http.StatusConflict, gin.H{"error": "missing headers"})
c.Abort()
return
}

Check warning on line 200 in contrib/screener-api/screener/screener.go

Codecov / codecov/patch

contrib/screener-api/screener/screener.go#L197-L200

Added lines #L197 - L200 were not covered by tests

// reconstruct signature
expected := client.GenerateSignature("appsecret", appid, timestamp, nonce, queryString, blacklistBody)

if c.GetHeader("Signature") != expected {
c.JSON(http.StatusUnauthorized, gin.H{"error": "unauthorized your mom"})
c.JSON(http.StatusUnauthorized, gin.H{"error": "unauthorized"})
c.Abort()
return
}

Check warning on line 209 in contrib/screener-api/screener/screener.go

Codecov / codecov/patch

contrib/screener-api/screener/screener.go#L206-L209

Added lines #L206 - L209 were not covered by tests
c.Next()
}
}
@@ -225,7 +225,7 @@
connection := baseServer.Server{}
err := connection.ListenAndServe(ctx, fmt.Sprintf(":%d", s.cfg.Port), s.router)
if err != nil {
return fmt.Errorf("could not start server: %w", err)

Check warning on line 228 in contrib/screener-api/screener/screener.go

Codecov / codecov/patch

contrib/screener-api/screener/screener.go#L228

Added line #L228 was not covered by tests
golangisfun123 marked this conversation as resolved.
Show resolved Hide resolved
}
return nil
}
Loading