mirror of
https://github.com/aljazceru/ark.git
synced 2026-01-19 19:54:21 +01:00
New boarding protocol (#279)
* [domain] add reverse boarding inputs in Payment struct * [tx-builder] support reverse boarding script * [wallet] add GetTransaction * [api-spec][application] add reverse boarding support in covenantless * [config] add reverse boarding config * [api-spec] add ReverseBoardingAddress RPC * [domain][application] support empty forfeits txs in EndFinalization events * [tx-builder] optional connector output in round tx * [btc-embedded] fix getTx and taproot finalizer * whitelist ReverseBoardingAddress RPC * [test] add reverse boarding integration test * [client] support reverse boarding * [sdk] support reverse boarding * [e2e] add sleep time after faucet * [test] run using bitcoin-core RPC * [tx-builder] fix GetSweepInput * [application][tx-builder] support reverse onboarding in covenant * [cli] support reverse onboarding in covenant CLI * [test] rework integration tests * [sdk] remove onchain wallet, replace by onboarding address * remove old onboarding protocols * [sdk] Fix RegisterPayment * [e2e] add more funds to covenant ASP * [e2e] add sleeping time * several fixes * descriptor boarding * remove boarding delay from info * [sdk] implement descriptor boarding * go mod tidy * fixes and revert error msgs * move descriptor pkg to common * add replace in go.mod * [sdk] fix unit tests * rename DescriptorInput --> BoardingInput * genrest in SDK * remove boarding input from domain * remove all "reverse boarding" * rename "onboarding" ==> "boarding" * remove outdate payment unit test * use tmpfs docker volument for compose testing files * several fixes
This commit is contained in:
@@ -23,11 +23,8 @@ type ASPClient interface {
|
||||
ListVtxos(ctx context.Context, addr string) ([]Vtxo, []Vtxo, error)
|
||||
GetRound(ctx context.Context, txID string) (*Round, error)
|
||||
GetRoundByID(ctx context.Context, roundID string) (*Round, error)
|
||||
Onboard(
|
||||
ctx context.Context, tx, userPubkey string, congestionTree tree.CongestionTree,
|
||||
) error
|
||||
RegisterPayment(
|
||||
ctx context.Context, inputs []VtxoKey, ephemeralPublicKey string,
|
||||
ctx context.Context, inputs []Input, ephemeralKey string,
|
||||
) (string, error)
|
||||
ClaimPayment(
|
||||
ctx context.Context, paymentID string, outputs []Output,
|
||||
@@ -37,7 +34,7 @@ type ASPClient interface {
|
||||
) (<-chan RoundEventChannel, error)
|
||||
Ping(ctx context.Context, paymentID string) (RoundEvent, error)
|
||||
FinalizePayment(
|
||||
ctx context.Context, signedForfeitTxs []string,
|
||||
ctx context.Context, signedForfeitTxs []string, signedRoundTx string,
|
||||
) error
|
||||
CreatePayment(
|
||||
ctx context.Context, inputs []VtxoKey, outputs []Output,
|
||||
@@ -45,6 +42,7 @@ type ASPClient interface {
|
||||
CompletePayment(
|
||||
ctx context.Context, signedRedeemTx string, signedUnconditionalForfeitTxs []string,
|
||||
) error
|
||||
GetBoardingAddress(ctx context.Context, userPubkey string) (string, error)
|
||||
SendTreeNonces(
|
||||
ctx context.Context, roundID, cosignerPubkey string, nonces bitcointree.TreeNonces,
|
||||
) error
|
||||
@@ -55,12 +53,13 @@ type ASPClient interface {
|
||||
}
|
||||
|
||||
type Info struct {
|
||||
Pubkey string
|
||||
RoundLifetime int64
|
||||
UnilateralExitDelay int64
|
||||
RoundInterval int64
|
||||
Network string
|
||||
MinRelayFee int64
|
||||
Pubkey string
|
||||
RoundLifetime int64
|
||||
UnilateralExitDelay int64
|
||||
RoundInterval int64
|
||||
Network string
|
||||
MinRelayFee int64
|
||||
BoardingDescriptorTemplate string
|
||||
}
|
||||
|
||||
type RoundEventChannel struct {
|
||||
@@ -68,11 +67,38 @@ type RoundEventChannel struct {
|
||||
Err error
|
||||
}
|
||||
|
||||
type Input interface {
|
||||
GetTxID() string
|
||||
GetVOut() uint32
|
||||
GetDescriptor() string
|
||||
}
|
||||
|
||||
type VtxoKey struct {
|
||||
Txid string
|
||||
VOut uint32
|
||||
}
|
||||
|
||||
func (k VtxoKey) GetTxID() string {
|
||||
return k.Txid
|
||||
}
|
||||
|
||||
func (k VtxoKey) GetVOut() uint32 {
|
||||
return k.VOut
|
||||
}
|
||||
|
||||
func (k VtxoKey) GetDescriptor() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
type BoardingInput struct {
|
||||
VtxoKey
|
||||
Descriptor string
|
||||
}
|
||||
|
||||
func (k BoardingInput) GetDescriptor() string {
|
||||
return k.Descriptor
|
||||
}
|
||||
|
||||
type Vtxo struct {
|
||||
VtxoKey
|
||||
Amount uint64
|
||||
|
||||
@@ -97,12 +97,13 @@ func (a *grpcClient) GetInfo(ctx context.Context) (*client.Info, error) {
|
||||
return nil, err
|
||||
}
|
||||
return &client.Info{
|
||||
Pubkey: resp.GetPubkey(),
|
||||
RoundLifetime: resp.GetRoundLifetime(),
|
||||
UnilateralExitDelay: resp.GetUnilateralExitDelay(),
|
||||
RoundInterval: resp.GetRoundInterval(),
|
||||
Network: resp.GetNetwork(),
|
||||
MinRelayFee: resp.GetMinRelayFee(),
|
||||
Pubkey: resp.GetPubkey(),
|
||||
RoundLifetime: resp.GetRoundLifetime(),
|
||||
UnilateralExitDelay: resp.GetUnilateralExitDelay(),
|
||||
RoundInterval: resp.GetRoundInterval(),
|
||||
Network: resp.GetNetwork(),
|
||||
MinRelayFee: resp.GetMinRelayFee(),
|
||||
BoardingDescriptorTemplate: resp.GetBoardingDescriptorTemplate(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -143,20 +144,8 @@ func (a *grpcClient) GetRound(
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *grpcClient) Onboard(
|
||||
ctx context.Context, tx, userPubkey string, congestionTree tree.CongestionTree,
|
||||
) error {
|
||||
req := &arkv1.OnboardRequest{
|
||||
BoardingTx: tx,
|
||||
UserPubkey: userPubkey,
|
||||
CongestionTree: treeToProto(congestionTree).parse(),
|
||||
}
|
||||
_, err := a.svc.Onboard(ctx, req)
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *grpcClient) RegisterPayment(
|
||||
ctx context.Context, inputs []client.VtxoKey, ephemeralPublicKey string,
|
||||
ctx context.Context, inputs []client.Input, ephemeralPublicKey string,
|
||||
) (string, error) {
|
||||
req := &arkv1.RegisterPaymentRequest{
|
||||
Inputs: ins(inputs).toProto(),
|
||||
@@ -198,11 +187,16 @@ func (a *grpcClient) Ping(
|
||||
}
|
||||
|
||||
func (a *grpcClient) FinalizePayment(
|
||||
ctx context.Context, signedForfeitTxs []string,
|
||||
ctx context.Context, signedForfeitTxs []string, signedRoundTx string,
|
||||
) error {
|
||||
req := &arkv1.FinalizePaymentRequest{
|
||||
SignedForfeitTxs: signedForfeitTxs,
|
||||
}
|
||||
|
||||
if len(signedRoundTx) > 0 {
|
||||
req.SignedRoundTx = &signedRoundTx
|
||||
}
|
||||
|
||||
_, err := a.svc.FinalizePayment(ctx, req)
|
||||
return err
|
||||
}
|
||||
@@ -210,8 +204,13 @@ func (a *grpcClient) FinalizePayment(
|
||||
func (a *grpcClient) CreatePayment(
|
||||
ctx context.Context, inputs []client.VtxoKey, outputs []client.Output,
|
||||
) (string, []string, error) {
|
||||
insCast := make([]client.Input, 0, len(inputs))
|
||||
for _, in := range inputs {
|
||||
insCast = append(insCast, in)
|
||||
}
|
||||
|
||||
req := &arkv1.CreatePaymentRequest{
|
||||
Inputs: ins(inputs).toProto(),
|
||||
Inputs: ins(insCast).toProto(),
|
||||
Outputs: outs(outputs).toProto(),
|
||||
}
|
||||
resp, err := a.svc.CreatePayment(ctx, req)
|
||||
@@ -260,6 +259,19 @@ func (a *grpcClient) GetRoundByID(
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *grpcClient) GetBoardingAddress(
|
||||
ctx context.Context, userPubkey string,
|
||||
) (string, error) {
|
||||
req := &arkv1.GetBoardingAddressRequest{
|
||||
Pubkey: userPubkey,
|
||||
}
|
||||
resp, err := a.svc.GetBoardingAddress(ctx, req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return resp.GetAddress(), nil
|
||||
}
|
||||
|
||||
func (a *grpcClient) SendTreeNonces(
|
||||
ctx context.Context, roundID, cosignerPubkey string, nonces bitcointree.TreeNonces,
|
||||
) error {
|
||||
@@ -418,8 +430,8 @@ func (v vtxo) toVtxo() client.Vtxo {
|
||||
}
|
||||
return client.Vtxo{
|
||||
VtxoKey: client.VtxoKey{
|
||||
Txid: v.GetOutpoint().GetTxid(),
|
||||
VOut: v.GetOutpoint().GetVout(),
|
||||
Txid: v.GetOutpoint().GetVtxoInput().GetTxid(),
|
||||
VOut: v.GetOutpoint().GetVtxoInput().GetVout(),
|
||||
},
|
||||
Amount: v.GetReceiver().GetAmount(),
|
||||
RoundTxid: v.GetPoolTxid(),
|
||||
@@ -441,21 +453,35 @@ func (v vtxos) toVtxos() []client.Vtxo {
|
||||
return list
|
||||
}
|
||||
|
||||
type input client.VtxoKey
|
||||
func toProtoInput(i client.Input) *arkv1.Input {
|
||||
if len(i.GetDescriptor()) > 0 {
|
||||
return &arkv1.Input{
|
||||
Input: &arkv1.Input_BoardingInput{
|
||||
BoardingInput: &arkv1.BoardingInput{
|
||||
Txid: i.GetTxID(),
|
||||
Vout: i.GetVOut(),
|
||||
Descriptor_: i.GetDescriptor(),
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (i input) toProto() *arkv1.Input {
|
||||
return &arkv1.Input{
|
||||
Txid: i.Txid,
|
||||
Vout: i.VOut,
|
||||
Input: &arkv1.Input_VtxoInput{
|
||||
VtxoInput: &arkv1.VtxoInput{
|
||||
Txid: i.GetTxID(),
|
||||
Vout: i.GetVOut(),
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type ins []client.VtxoKey
|
||||
type ins []client.Input
|
||||
|
||||
func (i ins) toProto() []*arkv1.Input {
|
||||
list := make([]*arkv1.Input, 0, len(i))
|
||||
for _, ii := range i {
|
||||
list = append(list, input(ii).toProto())
|
||||
list = append(list, toProtoInput(ii))
|
||||
}
|
||||
return list
|
||||
}
|
||||
@@ -496,27 +522,3 @@ func (t treeFromProto) parse() tree.CongestionTree {
|
||||
|
||||
return levels
|
||||
}
|
||||
|
||||
type treeToProto tree.CongestionTree
|
||||
|
||||
func (t treeToProto) parse() *arkv1.Tree {
|
||||
levels := make([]*arkv1.TreeLevel, 0, len(t))
|
||||
for _, level := range t {
|
||||
levelProto := &arkv1.TreeLevel{
|
||||
Nodes: make([]*arkv1.Node, 0, len(level)),
|
||||
}
|
||||
|
||||
for _, node := range level {
|
||||
levelProto.Nodes = append(levelProto.Nodes, &arkv1.Node{
|
||||
Txid: node.Txid,
|
||||
Tx: node.Tx,
|
||||
ParentTxid: node.ParentTxid,
|
||||
})
|
||||
}
|
||||
|
||||
levels = append(levels, levelProto)
|
||||
}
|
||||
return &arkv1.Tree{
|
||||
Levels: levels,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,12 +114,13 @@ func (a *restClient) GetInfo(
|
||||
}
|
||||
|
||||
return &client.Info{
|
||||
Pubkey: resp.Payload.Pubkey,
|
||||
RoundLifetime: int64(roundLifetime),
|
||||
UnilateralExitDelay: int64(unilateralExitDelay),
|
||||
RoundInterval: int64(roundInterval),
|
||||
Network: resp.Payload.Network,
|
||||
MinRelayFee: int64(minRelayFee),
|
||||
Pubkey: resp.Payload.Pubkey,
|
||||
RoundLifetime: int64(roundLifetime),
|
||||
UnilateralExitDelay: int64(unilateralExitDelay),
|
||||
RoundInterval: int64(roundInterval),
|
||||
Network: resp.Payload.Network,
|
||||
MinRelayFee: int64(minRelayFee),
|
||||
BoardingDescriptorTemplate: resp.Payload.BoardingDescriptorTemplate,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -159,8 +160,8 @@ func (a *restClient) ListVtxos(
|
||||
|
||||
spendableVtxos = append(spendableVtxos, client.Vtxo{
|
||||
VtxoKey: client.VtxoKey{
|
||||
Txid: v.Outpoint.Txid,
|
||||
VOut: uint32(v.Outpoint.Vout),
|
||||
Txid: v.Outpoint.VtxoInput.Txid,
|
||||
VOut: uint32(v.Outpoint.VtxoInput.Vout),
|
||||
},
|
||||
Amount: uint64(amount),
|
||||
RoundTxid: v.PoolTxid,
|
||||
@@ -191,8 +192,8 @@ func (a *restClient) ListVtxos(
|
||||
|
||||
spentVtxos = append(spentVtxos, client.Vtxo{
|
||||
VtxoKey: client.VtxoKey{
|
||||
Txid: v.Outpoint.Txid,
|
||||
VOut: uint32(v.Outpoint.Vout),
|
||||
Txid: v.Outpoint.VtxoInput.Txid,
|
||||
VOut: uint32(v.Outpoint.VtxoInput.Vout),
|
||||
},
|
||||
Amount: uint64(amount),
|
||||
RoundTxid: v.PoolTxid,
|
||||
@@ -243,29 +244,31 @@ func (a *restClient) GetRound(
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *restClient) Onboard(
|
||||
ctx context.Context, tx, userPubkey string, congestionTree tree.CongestionTree,
|
||||
) error {
|
||||
body := models.V1OnboardRequest{
|
||||
BoardingTx: tx,
|
||||
CongestionTree: treeToProto(congestionTree).parse(),
|
||||
UserPubkey: userPubkey,
|
||||
}
|
||||
_, err := a.svc.ArkServiceOnboard(
|
||||
ark_service.NewArkServiceOnboardParams().WithBody(&body),
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *restClient) RegisterPayment(
|
||||
ctx context.Context, inputs []client.VtxoKey, ephemeralPublicKey string,
|
||||
ctx context.Context, inputs []client.Input, ephemeralPublicKey string,
|
||||
) (string, error) {
|
||||
ins := make([]*models.V1Input, 0, len(inputs))
|
||||
for _, i := range inputs {
|
||||
ins = append(ins, &models.V1Input{
|
||||
Txid: i.Txid,
|
||||
Vout: int64(i.VOut),
|
||||
})
|
||||
var input *models.V1Input
|
||||
|
||||
if len(i.GetDescriptor()) > 0 {
|
||||
input = &models.V1Input{
|
||||
BoardingInput: &models.V1BoardingInput{
|
||||
Txid: i.GetTxID(),
|
||||
Vout: int64(i.GetVOut()),
|
||||
Descriptor: i.GetDescriptor(),
|
||||
},
|
||||
}
|
||||
} else {
|
||||
input = &models.V1Input{
|
||||
VtxoInput: &models.V1VtxoInput{
|
||||
Txid: i.GetTxID(),
|
||||
Vout: int64(i.GetVOut()),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
ins = append(ins, input)
|
||||
}
|
||||
body := &models.V1RegisterPaymentRequest{
|
||||
Inputs: ins,
|
||||
@@ -377,13 +380,11 @@ func (a *restClient) Ping(
|
||||
}
|
||||
|
||||
func (a *restClient) FinalizePayment(
|
||||
ctx context.Context, signedForfeitTxs []string,
|
||||
ctx context.Context, signedForfeitTxs []string, signedRoundTx string,
|
||||
) error {
|
||||
req := &arkv1.FinalizePaymentRequest{
|
||||
SignedForfeitTxs: signedForfeitTxs,
|
||||
}
|
||||
body := models.V1FinalizePaymentRequest{
|
||||
SignedForfeitTxs: req.GetSignedForfeitTxs(),
|
||||
SignedForfeitTxs: signedForfeitTxs,
|
||||
SignedRoundTx: signedRoundTx,
|
||||
}
|
||||
_, err := a.svc.ArkServiceFinalizePayment(
|
||||
ark_service.NewArkServiceFinalizePaymentParams().WithBody(&body),
|
||||
@@ -396,9 +397,15 @@ func (a *restClient) CreatePayment(
|
||||
) (string, []string, error) {
|
||||
ins := make([]*models.V1Input, 0, len(inputs))
|
||||
for _, i := range inputs {
|
||||
if len(i.GetDescriptor()) > 0 {
|
||||
return "", nil, fmt.Errorf("boarding inputs are not allowed in create payment")
|
||||
}
|
||||
|
||||
ins = append(ins, &models.V1Input{
|
||||
Txid: i.Txid,
|
||||
Vout: int64(i.VOut),
|
||||
VtxoInput: &models.V1VtxoInput{
|
||||
Txid: i.Txid,
|
||||
Vout: int64(i.VOut),
|
||||
},
|
||||
})
|
||||
}
|
||||
outs := make([]*models.V1Output, 0, len(outputs))
|
||||
@@ -477,6 +484,23 @@ func (a *restClient) GetRoundByID(
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *restClient) GetBoardingAddress(
|
||||
ctx context.Context, pubkey string,
|
||||
) (string, error) {
|
||||
body := models.V1GetBoardingAddressRequest{
|
||||
Pubkey: pubkey,
|
||||
}
|
||||
|
||||
resp, err := a.svc.ArkServiceGetBoardingAddress(
|
||||
ark_service.NewArkServiceGetBoardingAddressParams().WithBody(&body),
|
||||
)
|
||||
if err != nil {
|
||||
return "",
|
||||
err
|
||||
}
|
||||
return resp.Payload.Address, nil
|
||||
}
|
||||
|
||||
func (a *restClient) SendTreeNonces(
|
||||
ctx context.Context, roundID, cosignerPubkey string, nonces bitcointree.TreeNonces,
|
||||
) error {
|
||||
@@ -604,25 +628,3 @@ func (t treeFromProto) parse() tree.CongestionTree {
|
||||
|
||||
return congestionTree
|
||||
}
|
||||
|
||||
type treeToProto tree.CongestionTree
|
||||
|
||||
func (t treeToProto) parse() *models.V1Tree {
|
||||
levels := make([]*models.V1TreeLevel, 0, len(t))
|
||||
for _, level := range t {
|
||||
nodes := make([]*models.V1Node, 0, len(level))
|
||||
for _, n := range level {
|
||||
nodes = append(nodes, &models.V1Node{
|
||||
Txid: n.Txid,
|
||||
Tx: n.Tx,
|
||||
ParentTxid: n.ParentTxid,
|
||||
})
|
||||
}
|
||||
levels = append(levels, &models.V1TreeLevel{
|
||||
Nodes: nodes,
|
||||
})
|
||||
}
|
||||
return &models.V1Tree{
|
||||
Levels: levels,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +62,8 @@ type ClientService interface {
|
||||
|
||||
ArkServiceFinalizePayment(params *ArkServiceFinalizePaymentParams, opts ...ClientOption) (*ArkServiceFinalizePaymentOK, error)
|
||||
|
||||
ArkServiceGetBoardingAddress(params *ArkServiceGetBoardingAddressParams, opts ...ClientOption) (*ArkServiceGetBoardingAddressOK, error)
|
||||
|
||||
ArkServiceGetEventStream(params *ArkServiceGetEventStreamParams, opts ...ClientOption) (*ArkServiceGetEventStreamOK, error)
|
||||
|
||||
ArkServiceGetInfo(params *ArkServiceGetInfoParams, opts ...ClientOption) (*ArkServiceGetInfoOK, error)
|
||||
@@ -72,8 +74,6 @@ type ClientService interface {
|
||||
|
||||
ArkServiceListVtxos(params *ArkServiceListVtxosParams, opts ...ClientOption) (*ArkServiceListVtxosOK, error)
|
||||
|
||||
ArkServiceOnboard(params *ArkServiceOnboardParams, opts ...ClientOption) (*ArkServiceOnboardOK, error)
|
||||
|
||||
ArkServicePing(params *ArkServicePingParams, opts ...ClientOption) (*ArkServicePingOK, error)
|
||||
|
||||
ArkServiceRegisterPayment(params *ArkServiceRegisterPaymentParams, opts ...ClientOption) (*ArkServiceRegisterPaymentOK, error)
|
||||
@@ -233,6 +233,43 @@ func (a *Client) ArkServiceFinalizePayment(params *ArkServiceFinalizePaymentPara
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceGetBoardingAddress ark service get boarding address API
|
||||
*/
|
||||
func (a *Client) ArkServiceGetBoardingAddress(params *ArkServiceGetBoardingAddressParams, opts ...ClientOption) (*ArkServiceGetBoardingAddressOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewArkServiceGetBoardingAddressParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "ArkService_GetBoardingAddress",
|
||||
Method: "POST",
|
||||
PathPattern: "/v1/boarding",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ArkServiceGetBoardingAddressReader{formats: a.formats},
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ArkServiceGetBoardingAddressOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*ArkServiceGetBoardingAddressDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceGetEventStream ark service get event stream API
|
||||
*/
|
||||
@@ -418,43 +455,6 @@ func (a *Client) ArkServiceListVtxos(params *ArkServiceListVtxosParams, opts ...
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceOnboard ark service onboard API
|
||||
*/
|
||||
func (a *Client) ArkServiceOnboard(params *ArkServiceOnboardParams, opts ...ClientOption) (*ArkServiceOnboardOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewArkServiceOnboardParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "ArkService_Onboard",
|
||||
Method: "POST",
|
||||
PathPattern: "/v1/onboard",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ArkServiceOnboardReader{formats: a.formats},
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ArkServiceOnboardOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*ArkServiceOnboardDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServicePing ark service ping API
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package ark_service
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/ark-network/ark/pkg/client-sdk/client/rest/service/models"
|
||||
)
|
||||
|
||||
// NewArkServiceGetBoardingAddressParams creates a new ArkServiceGetBoardingAddressParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewArkServiceGetBoardingAddressParams() *ArkServiceGetBoardingAddressParams {
|
||||
return &ArkServiceGetBoardingAddressParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceGetBoardingAddressParamsWithTimeout creates a new ArkServiceGetBoardingAddressParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewArkServiceGetBoardingAddressParamsWithTimeout(timeout time.Duration) *ArkServiceGetBoardingAddressParams {
|
||||
return &ArkServiceGetBoardingAddressParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceGetBoardingAddressParamsWithContext creates a new ArkServiceGetBoardingAddressParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewArkServiceGetBoardingAddressParamsWithContext(ctx context.Context) *ArkServiceGetBoardingAddressParams {
|
||||
return &ArkServiceGetBoardingAddressParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceGetBoardingAddressParamsWithHTTPClient creates a new ArkServiceGetBoardingAddressParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewArkServiceGetBoardingAddressParamsWithHTTPClient(client *http.Client) *ArkServiceGetBoardingAddressParams {
|
||||
return &ArkServiceGetBoardingAddressParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceGetBoardingAddressParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the ark service get boarding address operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ArkServiceGetBoardingAddressParams struct {
|
||||
|
||||
// Body.
|
||||
Body *models.V1GetBoardingAddressRequest
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the ark service get boarding address params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ArkServiceGetBoardingAddressParams) WithDefaults() *ArkServiceGetBoardingAddressParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the ark service get boarding address params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ArkServiceGetBoardingAddressParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the ark service get boarding address params
|
||||
func (o *ArkServiceGetBoardingAddressParams) WithTimeout(timeout time.Duration) *ArkServiceGetBoardingAddressParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the ark service get boarding address params
|
||||
func (o *ArkServiceGetBoardingAddressParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the ark service get boarding address params
|
||||
func (o *ArkServiceGetBoardingAddressParams) WithContext(ctx context.Context) *ArkServiceGetBoardingAddressParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the ark service get boarding address params
|
||||
func (o *ArkServiceGetBoardingAddressParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the ark service get boarding address params
|
||||
func (o *ArkServiceGetBoardingAddressParams) WithHTTPClient(client *http.Client) *ArkServiceGetBoardingAddressParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the ark service get boarding address params
|
||||
func (o *ArkServiceGetBoardingAddressParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the ark service get boarding address params
|
||||
func (o *ArkServiceGetBoardingAddressParams) WithBody(body *models.V1GetBoardingAddressRequest) *ArkServiceGetBoardingAddressParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the ark service get boarding address params
|
||||
func (o *ArkServiceGetBoardingAddressParams) SetBody(body *models.V1GetBoardingAddressRequest) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ArkServiceGetBoardingAddressParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package ark_service
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/ark-network/ark/pkg/client-sdk/client/rest/service/models"
|
||||
)
|
||||
|
||||
// ArkServiceGetBoardingAddressReader is a Reader for the ArkServiceGetBoardingAddress structure.
|
||||
type ArkServiceGetBoardingAddressReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ArkServiceGetBoardingAddressReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewArkServiceGetBoardingAddressOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewArkServiceGetBoardingAddressDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceGetBoardingAddressOK creates a ArkServiceGetBoardingAddressOK with default headers values
|
||||
func NewArkServiceGetBoardingAddressOK() *ArkServiceGetBoardingAddressOK {
|
||||
return &ArkServiceGetBoardingAddressOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceGetBoardingAddressOK describes a response with status code 200, with default header values.
|
||||
|
||||
A successful response.
|
||||
*/
|
||||
type ArkServiceGetBoardingAddressOK struct {
|
||||
Payload *models.V1GetBoardingAddressResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this ark service get boarding address o k response has a 2xx status code
|
||||
func (o *ArkServiceGetBoardingAddressOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this ark service get boarding address o k response has a 3xx status code
|
||||
func (o *ArkServiceGetBoardingAddressOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this ark service get boarding address o k response has a 4xx status code
|
||||
func (o *ArkServiceGetBoardingAddressOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this ark service get boarding address o k response has a 5xx status code
|
||||
func (o *ArkServiceGetBoardingAddressOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this ark service get boarding address o k response a status code equal to that given
|
||||
func (o *ArkServiceGetBoardingAddressOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the ark service get boarding address o k response
|
||||
func (o *ArkServiceGetBoardingAddressOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *ArkServiceGetBoardingAddressOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/boarding][%d] arkServiceGetBoardingAddressOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceGetBoardingAddressOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/boarding][%d] arkServiceGetBoardingAddressOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceGetBoardingAddressOK) GetPayload() *models.V1GetBoardingAddressResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ArkServiceGetBoardingAddressOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.V1GetBoardingAddressResponse)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewArkServiceGetBoardingAddressDefault creates a ArkServiceGetBoardingAddressDefault with default headers values
|
||||
func NewArkServiceGetBoardingAddressDefault(code int) *ArkServiceGetBoardingAddressDefault {
|
||||
return &ArkServiceGetBoardingAddressDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceGetBoardingAddressDefault describes a response with status code -1, with default header values.
|
||||
|
||||
An unexpected error response.
|
||||
*/
|
||||
type ArkServiceGetBoardingAddressDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload *models.RPCStatus
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this ark service get boarding address default response has a 2xx status code
|
||||
func (o *ArkServiceGetBoardingAddressDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this ark service get boarding address default response has a 3xx status code
|
||||
func (o *ArkServiceGetBoardingAddressDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this ark service get boarding address default response has a 4xx status code
|
||||
func (o *ArkServiceGetBoardingAddressDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this ark service get boarding address default response has a 5xx status code
|
||||
func (o *ArkServiceGetBoardingAddressDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this ark service get boarding address default response a status code equal to that given
|
||||
func (o *ArkServiceGetBoardingAddressDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the ark service get boarding address default response
|
||||
func (o *ArkServiceGetBoardingAddressDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *ArkServiceGetBoardingAddressDefault) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/boarding][%d] ArkService_GetBoardingAddress default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceGetBoardingAddressDefault) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/boarding][%d] ArkService_GetBoardingAddress default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceGetBoardingAddressDefault) GetPayload() *models.RPCStatus {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ArkServiceGetBoardingAddressDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.RPCStatus)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package ark_service
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/ark-network/ark/pkg/client-sdk/client/rest/service/models"
|
||||
)
|
||||
|
||||
// NewArkServiceOnboardParams creates a new ArkServiceOnboardParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewArkServiceOnboardParams() *ArkServiceOnboardParams {
|
||||
return &ArkServiceOnboardParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceOnboardParamsWithTimeout creates a new ArkServiceOnboardParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewArkServiceOnboardParamsWithTimeout(timeout time.Duration) *ArkServiceOnboardParams {
|
||||
return &ArkServiceOnboardParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceOnboardParamsWithContext creates a new ArkServiceOnboardParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewArkServiceOnboardParamsWithContext(ctx context.Context) *ArkServiceOnboardParams {
|
||||
return &ArkServiceOnboardParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceOnboardParamsWithHTTPClient creates a new ArkServiceOnboardParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewArkServiceOnboardParamsWithHTTPClient(client *http.Client) *ArkServiceOnboardParams {
|
||||
return &ArkServiceOnboardParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceOnboardParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the ark service onboard operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ArkServiceOnboardParams struct {
|
||||
|
||||
// Body.
|
||||
Body *models.V1OnboardRequest
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the ark service onboard params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ArkServiceOnboardParams) WithDefaults() *ArkServiceOnboardParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the ark service onboard params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ArkServiceOnboardParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the ark service onboard params
|
||||
func (o *ArkServiceOnboardParams) WithTimeout(timeout time.Duration) *ArkServiceOnboardParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the ark service onboard params
|
||||
func (o *ArkServiceOnboardParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the ark service onboard params
|
||||
func (o *ArkServiceOnboardParams) WithContext(ctx context.Context) *ArkServiceOnboardParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the ark service onboard params
|
||||
func (o *ArkServiceOnboardParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the ark service onboard params
|
||||
func (o *ArkServiceOnboardParams) WithHTTPClient(client *http.Client) *ArkServiceOnboardParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the ark service onboard params
|
||||
func (o *ArkServiceOnboardParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the ark service onboard params
|
||||
func (o *ArkServiceOnboardParams) WithBody(body *models.V1OnboardRequest) *ArkServiceOnboardParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the ark service onboard params
|
||||
func (o *ArkServiceOnboardParams) SetBody(body *models.V1OnboardRequest) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ArkServiceOnboardParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,185 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package ark_service
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/ark-network/ark/pkg/client-sdk/client/rest/service/models"
|
||||
)
|
||||
|
||||
// ArkServiceOnboardReader is a Reader for the ArkServiceOnboard structure.
|
||||
type ArkServiceOnboardReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ArkServiceOnboardReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewArkServiceOnboardOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewArkServiceOnboardDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceOnboardOK creates a ArkServiceOnboardOK with default headers values
|
||||
func NewArkServiceOnboardOK() *ArkServiceOnboardOK {
|
||||
return &ArkServiceOnboardOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceOnboardOK describes a response with status code 200, with default header values.
|
||||
|
||||
A successful response.
|
||||
*/
|
||||
type ArkServiceOnboardOK struct {
|
||||
Payload models.V1OnboardResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this ark service onboard o k response has a 2xx status code
|
||||
func (o *ArkServiceOnboardOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this ark service onboard o k response has a 3xx status code
|
||||
func (o *ArkServiceOnboardOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this ark service onboard o k response has a 4xx status code
|
||||
func (o *ArkServiceOnboardOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this ark service onboard o k response has a 5xx status code
|
||||
func (o *ArkServiceOnboardOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this ark service onboard o k response a status code equal to that given
|
||||
func (o *ArkServiceOnboardOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the ark service onboard o k response
|
||||
func (o *ArkServiceOnboardOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *ArkServiceOnboardOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/onboard][%d] arkServiceOnboardOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceOnboardOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/onboard][%d] arkServiceOnboardOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceOnboardOK) GetPayload() models.V1OnboardResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ArkServiceOnboardOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewArkServiceOnboardDefault creates a ArkServiceOnboardDefault with default headers values
|
||||
func NewArkServiceOnboardDefault(code int) *ArkServiceOnboardDefault {
|
||||
return &ArkServiceOnboardDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceOnboardDefault describes a response with status code -1, with default header values.
|
||||
|
||||
An unexpected error response.
|
||||
*/
|
||||
type ArkServiceOnboardDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload *models.RPCStatus
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this ark service onboard default response has a 2xx status code
|
||||
func (o *ArkServiceOnboardDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this ark service onboard default response has a 3xx status code
|
||||
func (o *ArkServiceOnboardDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this ark service onboard default response has a 4xx status code
|
||||
func (o *ArkServiceOnboardDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this ark service onboard default response has a 5xx status code
|
||||
func (o *ArkServiceOnboardDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this ark service onboard default response a status code equal to that given
|
||||
func (o *ArkServiceOnboardDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the ark service onboard default response
|
||||
func (o *ArkServiceOnboardDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *ArkServiceOnboardDefault) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/onboard][%d] ArkService_Onboard default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceOnboardDefault) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/onboard][%d] ArkService_Onboard default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceOnboardDefault) GetPayload() *models.RPCStatus {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ArkServiceOnboardDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.RPCStatus)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package ark_service
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/ark-network/ark/pkg/client-sdk/client/rest/service/models"
|
||||
)
|
||||
|
||||
// NewArkServiceTrustedOnboardingParams creates a new ArkServiceTrustedOnboardingParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewArkServiceTrustedOnboardingParams() *ArkServiceTrustedOnboardingParams {
|
||||
return &ArkServiceTrustedOnboardingParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceTrustedOnboardingParamsWithTimeout creates a new ArkServiceTrustedOnboardingParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewArkServiceTrustedOnboardingParamsWithTimeout(timeout time.Duration) *ArkServiceTrustedOnboardingParams {
|
||||
return &ArkServiceTrustedOnboardingParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceTrustedOnboardingParamsWithContext creates a new ArkServiceTrustedOnboardingParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewArkServiceTrustedOnboardingParamsWithContext(ctx context.Context) *ArkServiceTrustedOnboardingParams {
|
||||
return &ArkServiceTrustedOnboardingParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceTrustedOnboardingParamsWithHTTPClient creates a new ArkServiceTrustedOnboardingParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewArkServiceTrustedOnboardingParamsWithHTTPClient(client *http.Client) *ArkServiceTrustedOnboardingParams {
|
||||
return &ArkServiceTrustedOnboardingParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceTrustedOnboardingParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the ark service trusted onboarding operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ArkServiceTrustedOnboardingParams struct {
|
||||
|
||||
// Body.
|
||||
Body *models.V1TrustedOnboardingRequest
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the ark service trusted onboarding params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ArkServiceTrustedOnboardingParams) WithDefaults() *ArkServiceTrustedOnboardingParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the ark service trusted onboarding params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ArkServiceTrustedOnboardingParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the ark service trusted onboarding params
|
||||
func (o *ArkServiceTrustedOnboardingParams) WithTimeout(timeout time.Duration) *ArkServiceTrustedOnboardingParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the ark service trusted onboarding params
|
||||
func (o *ArkServiceTrustedOnboardingParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the ark service trusted onboarding params
|
||||
func (o *ArkServiceTrustedOnboardingParams) WithContext(ctx context.Context) *ArkServiceTrustedOnboardingParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the ark service trusted onboarding params
|
||||
func (o *ArkServiceTrustedOnboardingParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the ark service trusted onboarding params
|
||||
func (o *ArkServiceTrustedOnboardingParams) WithHTTPClient(client *http.Client) *ArkServiceTrustedOnboardingParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the ark service trusted onboarding params
|
||||
func (o *ArkServiceTrustedOnboardingParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the ark service trusted onboarding params
|
||||
func (o *ArkServiceTrustedOnboardingParams) WithBody(body *models.V1TrustedOnboardingRequest) *ArkServiceTrustedOnboardingParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the ark service trusted onboarding params
|
||||
func (o *ArkServiceTrustedOnboardingParams) SetBody(body *models.V1TrustedOnboardingRequest) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ArkServiceTrustedOnboardingParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,187 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package ark_service
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/ark-network/ark/pkg/client-sdk/client/rest/service/models"
|
||||
)
|
||||
|
||||
// ArkServiceTrustedOnboardingReader is a Reader for the ArkServiceTrustedOnboarding structure.
|
||||
type ArkServiceTrustedOnboardingReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ArkServiceTrustedOnboardingReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewArkServiceTrustedOnboardingOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewArkServiceTrustedOnboardingDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceTrustedOnboardingOK creates a ArkServiceTrustedOnboardingOK with default headers values
|
||||
func NewArkServiceTrustedOnboardingOK() *ArkServiceTrustedOnboardingOK {
|
||||
return &ArkServiceTrustedOnboardingOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceTrustedOnboardingOK describes a response with status code 200, with default header values.
|
||||
|
||||
A successful response.
|
||||
*/
|
||||
type ArkServiceTrustedOnboardingOK struct {
|
||||
Payload *models.V1TrustedOnboardingResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this ark service trusted onboarding o k response has a 2xx status code
|
||||
func (o *ArkServiceTrustedOnboardingOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this ark service trusted onboarding o k response has a 3xx status code
|
||||
func (o *ArkServiceTrustedOnboardingOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this ark service trusted onboarding o k response has a 4xx status code
|
||||
func (o *ArkServiceTrustedOnboardingOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this ark service trusted onboarding o k response has a 5xx status code
|
||||
func (o *ArkServiceTrustedOnboardingOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this ark service trusted onboarding o k response a status code equal to that given
|
||||
func (o *ArkServiceTrustedOnboardingOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the ark service trusted onboarding o k response
|
||||
func (o *ArkServiceTrustedOnboardingOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *ArkServiceTrustedOnboardingOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/onboard/address][%d] arkServiceTrustedOnboardingOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceTrustedOnboardingOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/onboard/address][%d] arkServiceTrustedOnboardingOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceTrustedOnboardingOK) GetPayload() *models.V1TrustedOnboardingResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ArkServiceTrustedOnboardingOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.V1TrustedOnboardingResponse)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewArkServiceTrustedOnboardingDefault creates a ArkServiceTrustedOnboardingDefault with default headers values
|
||||
func NewArkServiceTrustedOnboardingDefault(code int) *ArkServiceTrustedOnboardingDefault {
|
||||
return &ArkServiceTrustedOnboardingDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceTrustedOnboardingDefault describes a response with status code -1, with default header values.
|
||||
|
||||
An unexpected error response.
|
||||
*/
|
||||
type ArkServiceTrustedOnboardingDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload *models.RPCStatus
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this ark service trusted onboarding default response has a 2xx status code
|
||||
func (o *ArkServiceTrustedOnboardingDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this ark service trusted onboarding default response has a 3xx status code
|
||||
func (o *ArkServiceTrustedOnboardingDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this ark service trusted onboarding default response has a 4xx status code
|
||||
func (o *ArkServiceTrustedOnboardingDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this ark service trusted onboarding default response has a 5xx status code
|
||||
func (o *ArkServiceTrustedOnboardingDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this ark service trusted onboarding default response a status code equal to that given
|
||||
func (o *ArkServiceTrustedOnboardingDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the ark service trusted onboarding default response
|
||||
func (o *ArkServiceTrustedOnboardingDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *ArkServiceTrustedOnboardingDefault) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/onboard/address][%d] ArkService_TrustedOnboarding default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceTrustedOnboardingDefault) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/onboard/address][%d] ArkService_TrustedOnboarding default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceTrustedOnboardingDefault) GetPayload() *models.RPCStatus {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ArkServiceTrustedOnboardingDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.RPCStatus)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// V1BoardingInput v1 boarding input
|
||||
//
|
||||
// swagger:model v1BoardingInput
|
||||
type V1BoardingInput struct {
|
||||
|
||||
// descriptor
|
||||
Descriptor string `json:"descriptor,omitempty"`
|
||||
|
||||
// txid
|
||||
Txid string `json:"txid,omitempty"`
|
||||
|
||||
// vout
|
||||
Vout int64 `json:"vout,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this v1 boarding input
|
||||
func (m *V1BoardingInput) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this v1 boarding input based on context it is used
|
||||
func (m *V1BoardingInput) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *V1BoardingInput) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *V1BoardingInput) UnmarshalBinary(b []byte) error {
|
||||
var res V1BoardingInput
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -19,6 +19,9 @@ type V1FinalizePaymentRequest struct {
|
||||
|
||||
// Forfeit txs signed by the user.
|
||||
SignedForfeitTxs []string `json:"signedForfeitTxs"`
|
||||
|
||||
// If payment has reverse boarding, the user must sign the associated inputs.
|
||||
SignedRoundTx string `json:"signedRoundTx,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this v1 finalize payment request
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// V1GetBoardingAddressRequest v1 get boarding address request
|
||||
//
|
||||
// swagger:model v1GetBoardingAddressRequest
|
||||
type V1GetBoardingAddressRequest struct {
|
||||
|
||||
// pubkey
|
||||
Pubkey string `json:"pubkey,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this v1 get boarding address request
|
||||
func (m *V1GetBoardingAddressRequest) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this v1 get boarding address request based on context it is used
|
||||
func (m *V1GetBoardingAddressRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *V1GetBoardingAddressRequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *V1GetBoardingAddressRequest) UnmarshalBinary(b []byte) error {
|
||||
var res V1GetBoardingAddressRequest
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// V1GetBoardingAddressResponse v1 get boarding address response
|
||||
//
|
||||
// swagger:model v1GetBoardingAddressResponse
|
||||
type V1GetBoardingAddressResponse struct {
|
||||
|
||||
// address
|
||||
Address string `json:"address,omitempty"`
|
||||
|
||||
// descriptor
|
||||
Descriptor string `json:"descriptor,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this v1 get boarding address response
|
||||
func (m *V1GetBoardingAddressResponse) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this v1 get boarding address response based on context it is used
|
||||
func (m *V1GetBoardingAddressResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *V1GetBoardingAddressResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *V1GetBoardingAddressResponse) UnmarshalBinary(b []byte) error {
|
||||
var res V1GetBoardingAddressResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -17,6 +17,9 @@ import (
|
||||
// swagger:model v1GetInfoResponse
|
||||
type V1GetInfoResponse struct {
|
||||
|
||||
// boarding descriptor template
|
||||
BoardingDescriptorTemplate string `json:"boardingDescriptorTemplate,omitempty"`
|
||||
|
||||
// min relay fee
|
||||
MinRelayFee string `json:"minRelayFee,omitempty"`
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ package models
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
@@ -17,20 +18,126 @@ import (
|
||||
// swagger:model v1Input
|
||||
type V1Input struct {
|
||||
|
||||
// txid
|
||||
Txid string `json:"txid,omitempty"`
|
||||
// boarding input
|
||||
BoardingInput *V1BoardingInput `json:"boardingInput,omitempty"`
|
||||
|
||||
// vout
|
||||
Vout int64 `json:"vout,omitempty"`
|
||||
// vtxo input
|
||||
VtxoInput *V1VtxoInput `json:"vtxoInput,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this v1 input
|
||||
func (m *V1Input) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateBoardingInput(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateVtxoInput(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this v1 input based on context it is used
|
||||
func (m *V1Input) validateBoardingInput(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.BoardingInput) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.BoardingInput != nil {
|
||||
if err := m.BoardingInput.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("boardingInput")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("boardingInput")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *V1Input) validateVtxoInput(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.VtxoInput) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.VtxoInput != nil {
|
||||
if err := m.VtxoInput.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("vtxoInput")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("vtxoInput")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this v1 input based on the context it is used
|
||||
func (m *V1Input) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateBoardingInput(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateVtxoInput(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *V1Input) contextValidateBoardingInput(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.BoardingInput != nil {
|
||||
|
||||
if swag.IsZero(m.BoardingInput) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.BoardingInput.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("boardingInput")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("boardingInput")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *V1Input) contextValidateVtxoInput(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.VtxoInput != nil {
|
||||
|
||||
if swag.IsZero(m.VtxoInput) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.VtxoInput.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("vtxoInput")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("vtxoInput")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// V1OnboardRequest v1 onboard request
|
||||
//
|
||||
// swagger:model v1OnboardRequest
|
||||
type V1OnboardRequest struct {
|
||||
|
||||
// boarding tx
|
||||
BoardingTx string `json:"boardingTx,omitempty"`
|
||||
|
||||
// congestion tree
|
||||
CongestionTree *V1Tree `json:"congestionTree,omitempty"`
|
||||
|
||||
// user pubkey
|
||||
UserPubkey string `json:"userPubkey,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this v1 onboard request
|
||||
func (m *V1OnboardRequest) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateCongestionTree(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *V1OnboardRequest) validateCongestionTree(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.CongestionTree) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.CongestionTree != nil {
|
||||
if err := m.CongestionTree.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("congestionTree")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("congestionTree")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this v1 onboard request based on the context it is used
|
||||
func (m *V1OnboardRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateCongestionTree(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *V1OnboardRequest) contextValidateCongestionTree(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.CongestionTree != nil {
|
||||
|
||||
if swag.IsZero(m.CongestionTree) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.CongestionTree.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("congestionTree")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("congestionTree")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *V1OnboardRequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *V1OnboardRequest) UnmarshalBinary(b []byte) error {
|
||||
var res V1OnboardRequest
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// V1OnboardResponse v1 onboard response
|
||||
//
|
||||
// swagger:model v1OnboardResponse
|
||||
type V1OnboardResponse interface{}
|
||||
@@ -1,50 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// V1TrustedOnboardingRequest v1 trusted onboarding request
|
||||
//
|
||||
// swagger:model v1TrustedOnboardingRequest
|
||||
type V1TrustedOnboardingRequest struct {
|
||||
|
||||
// user pubkey
|
||||
UserPubkey string `json:"userPubkey,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this v1 trusted onboarding request
|
||||
func (m *V1TrustedOnboardingRequest) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this v1 trusted onboarding request based on context it is used
|
||||
func (m *V1TrustedOnboardingRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *V1TrustedOnboardingRequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *V1TrustedOnboardingRequest) UnmarshalBinary(b []byte) error {
|
||||
var res V1TrustedOnboardingRequest
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// V1TrustedOnboardingResponse v1 trusted onboarding response
|
||||
//
|
||||
// swagger:model v1TrustedOnboardingResponse
|
||||
type V1TrustedOnboardingResponse struct {
|
||||
|
||||
// address
|
||||
Address string `json:"address,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this v1 trusted onboarding response
|
||||
func (m *V1TrustedOnboardingResponse) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this v1 trusted onboarding response based on context it is used
|
||||
func (m *V1TrustedOnboardingResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *V1TrustedOnboardingResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *V1TrustedOnboardingResponse) UnmarshalBinary(b []byte) error {
|
||||
var res V1TrustedOnboardingResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
53
pkg/client-sdk/client/rest/service/models/v1_vtxo_input.go
Normal file
53
pkg/client-sdk/client/rest/service/models/v1_vtxo_input.go
Normal file
@@ -0,0 +1,53 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// V1VtxoInput v1 vtxo input
|
||||
//
|
||||
// swagger:model v1VtxoInput
|
||||
type V1VtxoInput struct {
|
||||
|
||||
// txid
|
||||
Txid string `json:"txid,omitempty"`
|
||||
|
||||
// vout
|
||||
Vout int64 `json:"vout,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this v1 vtxo input
|
||||
func (m *V1VtxoInput) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this v1 vtxo input based on context it is used
|
||||
func (m *V1VtxoInput) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *V1VtxoInput) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *V1VtxoInput) UnmarshalBinary(b []byte) error {
|
||||
var res V1VtxoInput
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user