Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
4838f19
Add proposal withdraw
fbsobreira Jul 14, 2021
069910c
Merge pull request #16 from fbsobreira/proposal-withdraw
fbsobreira Jul 14, 2021
19ee508
Check if hex value
fbsobreira Aug 10, 2021
1edf01a
update abi tests
fbsobreira Aug 10, 2021
5e78510
update eth lib
fbsobreira Aug 10, 2021
c8cf2a5
Merge pull request #18 from fbsobreira/uint265-hexstring
fbsobreira Aug 10, 2021
8167173
- Import Mutex locks the import to prevent two insertions from racing
wonderzack Oct 12, 2021
7639892
Merge pull request #21 from wonderzack/master
fbsobreira Oct 12, 2021
867e25f
update modules
fbsobreira Nov 2, 2021
79dee6c
remove GCO flag
fbsobreira Nov 2, 2021
58a64f4
Merge pull request #22 from fbsobreira/update-goeth
fbsobreira Nov 2, 2021
f93fd74
Adds mac file to gitignore
sibelly Oct 31, 2022
de1b197
Fixes typo
sibelly Nov 1, 2022
dbce1da
Test Get Account to fix rewards, WIP
sibelly Nov 1, 2022
358119d
Finishes fix for rewards and allowance
sibelly Nov 1, 2022
592389f
Merge pull request #40 from sibelly/KLDC-41-divergent-trx-rewards-values
fbsobreira Nov 1, 2022
c4daceb
ERC20 Approve (#28)
xana-rahmani Nov 1, 2022
3e50b8e
Update block.go (#47)
zeropool Feb 14, 2023
ed66bde
update tron protocol (#51)
fbsobreira Feb 17, 2023
874fc4b
Improve Tests & Sign Message (#52)
fbsobreira Feb 17, 2023
3e72102
Feat/add staking 2.0 operations (#63)
gustavocbritto Mar 14, 2023
5f2e53c
Update go packages (#64)
fbsobreira Mar 15, 2023
864a964
validate tron address on base58 decodeCheck (#65)
fbsobreira Mar 15, 2023
e8dde6b
Add estimate energy (#66)
fbsobreira Mar 15, 2023
bd01769
Add client UpdateSettings and UpdateEnergyLimit for contracts (#67)
fbsobreira Mar 15, 2023
df6bb68
feat: adds max delegate bandwidth and energy fields (#69)
sibelly Mar 21, 2023
8890ea8
return empty if address len = 0 (#70)
fbsobreira Mar 22, 2023
7843d2a
fix TotalFrozenBalanceV2 (#71)
gustavocbritto Mar 23, 2023
64b45a6
ability to use smart contracts with arrays of addresses (#72)
gribanoid Mar 28, 2023
8ce6eac
update bad transaction when user has no unfreeze count available (#74)
gustavocbritto Mar 29, 2023
6cd109b
feat: add GetTransactionSignWeight to client package (#76)
tiagolpires Apr 9, 2023
b7bfbf1
add totalFrozenV2 to tronPower (#79)
fsiggor Apr 18, 2023
9eed2a7
Implemented database/sql valuer in Address type (#75)
kbgod May 27, 2023
e4d32e1
Upgrade btcec to v2 (#85)
syr2bill Jul 14, 2023
faa109b
feat: add GetInputsParser method (#78)
ciricc Jul 14, 2023
0a25b92
Fix reflecting issue for TransferContract after json unmarshaling (#81)
belovbelov Jul 14, 2023
d3204bd
update tron proto (#88)
fbsobreira Jul 14, 2023
a6734d0
lockPeriod (#91)
gavlnxu Sep 6, 2023
1e82440
Chore/windows build (#100)
fbsobreira Sep 7, 2023
5f7c89c
fix(keystore): support for build without cgo (#135)
subnix Mar 28, 2025
5b98b16
add TRC20TransferFrom (#124)
wxf4150 Mar 28, 2025
2943ce8
Git workflow && Tron proto updates (#145)
fbsobreira Apr 3, 2025
96b87f5
Make Config Directory Creation Explicit (#148)
fbsobreira Apr 27, 2025
fff6a96
feat: Add address validation methods and comprehensive SDK documentat…
fbsobreira Jun 9, 2025
5422839
fix: remove duplicate error checking in UpdateAccountPermission (#161)
fbsobreira Jul 24, 2025
4ec2d93
fix: Update docs references examples && add helper functions (#164)
fbsobreira Jul 25, 2025
56139a4
fix: replace deleted tyler-smith/go-bip39 with fbsobreira/go-bip39 (#…
fbsobreira Dec 3, 2025
99c8db5
fix: normalize secp256k1 curve in SignTransactionECDSA for non-CGO bu…
fbsobreira Feb 27, 2026
96a159e
feat: add GetReceivedDelegatedResourcesV2 to query incoming delegatio…
fbsobreira Feb 27, 2026
6a940ee
chore(deps): update go-ethereum to v1.17.0 (#177)
fbsobreira Feb 27, 2026
d1f3bf6
chore: add CodeRabbit configuration (#178)
fbsobreira Feb 27, 2026
7623c72
fix(abi): support overloaded methods in GetParser and GetInputsParser…
fbsobreira Feb 27, 2026
c413949
fix: nest tools under reviews in CodeRabbit config
fbsobreira Feb 27, 2026
8fdd2fd
feat(abi): add ParseTopicsIntoMap and GetEventParser (#180)
fbsobreira Feb 27, 2026
cc4fb2f
fix(abi): support uint256[] and int arrays from JSON input (#120) (#181)
fbsobreira Feb 27, 2026
cce4c7c
fix(abi): add bytes[] support in GetPaddedParam (#131) (#182)
fbsobreira Feb 27, 2026
76324e4
ci: add GoReleaser and release workflow (#176)
fbsobreira Feb 27, 2026
577703e
test: improve SDK test coverage from 3% to 54% (#183)
fbsobreira Mar 4, 2026
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
57 changes: 57 additions & 0 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
language: en-US
early_access: true
tone_instructions: >
Be concise and direct. Focus on correctness, security, and Go idioms.
reviews:
profile: chill
request_changes_workflow: true
high_level_summary: true
sequence_diagrams: true
collapse_walkthrough: true
poem: false
review_status: true
auto_review:
enabled: true
drafts: false
base_branches:
- master
path_filters:
- "!**/*.pb.go"
- "!vendor/**"
path_instructions:
- path: "pkg/proto/**"
instructions: "Auto-generated protobuf code. Do not review for style or conventions."
- path: "cmd/**"
instructions: "CLI layer using Cobra framework. Focus on UX, flag handling, and error messages."
- path: "pkg/client/**"
instructions: >
Core gRPC client for TRON blockchain. Focus on error handling,
resource management, and API correctness.
- path: "pkg/keys/**"
instructions: >
Cryptographic key management with HD wallets (BIP39/BIP44).
Pay close attention to security: key material handling,
constant-time comparisons, and proper zeroing of sensitive data.
- path: "pkg/keystore/**"
instructions: >
Encrypted keystore implementation. Review for secure storage
practices, proper encryption, and safe key derivation.
- path: "pkg/address/**"
instructions: "TRON address encoding/decoding with Base58 checksum validation."
tools:
gitleaks:
enabled: true
actionlint:
enabled: true
yamllint:
enabled: true
checkmake:
enabled: true
chat:
auto_reply: true
knowledge_base:
learnings:
scope: local
issues:
scope: local
33 changes: 33 additions & 0 deletions .githooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
set -e

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color

COMMIT_MSG_FILE=$1
COMMIT_MSG=$(cat $COMMIT_MSG_FILE)

# Define regex patterns for commit message
CONVENTIONAL_PATTERN='^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))?: .{1,100}'
TICKET_PATTERN='(TRON-[0-9]+)'

# Check if commit message follows conventional commits pattern
if ! [[ $COMMIT_MSG =~ $CONVENTIONAL_PATTERN ]]; then
echo -e "${RED}Error:${NC} Commit message does not follow conventional commits format."
echo -e "${YELLOW}Format:${NC} type(scope): description"
echo -e "${YELLOW}Example:${NC} feat(cli): add new transaction command"
echo -e "${YELLOW}Types:${NC} feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert"
exit 1
fi

# Warn if no ticket number is found (but don't block commit)
if ! [[ $COMMIT_MSG =~ $TICKET_PATTERN ]]; then
echo -e "${YELLOW}Warning:${NC} No TRON-XXX ticket number found in commit message."
echo -e "${YELLOW}Consider:${NC} Including ticket number like TRON-123 in description or scope"
fi

echo -e "${GREEN}✓${NC} Commit message format is valid"
exit 0
34 changes: 34 additions & 0 deletions .githooks/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
set -e

HOOK_DIR=$(git rev-parse --git-path hooks)
REPO_ROOT=$(git rev-parse --show-toplevel)
HOOKS_DIR="$REPO_ROOT/.githooks"

# Make sure hooks are executable
chmod +x "$HOOKS_DIR/pre-commit"
chmod +x "$HOOKS_DIR/commit-msg"
chmod +x "$HOOKS_DIR/prepare-commit-msg"

# Create symlinks to hooks
ln -sf "$HOOKS_DIR/pre-commit" "$HOOK_DIR/pre-commit"
ln -sf "$HOOKS_DIR/commit-msg" "$HOOK_DIR/commit-msg"
ln -sf "$HOOKS_DIR/prepare-commit-msg" "$HOOK_DIR/prepare-commit-msg"

echo "✅ Git hooks installed successfully!"
echo "Pre-commit hook will run: format, lint and test on staged files"
echo "Commit-msg hook will enforce conventional commit format"
echo "Prepare-commit-msg hook will provide a commit message template"

# Check for required tools
echo "Checking required tools..."

if ! command -v goimports &> /dev/null; then
echo "⚠️ goimports not found. Please install with:"
echo " go install golang.org/x/tools/cmd/goimports@latest"
fi

if ! command -v golangci-lint &> /dev/null; then
echo "⚠️ golangci-lint not found. Please install with:"
echo " curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin"
fi
63 changes: 63 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash
set -e

echo "==> Running pre-commit checks..."

# Get staged Go files
STAGED_GO_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep '\.go$' | grep -v '\.pb\.go$' || true)

# Skip if no Go files are staged
if [ -z "$STAGED_GO_FILES" ]; then
echo "No Go files staged. Skipping pre-commit checks."
exit 0
fi

# Check for goimports
if ! command -v goimports &> /dev/null; then
echo "goimports not found! Please install with:"
echo "go install golang.org/x/tools/cmd/goimports@latest"
exit 1
fi

# Check for golangci-lint
if ! command -v golangci-lint &> /dev/null; then
echo "golangci-lint not found! Please install with:"
echo "curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin"
exit 1
fi

# Format imports
echo "Running goimports..."
make goimports

# Run go mod tidy
echo "Checking go.mod and go.sum..."
go mod tidy
if [ -n "$(git diff --name-only go.mod go.sum)" ]; then
echo "go.mod or go.sum was modified. Please stage the changes."
git diff --name-only go.mod go.sum
exit 1
fi

# Get unique packages from staged files
STAGED_PACKAGES=$(echo "$STAGED_GO_FILES" | xargs -I{} dirname {} | sort -u)

# Run linter on affected packages
echo "Running linter on staged packages..."
for pkg in $STAGED_PACKAGES; do
golangci-lint run --fast ./$pkg
done

# Run tests affected by staged files
echo "Running relevant tests..."

# Run tests only for affected packages
for pkg in $STAGED_PACKAGES; do
if [ -n "$(find $pkg -name '*_test.go' -type f | head -1)" ]; then
echo "Testing package: $pkg"
go test -race ./$pkg
fi
done

echo "✅ Pre-commit checks passed"
exit 0
38 changes: 38 additions & 0 deletions .githooks/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

COMMIT_MSG_FILE=$1
COMMIT_SOURCE=$2
SHA1=$3

# Only add template if this is not from a merge, amend, etc.
if [ -z "$COMMIT_SOURCE" ]; then
# Check if the commit message already has content (non-commented lines)
if ! grep -q '^[^#]' "$COMMIT_MSG_FILE"; then
# Get the current branch name
BRANCH_NAME=$(git symbolic-ref --short HEAD 2>/dev/null)

# Extract ticket number from branch name if it follows pattern like feature/TRON-123-description
TICKET=""
if [[ $BRANCH_NAME =~ (TRON-[0-9]+) ]]; then
TICKET=${BASH_REMATCH[1]}
fi

# Add commit message template
cat > "$COMMIT_MSG_FILE" << EOF
# Select commit type and add optional scope and description
# Format: type(scope): description
# Example: feat(cli): add new transaction feature
# Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert
#
# If applicable, include the TRON ticket number in scope or description
# Current branch: $BRANCH_NAME
EOF

# If we found a ticket number in the branch name, add it to the template
if [ -n "$TICKET" ]; then
echo "feat($TICKET): " > "$COMMIT_MSG_FILE.tmp"
cat "$COMMIT_MSG_FILE" >> "$COMMIT_MSG_FILE.tmp"
mv "$COMMIT_MSG_FILE.tmp" "$COMMIT_MSG_FILE"
fi
fi
fi
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Security Policy

## Supported Versions

The following versions of gotron-sdk are currently being supported with security updates:

| Version | Supported |
| ------- | ------------------ |
| 2.3.x | :white_check_mark: |
| 2.2.x | :white_check_mark: |
| 2.1.x | :x: |
| < 2.0 | :x: |

## Reporting a Vulnerability

We take the security of gotron-sdk seriously. If you believe you've found a security vulnerability, please follow these steps:

1. **Do not disclose the vulnerability publicly**
2. **Email us directly** at security@cryptochain.network
3. **Include the following information**:
- A description of the vulnerability
- Steps to reproduce the issue
- Potential impact of the vulnerability
- If possible, a suggested fix or mitigation

## What to expect

- We will acknowledge receipt of your vulnerability report within 3 business days
- We will provide an initial assessment of the report within 10 business days
- We will keep you informed about our progress throughout the process
- We will notify you when the issue is fixed

Thank you for helping keep gotron-sdk and its users safe!
Empty file.
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: TRON SDK Documentation
url: https://github.com/fbsobreira/gotron-sdk/wiki
about: Check if your question is answered in the documentation.
- name: TRON Network Documentation
url: https://developers.tron.network/
about: Learn more about TRON network specifications and APIs.
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Feature request
about: Suggest an idea for this project
title: '[FEATURE] '
labels: enhancement
assignees: ''
---

## Is your feature request related to a problem? Please describe.
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->

## Describe the solution you'd like
<!-- A clear and concise description of what you want to happen. -->

## Describe alternatives you've considered
<!-- A clear and concise description of any alternative solutions or features you've considered. -->

## API Design (if applicable)
<!-- If this feature involves new API methods, please describe the proposed function signatures. -->
```go
// Example API design
func NewFeature(param1 string, param2 int) (Result, error) {
// Description of what this would do
}
```

## Ticket
<!-- If there's a related ticket, please reference it here -->
TRON-

## Additional context
<!-- Add any other context or screenshots about the feature request here. -->
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Question
about: Ask a question about using this SDK
title: '[QUESTION] '
labels: question
assignees: ''
---

## Question
<!-- Ask your question clearly and provide as much context as possible -->

## Context
<!-- Describe what you're trying to accomplish and what you've tried so far -->

## Environment
- OS: [e.g. Ubuntu 22.04, macOS 13.0, Windows 11]
- Go version: [e.g. 1.20.4]
- TRON node version:
- SDK version: [e.g. v2.3.0]

## Code Example
<!-- If applicable, provide code samples related to your question -->
```go
// Your code here
```

## Additional Information
<!-- Add any other context about your question here -->
42 changes: 42 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
## Description

<!-- Please include a summary of the changes and which issue is fixed. -->
<!-- Also include relevant motivation and context. -->

Fixes # (issue)

## Type of change

<!-- Please delete options that are not relevant. -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update
- [ ] Refactoring (no functional changes, no API changes)
- [ ] Performance improvement

## Ticket

<!-- Please add the ticket number (if any) related to this PR (e.g., TRON-123) -->
TRON-

## How Has This Been Tested?

<!-- Please describe the tests that you ran to verify your changes. -->
<!-- Provide instructions so we can reproduce. -->

- [ ] Unit tests
- [ ] Integration tests
- [ ] Manual tests (please describe below)

## Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published
Loading