Skip to content

Commit 2da03ba

Browse files
authored
Merge pull request #85 from Peersyst/feat/pre-release-upgrades
[TA-3754][TA-3801][TA-3800][TA-3798]: v1 pre-release package
2 parents 0f06264 + 8b877fe commit 2da03ba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+750
-627
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gomod"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
open-pull-requests-limit: 10

.github/pull_request_template.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
# Title
22

3-
This PR aims to <insert description>.
3+
## Description
4+
This PR aims to <insert description>. (Mark tags that apply)
5+
6+
## Type of change
7+
- [ ] Bug fix
8+
- [ ] New feature
9+
- [ ] Breaking change
10+
- [ ] Documentation update
11+
- [ ] Refactoring
12+
13+
## Checklist:
14+
- [ ] My code follows the style guidelines of this project
15+
- [ ] I have performed a self-review of my own code
16+
- [ ] I have commented my code where needed
17+
- [ ] I have made corresponding changes to the documentation
18+
- [ ] My changes generate no new warnings
19+
- [ ] I have added tests that prove my fix is effective
20+
- [ ] New and existing unit tests pass locally with my changes
421

522
## Changes
623

CHANGELOG.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
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+
## [v1.0.0]
9+
10+
### Added
11+
12+
#### binary-codec
13+
14+
- Updated `definitions`.
15+
- New `DecodeLedgerData` function.
16+
- `Quality` encoding/decoding functions.
17+
- New `XChainBridge` and `Issue` types.
18+
19+
#### address-codec
20+
21+
- Address validation with `IsValidAddress`, `IsValidClassicAddress` and `IsValidXAddress`.
22+
- Address conversion with `XAddressToClassicAddress` and `ClassicAddressToXAddress`.
23+
- X-Address encoding/decoding with `EncodeXAddress` and `DecodeXAddress`.
24+
25+
#### keypairs
26+
27+
- New `DeriveNodeAddress` function.
28+
29+
#### xrpl
30+
31+
- New `AccountRoot`, `Amendments`, `Bridge`, `DID`, `DirectoryNode`, `Oracle`, `RippleState`, `XChainOwnedClaimID`, `XChainOwnedCreateAccountClaimID` ledger entry types.
32+
- New `Multisign` utility function.
33+
- New `NftHistory`, `NftsByIssuer`, `LedgerData`, `Check`, `BookOffers`, `PathFind`, `FeatureOne`, `FeatureAll` queries.
34+
- New `SubmitMultisigned` request.
35+
- New `AMMBid`, `AMMCreate`, `AMMDelete`, `AMMDeposit`, `AMMVote`, `AMMWithdraw` amm transactions.
36+
- New `CheckCancel`, `CheckCash`, `CheckCreate` check transactions.
37+
- New `DepositPreauth` transaction.
38+
- New `DIDSet` and `DIDDelete` transactions.
39+
- New `EscrowCreate`, `EscrowFinish`, `EscrowCancel` escrow transactions.
40+
- New `OracleSet` and `OracleDelete` oracle transactions.
41+
- New `XChainAccountCreateCommitment`, `XChainAddAccountCreateAttestation`, `XChainAddClaimAttestation`, `XChainClaim`, `XChainCommit`, `XChainCreateBridge`, `XChainCreateClaimID` and `XChainModifyBridge` cross-chain transactions.
42+
- New `Multisign` wallet method.
43+
- Ripple time conversion utility functions.
44+
- Added query methods for websocket and rpc clients.
45+
- New `SubmitMultisigned`, `AutofillMultisigned` and `SubmitAndWait` methods for both clients.
46+
- Added `Autofill` method for rpc client.
47+
- New `MaxRetries` and `RetryDelay` config options for both clients.
48+
49+
#### Other
50+
51+
- Implemented `secp256k1` algorithm.
52+
53+
### Changed
54+
55+
#### binary-codec
56+
57+
- Exported `FieldInstance` type.
58+
- Updated `NewBinaryParser` constructor to accept `definitions.Definitions` as a parameter.
59+
- Updated `NewSerializer` to `NewBinarySerializer` constructor.
60+
- Refactored `FieldIDCodec` to be a struct with `Encode` and `Decode` methods.
61+
- `FromJson` methods to `FromJSON`.
62+
- `ToJson` methods to `ToJSON`.
63+
64+
#### address-codec
65+
66+
No changes were made.
67+
68+
#### keypairs
69+
70+
- Decoupled `ed25519` and `secp256k1` algorithms from `keypairs` package.
71+
- Decoupled `der` parsing from `keypairs` package.
72+
73+
#### xrpl
74+
75+
- Renamed `CurrencyStringToHex` to `ConvertStringToHex` and `CurrencyHexToString` to `ConvertHexToString`.
76+
- Renamed `HashSignedTx` to `TxBlob`.
77+
- Wallet API methods have been renamed for better usability.
78+
- Renamed `SendRequest` to `Request` methods for websocket and rpc clients.
79+
80+
### Fixed
81+
82+
#### xrpl
83+
84+
- Some queries did not have proper fields. All queries have been updated with the fields that are required by the XRP Ledger.
85+
- Some transaction types did not have proper fields. All transaction types have been updated with the fields that are required by the XRP Ledger.

CODEOWNERS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @Peersyst/xrpl-go

CONTRIBUTING.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Contributing to xrpl-go
2+
3+
## How to Contribute
4+
5+
You can contribute to the project by:
6+
7+
- Reporting bugs
8+
- Suggesting enhancements
9+
- Implementing features
10+
- Writing documentation
11+
- Writing tests
12+
13+
### Reporting Bugs
14+
15+
1. Check existing issues to ensure the bug hasn't already been reported.
16+
2. Use the bug report template when opening a new issue.
17+
3. Include:
18+
- A clear, descriptive title
19+
- Steps to reproduce the issue
20+
- Expected vs. actual behavior
21+
- Environment details (OS, version, etc.)
22+
- Any relevant screenshots or error logs
23+
24+
### Suggesting Enhancements
25+
26+
1. Check existing enhancement issues to avoid duplicates.
27+
2. Use the enhancement proposal template.
28+
3. Provide:
29+
- Detailed description of the proposed feature
30+
- Potential implementation approaches
31+
- Potential benefits and use cases
32+
33+
### Making Pull Requests
34+
35+
#### Setup
36+
37+
1. Fork the repository
38+
2. Clone your fork locally
39+
3. Create a new branch for your contribution
40+
4. Make your changes and commit them
41+
5. Push your changes to your fork
42+
6. Open a pull request from your fork to the main repository
43+
44+
#### Development Guidelines
45+
46+
1. Follow the project's coding style and conventions
47+
2. Write clear, concise commit messages
48+
3. Include tests for new features or bug fixes
49+
4. Update documentation as needed
50+
5. Ensure all tests pass before submitting
51+
52+
#### Pull Request Process
53+
54+
1. Push your changes to your fork
55+
2. Open a pull request with:
56+
- Clear title describing the change
57+
- Detailed description of modifications
58+
- Reference any related issues
59+
3. Await code review from maintainers
60+
61+
### Development Setup
62+
63+
#### Prerequisites
64+
65+
- Go 1.22.0 or later
66+
- Go toolchain 1.22.5 or later
67+
68+
#### Installation
69+
70+
```bash
71+
# Clone the repository
72+
git clone https://github.com/Peersyst/xrpl-go
73+
74+
# Install dependencies
75+
go mod tidy
76+
77+
# Run linting
78+
make lint
79+
80+
# Run tests
81+
make test-ci
82+
```
83+
84+
## Style Guide
85+
86+
- Use consistent indentation
87+
- Write clear, self-documenting code
88+
- Add comments for complex logic
89+
90+
## Code Review Process
91+
92+
- All submissions require review from project maintainers
93+
- We may request changes or provide feedback
94+
- Expect a response within [X] business days
95+
- Maintain a respectful and constructive dialogue
96+
97+
## Licensing
98+
99+
By contributing, you agree that your contributions will be licensed under the project's MIT license.
100+
101+
## Questions?
102+
103+
If you have any questions, please:
104+
- Check the documentation
105+
- Open an issue for clarification
106+
107+
**Happy Contributing!** 🚀

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 xyield
3+
Copyright (c) 2024 Peersyst
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This library is still in development and not yet intended for production use.
1313

1414
## Requirements
1515

16-
Requiring Go version `1.21.0` and later.
16+
Requiring Go version `1.22.0` and later.
1717
[Download latest Go version](https://go.dev/dl/)
1818

1919
## Packages
@@ -26,83 +26,6 @@ Requiring Go version `1.21.0` and later.
2626
| xrpl | Core package containing the main functionality for interacting with the XRP Ledger |
2727
| examples | Contains example code demonstrating usage of the xrpl-go library |
2828

29-
## Usage
30-
31-
Here's a list of examples of how to use the library.
32-
33-
### Create a wallet
34-
This example shows how to create a new wallet with a random seed or from a given seed.
35-
36-
```go
37-
wallet, err := xrpl.NewWallet(addresscodec.ED25519)
38-
walletFromSeed, _ := xrpl.NewWalletFromSeed("sEdSMVV4dJ1JbdBxmakRR4Puu3XVZz2", "")
39-
walletFromSecret, _ := xrpl.NewWalletFromSecret("sEdSMVV4dJ1JbdBxmakRR4Puu3XVZz2")
40-
```
41-
42-
### Fund a wallet
43-
This example shows how to fund a wallet on the testnet. Devnet wallet funding is also supported. For custom ledger funding, you can implement the `FaucetProvider` interface.
44-
```go
45-
testnetFaucet := faucet.NewTestnetFaucetProvider()
46-
testnetClientCfg := websocket.NewWebsocketClientConfig().
47-
WithHost("wss://s.altnet.rippletest.net:51233").
48-
WithFaucetProvider(testnetFaucet)
49-
testnetClient := websocket.NewWebsocketClient(testnetClientCfg)
50-
51-
wallet, err := xrpl.NewWallet(addresscodec.ED25519)
52-
if err != nil {
53-
// ...
54-
}
55-
56-
err = testnetClient.FundWallet(&wallet)
57-
if err != nil {
58-
// ...
59-
}
60-
```
61-
62-
### Sign and submit a transaction
63-
64-
This example shows how to sign and submit a transaction to the XRP Ledger.
65-
```go
66-
wallet, err := xrpl.NewWalletFromSeed("sEdSMVV4dJ1JbdBxmakRR4Puu3XVZz2", "")
67-
if err != nil {
68-
// ...
69-
}
70-
receiverWallet, err := xrpl.NewWalletFromSeed("sEd7d8Ci9nevdLCeUMctF3uGXp9WQqJ", "")
71-
if err != nil {
72-
// ...
73-
}
74-
75-
client := websocket.NewWebsocketClient(
76-
websocket.NewWebsocketClientConfig().
77-
WithHost("wss://s.altnet.rippletest.net:51233").
78-
WithFaucetProvider(faucet.NewTestnetFaucetProvider()),
79-
)
80-
81-
payment := transactions.Payment{
82-
BaseTx: transactions.BaseTx{
83-
Account: types.Address(wallet.GetAddress()),
84-
},
85-
Destination: types.Address(receiverWallet.GetAddress()),
86-
Amount: types.XRPCurrencyAmount(1000000),
87-
}
88-
flatTx := payment.Flatten()
89-
90-
err = client.Autofill(&flatTx)
91-
if err != nil {
92-
// ...
93-
}
94-
95-
txBlob, _, err := wallet.Sign(flatTx)
96-
if err != nil {
97-
// ...
98-
}
99-
100-
response, err := client.SubmitTransactionBlob(txBlob, true)
101-
if err != nil {
102-
// ...
103-
}
104-
```
105-
10629
## Report an issue
10730

10831
If you find any issues, please report them to the [XRPL-GO GitHub repository](https://github.com/Peersyst/xrpl-go/issues).

address-codec/base58check.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@ package addresscodec
22

33
import (
44
"crypto/sha256"
5-
"errors"
6-
)
7-
8-
// ErrChecksum indicates that the checksum of a check-encoded string does not verify against
9-
// the checksum.
10-
// ErrInvalidFormat indicates that the check-encoded string has an invalid format.
11-
var (
12-
ErrChecksum = errors.New("checksum error")
13-
ErrInvalidFormat = errors.New("invalid format: version and/or checksum bytes missing")
145
)
156

167
// checksum: first four bytes of sha256^2

address-codec/codec.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"bytes"
55
"encoding/hex"
66
"errors"
7-
"fmt"
87

98
"github.com/Peersyst/xrpl-go/address-codec/interfaces"
109
"github.com/Peersyst/xrpl-go/pkg/crypto"
@@ -27,24 +26,6 @@ const (
2726
NodePublicKeyPrefix = 0x1C
2827
)
2928

30-
var (
31-
// Errors
32-
33-
// Invalid classic address
34-
ErrInvalidClassicAddress = errors.New("invalid classic address")
35-
ErrInvalidSeed = errors.New("invalid seed; could not determine encoding algorithm")
36-
)
37-
38-
type EncodeLengthError struct {
39-
Instance string
40-
Input int
41-
Expected int
42-
}
43-
44-
func (e *EncodeLengthError) Error() string {
45-
return fmt.Sprintf("`%v` length should be %v not %v", e.Instance, e.Expected, e.Input)
46-
}
47-
4829
// Returns the base58 encoding of byte slice, with the given type prefix, whilst ensuring that the byte slice is the expected length.
4930
func Encode(b []byte, typePrefix []byte, expectedLength int) (string, error) {
5031

0 commit comments

Comments
 (0)