Skip to content

Commit

Permalink
Merge pull request #62 from CheesecakeLabs/soroban-transactions
Browse files Browse the repository at this point in the history
Soroban Transactions Backend Routes
  • Loading branch information
lucasmagnus authored Dec 19, 2023
2 parents 86140e9 + 8391065 commit f7d7496
Show file tree
Hide file tree
Showing 70 changed files with 2,034 additions and 360 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.DS_Store
*.png
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion backend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ PG_USER=
PG_PASSWORD=
PG_DB_NAME=

# Deploy Stage
DEPLOY_STAGE=local

# Kafka
KAFKA_CLIENT_GROUP_ID=
KAFKA_CLIENT_BROKERS=
Expand All @@ -14,9 +17,13 @@ KAFKA_ENVELOPE_PRODUCER_TOPIC=
KAFKA_ENVELOPE_CONSUMER_TOPICS=
KAFKA_HORIZON_PRODUCER_TOPIC=
KAFKA_HORIZON_CONSUMER_TOPICS=
KAFKA_SUBMIT_TRANSACTION_PRODUCER_TOPIC=
KAFKA_SIGN_SOROBAN_TRANSACTION_CONSUMER_TOPICS=
KAFKA_SIGN_SOROBAN_TRANSACTION_PRODUCER_TOPIC=

KAFKA_SCHEMA_REGISTRY_URL=

# Log
# Log
LOG_LEVEL=debug

# HTTP
Expand All @@ -29,6 +36,9 @@ JWT_SECRET_KEY=secret
## Production environment
GIN_MODE=developer #release

AWS_BUCKET_NAME=
AWS_REGION=

## Horizon Config
HORIZON_PUBLIC_API_SERVER=https://horizon-testnet.stellar.org
HORIZON_TEST_API_SERVER=https://horizon-testnet.stellar.org
Expand Down
2 changes: 1 addition & 1 deletion backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ starlabs
# vendor/

# Go workspace file
go.work
go.work
19 changes: 19 additions & 0 deletions backend/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ type (
JWT JWT
Horizon Horizon
Log Log
AWS AWS
Deploy Deploy
}

Log struct {
Expand All @@ -35,6 +37,14 @@ type (
ConsumerTopics []string `env:"KAFKA_HORIZON_CONSUMER_TOPICS"`
ProducerTopic string `env:"KAFKA_HORIZON_PRODUCER_TOPIC"`
}
SubmitTransactionCfg struct {
ConsumerTopics []string `env:"KAFKA_ENVELOPE_CONSUMER_TOPICS"`
ProducerTopic string `env:"KAFKA_SUBMIT_TRANSACTION_PRODUCER_TOPIC"`
}
SignTransactionCfg struct {
ConsumerTopics []string `env:"KAFKA_SIGN_SOROBAN_TRANSACTION_CONSUMER_TOPICS"`
ProducerTopic string `env:"KAFKA_SIGN_SOROBAN_TRANSACTION_PRODUCER_TOPIC"`
}
}

PGConfig struct {
Expand All @@ -54,6 +64,11 @@ type (
SecretKey string `env-required:"true" env:"JWT_SECRET_KEY"`
}

AWS struct {
BucketName string `env-required:"true" env:"AWS_BUCKET_NAME"`
AwsRegion string `env:"AWS_REGION"`
}

Horizon struct {
PublicAPIServer string `env:"HORIZON_PUBLIC_API_SERVER"`
TestAPIServer string `env:"HORIZON_TEST_API_SERVER"`
Expand Down Expand Up @@ -92,6 +107,10 @@ type (
IDPhotoHash string `env:"PRINCIPALS_ID_PHOTO_HASH"`
VerificationPhotoHash string `env:"PRINCIPALS_VERIFICATION_PHOTO_HASH"`
}

Deploy struct {
DeployStage string `env:"DEPLOY_STAGE"`
}
)

// NewConfig returns app config.
Expand Down
168 changes: 164 additions & 4 deletions backend/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,7 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/entity.Asset"
}
"$ref": "#/definitions/v1.PaginatedAssetsResponse"
}
},
"500": {
Expand Down Expand Up @@ -1492,6 +1489,98 @@ const docTemplate = `{
}
}
},
"/soroban-transactions/sign": {
"post": {
"description": "Signed a XDR transaction",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Soroban"
],
"summary": "Signed Transaction",
"parameters": [
{
"description": "Signed a XDR transaction",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1.SignedTransactionRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/v1.response"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/v1.response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/v1.response"
}
}
}
}
},
"/soroban-transactions/submit": {
"post": {
"description": "Submit a XDR transaction",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Soroban"
],
"summary": "Submit Transaction",
"parameters": [
{
"description": "Submit a XDR transaction",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1.SubmitTransactionRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/v1.response"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/v1.response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/v1.response"
}
}
}
}
},
"/user/create": {
"post": {
"description": "Create user",
Expand Down Expand Up @@ -2177,6 +2266,35 @@ const docTemplate = `{
}
}
}
},
"/wallets/sponsor_pk/": {
"get": {
"description": "Get Sponsor Public Key",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Wallets"
],
"summary": "Get Sponsor Public Key",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/v1.response"
}
}
}
}
}
},
"definitions": {
Expand Down Expand Up @@ -3034,6 +3152,20 @@ const docTemplate = `{
}
}
},
"v1.PaginatedAssetsResponse": {
"type": "object",
"properties": {
"assets": {
"type": "array",
"items": {
"$ref": "#/definitions/entity.Asset"
}
},
"totalPages": {
"type": "integer"
}
}
},
"v1.RolePermissionRequest": {
"type": "object",
"properties": {
Expand All @@ -3051,6 +3183,34 @@ const docTemplate = `{
}
}
},
"v1.SignedTransactionRequest": {
"type": "object",
"required": [
"envelope"
],
"properties": {
"envelope": {
"type": "string",
"example": "KJDSKD..."
},
"wallet_pk": {
"type": "string",
"example": "GDSKJG..."
}
}
},
"v1.SubmitTransactionRequest": {
"type": "object",
"required": [
"envelope"
],
"properties": {
"envelope": {
"type": "string",
"example": "KJDSKD..."
}
}
},
"v1.TransferAssetRequest": {
"type": "object",
"required": [
Expand Down
Loading

0 comments on commit f7d7496

Please sign in to comment.