forked from Merkeleon/php-cryptocurrency-address-validation
-
Notifications
You must be signed in to change notification settings - Fork 0
Sync fork with upstream Merkeleon/php-cryptocurrency-address-validation #5
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
Open
yoav-ebp
wants to merge
54
commits into
master
Choose a base branch
from
sync-upstream-20260109
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
75a27b3
Update README.md
mehrshaddarzi be678ec
contracts
LiquidCats 604540e
enum
LiquidCats 413410b
utils
LiquidCats ef557da
exceptions
LiquidCats 03e3f23
config
LiquidCats 0e7f468
clean up
LiquidCats 136309e
clean up
LiquidCats fd3e2c9
validation drivers
LiquidCats d14f22c
driver config
LiquidCats 53fb5b9
validator
LiquidCats 4d09228
provider
LiquidCats c1391f9
extend requirements
LiquidCats 453207d
adjust config
LiquidCats 03dab50
provide tests
LiquidCats 0b59cc8
fix after testing
LiquidCats cb0b916
update read me
LiquidCats 42289f4
remove unused
LiquidCats 44a56b9
Merge pull request #25 from mehrshaddarzi/patch-1
androzd d904002
fix configs
LiquidCats 6d092e9
fix configs
LiquidCats c4e4255
make not strict driver
LiquidCats 827b8d1
tests
LiquidCats 5e5af51
remove unused
LiquidCats 8e3aad0
Merge branch 'master' into improve-codebase-using-some-internal-stuff
LiquidCats 6675c95
Merge pull request #26 from LiquidCats/improve-codebase-using-some-in…
androzd 7e21106
add new driver
LiquidCats 5b2054a
aad testnet
LiquidCats 1d87ebb
code style
LiquidCats b2c1bb6
Merge pull request #27 from LiquidCats/add-cbor-driver
androzd 14265b4
update cbor to make compatible with laravel 10
LiquidCats 2bbf327
Merge pull request #28 from LiquidCats/fix-add-cbor-driver
androzd 1f2df04
lower case addresses
LiquidCats 58007f3
make validation softer for BCH
LiquidCats 3aa9112
test coverage
LiquidCats 7e6fde1
Merge pull request #29 from LiquidCats/soften-validation-for-btc-bch
androzd 06b1c07
fix
LiquidCats 40bdd30
Merge pull request #30 from LiquidCats/fix-btc
androzd 234ba12
fix typo
LiquidCats 6007822
Merge pull request #31 from LiquidCats/fix-typo
androzd 7b2df60
add GH action with tests
LiquidCats c4b41f4
remove composer validation
LiquidCats 097cca2
add php version
LiquidCats c020cc9
Merge pull request #32 from LiquidCats/actions
androzd 928b049
feature: long p-address support
ilyashabanov-cp af4c1cc
Merge pull request #1 from LiquidCats/feature/bch-long-p-addresses-su…
LiquidCats 4f54897
Merge pull request #33 from LiquidCats/master
androzd 25e3538
feature(validators): add bech32m support
LiquidCats a014b76
Merge pull request #35 from LiquidCats/feature/add-bech32m-addresses-…
androzd 280ae94
Fix LTC testnet address validation
romikring bf85d0d
Merge pull request #36 from romikring/ltc-patch
androzd ebf2a27
fix: driver config construction from cache
fa4e7fa
Merge pull request #37 from alexeyvy/master
androzd 7bbe0fe
Merge upstream changes from Merkeleon/php-cryptocurrency-address-vali…
humancopyright File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: Unit Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "master" ] | ||
| pull_request: | ||
| branches: [ "master" ] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| build: | ||
|
|
||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v3 | ||
|
|
||
| - uses: shivammathur/setup-php@master | ||
| with: | ||
| php-version: '8.2' | ||
|
|
||
| - name: Cache Composer packages | ||
| id: composer-cache | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: vendor | ||
| key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-php- | ||
|
|
||
| - name: Install dependencies | ||
| run: composer install --prefer-dist --no-progress | ||
|
|
||
| - name: Run test suite | ||
| run: composer test | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,13 +3,19 @@ | |
| Easy to use PHP Bitcoin and Litecoin address validator. | ||
| One day I will add other crypto currencies. Or how about you? :) | ||
|
|
||
| ## Usage | ||
| ## Installation | ||
|
|
||
| ======= | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: Leftover git merge conflict marker Prompt for AI agents |
||
| ``` | ||
| composer require merkeleon/php-cryptocurrency-address-validation | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| ```php | ||
| use Merkeleon\PhpCryptocurrencyAddressValidation\Validation; | ||
| use Merkeleon\PhpCryptocurrencyAddressValidation\Enums\CurrencyEnum;use Merkeleon\PhpCryptocurrencyAddressValidation\Validator; | ||
|
|
||
| $validator = Validation::make('BTC'); | ||
| var_dump($validator->validate('1QLbGuc3WGKKKpLs4pBp9H6jiQ2MgPkXRp')); | ||
| $validator = Validator::make(CurrencyEnum::BITCOIN); | ||
| var_dump($validator->isValid('1QLbGuc3WGKKKpLs4pBp9H6jiQ2MgPkXRp')); | ||
|
|
||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| use Merkeleon\PhpCryptocurrencyAddressValidation\DriverConfig; | ||
| use Merkeleon\PhpCryptocurrencyAddressValidation\Drivers; | ||
| use Merkeleon\PhpCryptocurrencyAddressValidation\Enums\CurrencyEnum; | ||
|
|
||
| return [ | ||
| CurrencyEnum::BEACON->value => [ | ||
| new DriverConfig( | ||
| Drivers\Bech32Driver::class, | ||
| ['bnb' => null], | ||
| ['tbnb' => null] | ||
| ), | ||
| ], | ||
| CurrencyEnum::BITCOIN_CASH->value => [ | ||
| new DriverConfig( | ||
| Drivers\Base32Driver::class, | ||
| ['bitcoincash:' => null], | ||
| ['bchtest:' => null, 'bchreg:' => null,] | ||
| ), | ||
| new DriverConfig( | ||
| Drivers\DefaultBase58Driver::class, | ||
| ['1' => '00', '3' => '05'], | ||
| ['2' => 'C4', 'm' => '6F'] | ||
| ), | ||
| ], | ||
| CurrencyEnum::BITCOIN->value => [ | ||
| new DriverConfig( | ||
| Drivers\DefaultBase58Driver::class, | ||
| ['1' => '00', '3' => '05'], | ||
| ['2' => 'C4', 'm' => '6F'] | ||
| ), | ||
| new DriverConfig( | ||
| Drivers\Bech32Driver::class, | ||
| ['bc' => null], | ||
| ['tb' => null, 'bcrt' => null] | ||
| ), | ||
| ], | ||
| CurrencyEnum::CARDANO->value => [ | ||
| new DriverConfig( | ||
| Drivers\CardanoDriver::class, | ||
| ['addr' => null], | ||
| ['addr_test' => null], | ||
| ), | ||
| new DriverConfig( | ||
| Drivers\CborDriver::class, | ||
| ['A' => 33, 'D' => 66], | ||
| ['2' => 40, '3' => 73], | ||
| ) | ||
| ], | ||
| CurrencyEnum::DASHCOIN->value => [ | ||
| new DriverConfig( | ||
| Drivers\DefaultBase58Driver::class, | ||
| ['X' => '4C', '7' => '10'], | ||
| ['y' => '8C', '8' => '13'] | ||
| ), | ||
| ], | ||
| CurrencyEnum::DOGECOIN->value => [ | ||
| new DriverConfig( | ||
| Drivers\DefaultBase58Driver::class, | ||
| ['D' => '1E', '9' => '16', 'A' => '16'], | ||
| ['n' => '71', 'm' => '6F', '2' => 'C4',], | ||
| ), | ||
| ], | ||
| CurrencyEnum::EOS->value => [ | ||
| new DriverConfig(Drivers\EosDriver::class), | ||
| ], | ||
| CurrencyEnum::ETHEREUM->value => [ | ||
| new DriverConfig(Drivers\KeccakStrictDriver::class), | ||
| ], | ||
| CurrencyEnum::LITECOIN->value => [ | ||
| new DriverConfig( | ||
| Drivers\DefaultBase58Driver::class, | ||
| ['L' => '30', 'M' => '32', '3' => '05'], | ||
| ['m' => '6F', 'n' => '6F', '2' => 'C4', 'Q' => '3A'] | ||
| ), | ||
| new DriverConfig( | ||
| Drivers\Bech32Driver::class, | ||
| ['ltc' => null], | ||
| ['tltc' => null, 'rltc' => null] | ||
| ) | ||
| ], | ||
| CurrencyEnum::RIPPLE->value => [ | ||
| new DriverConfig( | ||
| Drivers\XrpBase58Driver::class, | ||
| ['r' => '00'] | ||
| ), | ||
| new DriverConfig( | ||
| Drivers\XrpXAddressDriver::class, | ||
| ['X' => null], | ||
| ['T' => null], | ||
| ), | ||
| ], | ||
| CurrencyEnum::TRON->value => [ | ||
| new DriverConfig( | ||
| Drivers\DefaultBase58Driver::class, | ||
| ['T' => '41'], | ||
| ), | ||
| ], | ||
| CurrencyEnum::ZCASH->value => [ | ||
| new DriverConfig( | ||
| Drivers\DefaultBase58Driver::class, | ||
| ['t' => '1C'], | ||
| ), | ||
| ], | ||
| ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Merkeleon\PhpCryptocurrencyAddressValidation; | ||
|
|
||
| use Illuminate\Support\ServiceProvider; | ||
|
|
||
| class AddressValidationServiceProvider extends ServiceProvider | ||
| { | ||
| public function boot(): void | ||
| { | ||
| $this->publishes([ | ||
| __DIR__.'/../config/address_validation.php' => config_path('address_validation.php'), | ||
| ]); | ||
| } | ||
| } |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: Using
@masterbranch reference is a security risk. Pin to a specific version tag (e.g.,@v2) or commit SHA to ensure reproducible and secure builds. The master branch can change at any time, potentially breaking builds or introducing vulnerabilities.Prompt for AI agents