Skip to content

Commit 7103fc7

Browse files
authored
Merge pull request #1 from madmatvey/fix-with-api-keys
Release v1.0.0 tested and working with API keys
2 parents 22d5288 + 33b90c5 commit 7103fc7

24 files changed

Lines changed: 1581 additions & 184 deletions

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ jobs:
2323
with:
2424
ruby-version: ${{ matrix.ruby }}
2525
bundler-cache: true
26-
- name: Run the default task
26+
- name: Run rake
2727
run: bundle exec rake

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
/pkg/
77
/spec/reports/
88
/tmp/
9+
/examples/test_with_real_data.rb
10+
/examples/test_with_real_data_prod.rb
11+
/examples/test_keccac.rb
912

1013
# rspec failure tracking
1114
.rspec_status

.rubocop.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ AllCops:
55
Exclude:
66
- 'vendor/**/*'
77
- 'bin/**/*'
8+
- 'examples/**/*'
89

910
require:
1011
- rubocop-rake
@@ -28,10 +29,13 @@ Metrics/BlockLength:
2829
- 'examples/**/*'
2930

3031
Metrics/MethodLength:
31-
Max: 15
32+
Max: 17
3233
Exclude:
3334
- 'spec/**/*'
3435

36+
Metrics/ClassLength:
37+
Max: 200
38+
3539
Metrics/CyclomaticComplexity:
3640
Max: 10
3741
Exclude:
@@ -46,10 +50,10 @@ Style/Documentation:
4650

4751
# RSpec rules
4852
RSpec/ExampleLength:
49-
Max: 30
53+
Max: 50
5054

5155
RSpec/MultipleExpectations:
52-
Max: 5
56+
Max: 15
5357

5458
# String literal rules
5559
Style/StringLiterals:

CHANGELOG.md

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,60 @@
1-
## [Unreleased]
1+
# Changelog
22

3-
## [0.1.0] - 2025-05-26
3+
All notable changes to this project will be documented in this file.
44

5-
- Initial release
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [1.0.0] - 2025-06-08
9+
10+
### Added
11+
- **TronEIP712Signer Module**: Complete EIP-712 signature implementation for TRON GasFree transfers
12+
- Full EIP-712 structured data signing according to TIP-712 specifications
13+
- Support for both TRON Mainnet and Testnet (Nile) networks
14+
- Built-in Keccak256 cryptographic hashing implementation
15+
- Base58 encoding/decoding utilities for TRON addresses
16+
- Flexible data key handling (camelCase, snake_case conversion)
17+
- Pre-configured domain constants for GasFree contracts
18+
- Comprehensive test coverage with RSpec
19+
20+
- **Core GasFree SDK functionality**
21+
- API client for GasFree.io with support for different endpoints (mainnet, testnet, custom)
22+
- Support for tokens, providers, and transfer operations
23+
- Comprehensive error handling and validation
24+
- Ethereum and TRON address support
25+
- RSpec test suite with comprehensive coverage
26+
- Dry-rb validation and type checking
27+
28+
### Features
29+
- `GasfreeSdk::TronEIP712Signer.sign_typed_data_testnet()` - Sign for TRON Testnet
30+
- `GasfreeSdk::TronEIP712Signer.sign_typed_data_mainnet()` - Sign for TRON Mainnet
31+
- `GasfreeSdk::TronEIP712Signer.sign_typed_data()` - Generic signing with custom domains
32+
- `GasfreeSdk::Crypto::Keccak256` - Pure Ruby Keccak256 implementation
33+
- `GasfreeSdk::Base58` - TRON address encoding/decoding utilities
34+
- Token, Provider, and Transfer management APIs
35+
- Service Providers API with proper data mapping from camelCase to snake_case
36+
- Improved URL path handling for API requests
37+
38+
### Dependencies
39+
- Added `rbsecp256k1` (~> 6.0) for secp256k1 cryptographic operations
40+
41+
### Examples
42+
- `examples/simple_usage_example.rb` - Basic TronEIP712Signer usage demonstration
43+
- `examples/test_tron_signer.rb` - Comprehensive module testing script
44+
- Updated `examples/test_with_real_data_prod.rb` to use the new module
45+
46+
### Documentation
47+
- Updated README.md with comprehensive TronEIP712Signer documentation
48+
- Added usage examples and API reference
49+
- Documented all cryptographic operations and utilities
50+
- Improved documentation for Service Providers with detailed configuration constraints
51+
52+
### Fixed
53+
- Fixed Service Providers API data mapping from camelCase to snake_case
54+
- Added proper transformation for provider configuration fields (maxPendingTransfer -> max_pending_transfer, etc.)
55+
- Updated tests to use correct API response format for providers
56+
57+
### Enhanced
58+
- Comprehensive test coverage for provider field mapping
59+
- RSpec testing framework integration
60+
- Improved error handling and validation throughout the SDK

Gemfile.lock

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
PATH
22
remote: .
33
specs:
4-
gasfree_sdk (0.1.0)
4+
gasfree_sdk (1.0.0)
55
dry-configurable (~> 1.1)
66
dry-struct (~> 1.6)
77
dry-types (~> 1.7)
88
dry-validation (~> 1.10)
99
eth (~> 0.5)
1010
faraday (~> 2.9)
1111
faraday-retry (~> 2.2)
12+
rbsecp256k1 (~> 6.0)
1213

1314
GEM
1415
remote: https://rubygems.org/

LICENSE.txt

Lines changed: 119 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,119 @@
1-
The MIT License (MIT)
2-
3-
Copyright (c) 2025 madmatvey
4-
5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
11-
12-
The above copyright notice and this permission notice shall be included in
13-
all copies or substantial portions of the Software.
14-
15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21-
THE SOFTWARE.
1+
GNU LESSER GENERAL PUBLIC LICENSE
2+
Version 3, 29 June 2007
3+
4+
Copyright (C) 2025 Eugene Leontev (madmatvey)
5+
Project: gasfree_sdk (https://github.com/madmatvey/gasfree_sdk)
6+
7+
Everyone is permitted to copy and distribute verbatim copies
8+
of this license document, but changing it is not allowed.
9+
10+
This version of the GNU Lesser General Public License incorporates
11+
the terms and conditions of version 3 of the GNU General Public License,
12+
supplemented by the additional permissions listed below.
13+
14+
0. Additional Definitions.
15+
16+
As used herein, "this License" refers to version 3 of the GNU Lesser General Public License,
17+
and the "GNU GPL" refers to version 3 of the GNU General Public License.
18+
19+
"The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.
20+
21+
An "Application" is any work that makes use of an interface provided by the Library,
22+
but which is not otherwise based on the Library.
23+
Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.
24+
25+
A "Combined Work" is a work produced by combining or linking an Application with the Library.
26+
The particular version of the Library with which the Combined Work was made is also called the "Linked Version".
27+
28+
The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work,
29+
excluding any source code for portions of the Combined Work that are based on the Application,
30+
and not on the Linked Version.
31+
32+
The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application,
33+
including any data and utility programs needed for reproducing the Combined Work from the Application,
34+
but excluding the System Libraries of the Combined Work.
35+
36+
1. Exception to Section 3 of the GNU GPL.
37+
38+
You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.
39+
40+
2. Conveying Modified Versions.
41+
42+
If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked),
43+
then you may convey a copy of the modified version:
44+
45+
a) under this License, provided that you make a good faith effort to ensure that,
46+
in the event an Application does not supply the function or data,
47+
the facility still operates, and performs whatever part of its purpose remains meaningful, or
48+
49+
b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.
50+
51+
3. Object Code Incorporating Material from Library Header Files.
52+
53+
The object code form of an Application may incorporate material from a header file that is part of the Library.
54+
You may convey such object code under terms of your choice, provided that,
55+
if the incorporated material is not limited to numerical parameters, data structure layouts and accessors,
56+
or small macros, inline functions and templates (ten or fewer lines in length),
57+
you do both of the following:
58+
59+
a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.
60+
61+
b) Accompany the object code with a copy of the GNU GPL and this license document.
62+
63+
4. Combined Works.
64+
65+
You may convey a Combined Work under terms of your choice that, taken together,
66+
effectively do not restrict modification of the portions of the Library contained in the Combined Work
67+
and reverse engineering for debugging such modifications,
68+
if you also do each of the following:
69+
70+
a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.
71+
72+
b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
73+
74+
c) For a Combined Work that displays copyright notices during execution,
75+
include the copyright notice for the Library among these notices,
76+
as well as a reference directing the user to the copies of the GNU GPL and this license document.
77+
78+
d) Do one of the following:
79+
80+
0) Convey the Minimal Corresponding Source under the terms of this License,
81+
and the Corresponding Application Code in a form suitable for,
82+
and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work,
83+
in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
84+
85+
1) Use a suitable shared library mechanism for linking with the Library.
86+
A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system,
87+
and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
88+
89+
e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL,
90+
and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version.
91+
(If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code.
92+
If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)
93+
94+
5. Combined Libraries.
95+
96+
You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities not covered by this License,
97+
and distribute such a combined library,
98+
provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted,
99+
and provided that you do these two things:
100+
101+
a) Accompany the combined library with a copy of the same work based on the Library,
102+
uncombined with any other library facilities, conveyed under the terms of this License.
103+
104+
b) Give prominent notice with the combined library that part of it is a work based on the Library,
105+
and explaining where to find the accompanying uncombined form of the same work.
106+
107+
6. Revised Versions of the GNU Lesser General Public License.
108+
109+
The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time.
110+
Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
111+
112+
Each version is given a distinguishing version number.
113+
If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it,
114+
you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation.
115+
If the Library as you received it does not specify a version number of the GNU Lesser General Public License,
116+
you may choose any version ever published by the Free Software Foundation.
117+
118+
If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply,
119+
that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.

0 commit comments

Comments
 (0)