{"id":40065477,"url":"https://github.com/adonese/ledger","last_synced_at":"2026-01-19T07:35:11.664Z","repository":{"id":196040098,"uuid":"694027762","full_name":"adonese/ledger","owner":"adonese","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-29T06:40:38.000Z","size":3844,"stargazers_count":3,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-24T14:51:43.753Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adonese.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-20T07:28:43.000Z","updated_at":"2024-08-29T06:40:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"230efffa-1dd9-4321-a8a5-eee09c64ce25","html_url":"https://github.com/adonese/ledger","commit_stats":null,"previous_names":["adonese/ledger"],"tags_count":82,"template":false,"template_full_name":null,"purl":"pkg:github/adonese/ledger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adonese%2Fledger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adonese%2Fledger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adonese%2Fledger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adonese%2Fledger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adonese","download_url":"https://codeload.github.com/adonese/ledger/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adonese%2Fledger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28562995,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T03:31:16.861Z","status":"ssl_error","status_checked_at":"2026-01-19T03:31:15.069Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-19T07:35:10.951Z","updated_at":"2026-01-19T07:35:11.659Z","avatar_url":"https://github.com/adonese.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# API Documentation for Ledger Package\n\n## Overview\n\nThe `ledger` package is designed to manage user balances and transactions within a ledger system. It uses AWS DynamoDB for storage and integrates with AWS SES for email notifications.\n\n## Use the package\n\nYou can import the package directly, `go get github.com/adonese/ledger@latest`\n\n## Authentication\n\nTo use the API, authenticate with AWS by initializing a DynamoDB client using `InitializeLedger`.\n\n### InitializeLedger\n\n```go\nfunc InitializeLedger(accessKey, secretKey, region string) (*dynamodb.Client, error)\n```\n\n**Parameters:**\n- `accessKey`: AWS access key.\n- `secretKey`: AWS secret key.\n- `region`: AWS region.\n\n**Returns:**\n- `*dynamodb.Client`: A client for interacting with AWS DynamoDB.\n- `error`: Error message, if any.\n\n## User Balance\n\n### CheckUsersExist\n\n```go\nfunc CheckUsersExist(dbSvc *dynamodb.Client, accountIds []string) ([]string, error)\n```\n\n**Purpose:** Checks if users exist in the DynamoDB table.\n\n**Parameters:**\n- `dbSvc`: DynamoDB client.\n- `accountIds`: List of user account IDs.\n\n**Returns:**\n- `[]string`: List of account IDs that do not exist.\n- `error`: Error message if the operation fails.\n\n### CreateAccountWithBalance\n\n```go\nfunc CreateAccountWithBalance(dbSvc *dynamodb.Client, accountId string, amount float64) error\n```\n\n**Purpose:** Creates a new account with an initial balance.\n\n**Parameters:**\n- `dbSvc`: DynamoDB client.\n- `accountId`: The unique identifier for the account.\n- `amount`: Initial amount to be set for the account.\n\n**Returns:**\n- `error`: Error message if the operation fails.\n\n### InquireBalance\n\n```go\nfunc InquireBalance(dbSvc *dynamodb.Client, AccountID string) (float64, error)\n```\n\n**Purpose:** Inquires about the balance of a user's account.\n\n**Parameters:**\n- `dbSvc`: DynamoDB client.\n- `AccountID`: The unique identifier for the account.\n\n**Returns:**\n- `float64`: The current balance of the account.\n- `error`: Error message if the operation fails.\n\n## Transactions\n\n### TransferCredits\n\n```go\nfunc TransferCredits(dbSvc *dynamodb.Client, fromAccountID, toAccountID string, amount float64) error\n```\n\n**Purpose:** Transfers credits from one account to another.\n\n**Parameters:**\n- `dbSvc`: DynamoDB client.\n- `fromAccountID`: The account ID to debit.\n- `toAccountID`: The account ID to credit.\n- `amount`: The amount to be transferred.\n\n**Returns:**\n- `error`: Error message if the operation fails.\n\n### GetTransactions\n\n```go\nfunc GetTransactions(dbSvc *dynamodb.Client, accountID string, limit int32, lastTransactionID string) ([]LedgerEntry, string, error)\n```\n\n**Purpose:** Retrieves a list of transactions for an account.\n\n**Parameters:**\n- `dbSvc`: DynamoDB client.\n- `accountID`: The account ID.\n- `limit`: Maximum number of transactions to retrieve.\n- `lastTransactionID`: ID of the last transaction retrieved (for pagination).\n\n**Returns:**\n- `[]LedgerEntry`: List of ledger entries.\n- `string`: The ID of the last transaction retrieved.\n- `error`: Error message if the operation fails.\n\n## Notifications\n\n### HandleDynamoDBStream\n\n```go\nfunc HandleDynamoDBStream(ctx context.Context, event events.DynamoDBEvent) error\n```\n\n**Purpose:** Handles DynamoDB stream events to send email notifications.\n\n**Parameters:**\n- `ctx`: Context.\n- `event`: DynamoDB event.\n\n**Returns:**\n- `error`: Error message if the operation fails.\n\n### SendEmail\n\n```go\nfunc SendEmail(sesSvc *ses.Client, msg Message) error\n```\n\n**Purpose:** Sends an email notification.\n\n**Parameters:**\n- `sesSvc`: AWS SES client.\n- `msg`: Message containing email details.\n\n**Returns:**\n- `error`: Error message if the operation fails.\n\n### SendSMS\n\n```go\nfunc SendSMS(sms SMS) error\n```\n\n**Purpose:** Sends an SMS notification.\n\n**Parameters:**\n- `sms`: SMS structure containing the details for the SMS message.\n\n**Returns:**\n- `error`: Error message if the operation fails.\n\n## Roadmap for Planned Features\n\n**Short-term Goals:**\n1. Refine the current DynamoDB schema to improve performance for high transaction volumes.\n2. Implement a caching layer to reduce read latency for frequently accessed data.\n3. Develop a more robust error handling and logging mechanism for easier debugging and maintenance.\n\n**Mid-term Goals:**\n1. Integrate\n\n with additional AWS services for analytics and real-time monitoring of transactions.\n2. Support multi-currency transactions and automatic currency conversion based on real-time exchange rates.\n3. Provide a user interface for account management and transaction history.\n\n**Long-term Goals:**\n1. Expand the ledger system to support blockchain technologies for increased security and transparency.\n2. Establish a plugin system allowing third-party extensions and integrations.\n3. Implement AI-driven fraud detection and prevention systems.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadonese%2Fledger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadonese%2Fledger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadonese%2Fledger/lists"}