-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package client | ||
|
||
import ( | ||
"github.com/xyield/xrpl-go/model/client/channel" | ||
) | ||
|
||
type Channel interface { | ||
ChannelAuthorize(req *channel.ChannelAuthorizeRequest) (*channel.ChannelAuthorizeRequest, XRPLResponse, error) | ||
ChannelVerify(req *channel.ChannelVerifyRequest) (*channel.ChannelVerifyResponse, XRPLResponse, error) | ||
} | ||
|
||
type channelImpl struct { | ||
client Client | ||
} | ||
|
||
func (c *channelImpl) ChannelAuthorize(req *channel.ChannelAuthorizeRequest) (*channel.ChannelAuthorizeResponse, XRPLResponse, error) { | ||
res, err := c.client.SendRequest(req) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
var car channel.ChannelAuthorizeResponse | ||
err = res.GetResult(&car) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
return &car, res, nil | ||
} | ||
|
||
func (c *channelImpl) ChannelVerify(req *channel.ChannelVerifyRequest) (*channel.ChannelVerifyResponse, XRPLResponse, error) { | ||
res, err := c.client.SendRequest(req) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
var cvr channel.ChannelVerifyResponse | ||
err = res.GetResult(&cvr) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
return &cvr, res, nil | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package client | ||
|
||
import ( | ||
"github.com/xyield/xrpl-go/model/client/ledger" | ||
) | ||
|
||
type Ledger interface { | ||
LedgerClosed(req *ledger.LedgerClosedRequest) (*ledger.LedgerClosedRequest, XRPLResponse, error) | ||
LedgerCurrent(req *ledger.LedgerCurrentRequest) (*ledger.LedgerCurrentRequest, XRPLResponse, error) | ||
LedgerData(req *ledger.LedgerDataRequest) (*ledger.LedgerDataRequest, XRPLResponse, error) | ||
LedgerEntry(req *ledger.LedgerEntryRequest) (*ledger.LedgerEntryRequest, XRPLResponse, error) | ||
Ledger(req *ledger.LedgerRequest) (*ledger.LedgerRequest, XRPLResponse, error) | ||
} | ||
|
||
type ledgerImpl struct { | ||
client Client | ||
} | ||
|
||
func (l *ledgerImpl) LedgerClosed(req *ledger.LedgerClosedRequest) (*ledger.LedgerClosedResponse, XRPLResponse, error) { | ||
res, err := l.client.SendRequest(req) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
var lcr ledger.LedgerClosedResponse | ||
err = res.GetResult(&lcr) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
return &lcr, res, nil | ||
} | ||
|
||
func (l *ledgerImpl) LedgerCurrent(req *ledger.LedgerCurrentRequest) (*ledger.LedgerCurrentResponse, XRPLResponse, error) { | ||
res, err := l.client.SendRequest(req) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
var lcr ledger.LedgerCurrentResponse | ||
err = res.GetResult(&lcr) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
return &lcr, res, nil | ||
} | ||
|
||
func (l *ledgerImpl) LedgerData(req *ledger.LedgerDataRequest) (*ledger.LedgerDataResponse, XRPLResponse, error) { | ||
res, err := l.client.SendRequest(req) | ||
Check failure on line 46 in client/ledgers.go GitHub Actions / code-quality
Check failure on line 46 in client/ledgers.go GitHub Actions / code-quality
Check failure on line 46 in client/ledgers.go GitHub Actions / unit-tests
Check failure on line 46 in client/ledgers.go GitHub Actions / golang-ci
|
||
if err != nil { | ||
return nil, nil, err | ||
} | ||
var ldr ledger.LedgerDataResponse | ||
err = res.GetResult(&ldr) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
return &ldr, res, nil | ||
} | ||
|
||
func (l *ledgerImpl) LedgerEntry(req *ledger.LedgerEntryRequest) (*ledger.LedgerEntryResponse, XRPLResponse, error) { | ||
res, err := l.client.SendRequest(req) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
var ler ledger.LedgerEntryResponse | ||
err = res.GetResult(&ler) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
return &ler, res, nil | ||
} | ||
|
||
func (l *ledgerImpl) Ledger(req *ledger.LedgerRequest) (*ledger.LedgerResponse, XRPLResponse, error) { | ||
res, err := l.client.SendRequest(req) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
var lr ledger.LedgerResponse | ||
err = res.GetResult(&lr) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
return &lr, res, nil | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
package client | ||
|
||
import "github.com/xyield/xrpl-go/model/client/path" | ||
|
||
type PathBook interface { | ||
BookOffers(req *path.BookOffersRequest) (*path.BookOffersResponse, XRPLResponse, error) | ||
DepositAuthorized(req *path.DepositAuthorizedRequest) (*path.DepositAuthorizedResponse, XRPLResponse, error) | ||
NFTokenBuyOffers(req *path.NFTokenBuyOffersRequest) (*path.NFTokenBuyOffersResponse, XRPLResponse, error) | ||
NFTokenSellOffers(req *path.NFTokenSellOffersRequest) (*path.NFTokenSellOffersResponse, XRPLResponse, error) | ||
PathFind(req *path.PathFindRequest) (*path.PathFindResponse, XRPLResponse, error) | ||
RipplePathFind(req *path.RipplePathFindRequest) (*path.RipplePathFindResponse, XRPLResponse, error) | ||
} | ||
|
||
type pathImpl struct { | ||
client Client | ||
} | ||
|
||
func (p *pathImpl) BookOffers(req *path.BookOffersRequest) (*path.BookOffersResponse, XRPLResponse, error) { | ||
res, err := p.client.SendRequest(req) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
var bor path.BookOffersResponse | ||
err = res.GetResult(&bor) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
return &bor, res, nil | ||
} | ||
|
||
func (p *pathImpl) DepositAuthorized(req *path.DepositAuthorizedRequest) (*path.DepositAuthorizedResponse, XRPLResponse, error) { | ||
res, err := p.client.SendRequest(req) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
var dar path.DepositAuthorizedResponse | ||
err = res.GetResult(&dar) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
return &dar, res, nil | ||
} | ||
|
||
func (p *pathImpl) NFTBuyOffers(req *path.NFTokenBuyOffersRequest) (*path.NFTokenBuyOffersResponse, XRPLResponse, error) { | ||
res, err := p.client.SendRequest(req) | ||
Check failure on line 45 in client/path.go GitHub Actions / code-quality
Check failure on line 45 in client/path.go GitHub Actions / code-quality
Check failure on line 45 in client/path.go GitHub Actions / unit-tests
Check failure on line 45 in client/path.go GitHub Actions / golang-ci
|
||
if err != nil { | ||
return nil, nil, err | ||
} | ||
var nbr path.NFTokenBuyOffersResponse | ||
err = res.GetResult(&nbr) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
return &nbr, res, nil | ||
} | ||
|
||
func (p *pathImpl) NFTokenSellOffers(req *path.NFTokenSellOffersRequest) (*path.NFTokenSellOffersResponse, XRPLResponse, error) { | ||
res, err := p.client.SendRequest(req) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
var nsr path.NFTokenSellOffersResponse | ||
err = res.GetResult(&nsr) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
return &nsr, res, nil | ||
} | ||
|
||
func (p *pathImpl) PathFind(req *path.PathFindRequest) (*path.PathFindResponse, XRPLResponse, error) { | ||
res, err := p.client.SendRequest(req) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
var pfr path.PathFindResponse | ||
err = res.GetResult(&pfr) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
return &pfr, res, nil | ||
} | ||
|
||
func (p *pathImpl) RipplePathFind(req *path.RipplePathFindRequest) (*path.RipplePathFindResponse, XRPLResponse, error) { | ||
res, err := p.client.SendRequest(req) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
var rpfr path.RipplePathFindResponse | ||
err = res.GetResult(&rpfr) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
return &rpfr, res, nil | ||
} |