Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename API fields #337

Merged
merged 7 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions api-spec/openapi/swagger/ark/v1/service.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -785,10 +785,10 @@
"type": "string",
"format": "int64"
},
"poolTx": {
"roundTx": {
"type": "string"
},
"congestionTree": {
"vtxoTree": {
"$ref": "#/definitions/v1Tree"
},
"forfeitTxs": {
Expand Down Expand Up @@ -825,10 +825,10 @@
"id": {
"type": "string"
},
"poolTx": {
"roundTx": {
"type": "string"
},
"congestionTree": {
"vtxoTree": {
"$ref": "#/definitions/v1Tree"
},
"connectors": {
Expand All @@ -849,7 +849,7 @@
"id": {
"type": "string"
},
"poolTxid": {
"roundTxid": {
"type": "string"
}
}
Expand All @@ -866,7 +866,7 @@
"type": "string"
}
},
"unsignedTree": {
"unsignedVtxoTree": {
"$ref": "#/definitions/v1Tree"
},
"unsignedRoundTx": {
Expand Down Expand Up @@ -921,7 +921,7 @@
"roundId": {
"type": "string"
},
"publicKey": {
"pubkey": {
"type": "string"
},
"treeNonces": {
Expand All @@ -938,7 +938,7 @@
"roundId": {
"type": "string"
},
"publicKey": {
"pubkey": {
"type": "string"
},
"treeSignatures": {
Expand Down Expand Up @@ -985,7 +985,7 @@
"spent": {
"type": "boolean"
},
"poolTxid": {
"roundTxid": {
"type": "string"
},
"spentBy": {
Expand Down
18 changes: 9 additions & 9 deletions api-spec/protobuf/ark/v1/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ message RegisterOutputsForNextRoundResponse {}

message SubmitTreeNoncesRequest {
string round_id = 1;
string public_key = 2;
string pubkey = 2;
string tree_nonces = 3;
}
message SubmitTreeNoncesResponse {}

message SubmitTreeSignaturesRequest {
string round_id = 1;
string public_key = 2;
string pubkey = 2;
string tree_signatures = 3;
}
message SubmitTreeSignaturesResponse {}
Expand Down Expand Up @@ -225,15 +225,15 @@ message ListVtxosResponse {

message RoundFinalizationEvent {
string id = 1;
string pool_tx = 2;
Tree congestion_tree = 3;
string round_tx = 2;
Tree vtxo_tree = 3;
repeated string connectors = 4;
int64 min_relay_fee_rate = 5;
}

message RoundFinalizedEvent {
string id = 1;
string pool_txid = 2;
string round_txid = 2;
}

message RoundFailed {
Expand All @@ -244,7 +244,7 @@ message RoundFailed {
message RoundSigningEvent {
string id = 1;
repeated string cosigners_pubkeys = 2;
Tree unsigned_tree = 3;
Tree unsigned_vtxo_tree = 3;
string unsigned_round_tx = 4;
}

Expand All @@ -267,8 +267,8 @@ message Round {
string id = 1;
int64 start = 2;
int64 end = 3;
string pool_tx = 4;
Tree congestion_tree = 5;
string round_tx = 4;
Tree vtxo_tree = 5;
repeated string forfeit_txs = 6;
repeated string connectors = 7;
RoundStage stage = 8;
Expand Down Expand Up @@ -308,7 +308,7 @@ message Vtxo {
Outpoint outpoint = 1;
string descriptor = 2;
bool spent = 3;
string pool_txid = 4;
string round_txid = 4;
string spent_by = 5;
int64 expire_at = 6;
bool swept = 7;
Expand Down
790 changes: 394 additions & 396 deletions api-spec/protobuf/gen/ark/v1/service.pb.go

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions pkg/client-sdk/client/grpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (a *grpcClient) SubmitTreeNonces(

req := &arkv1.SubmitTreeNoncesRequest{
RoundId: roundID,
PublicKey: cosignerPubkey,
Pubkey: cosignerPubkey,
TreeNonces: serializedNonces,
}

Expand All @@ -147,7 +147,7 @@ func (a *grpcClient) SubmitTreeSignatures(

req := &arkv1.SubmitTreeSignaturesRequest{
RoundId: roundID,
PublicKey: cosignerPubkey,
Pubkey: cosignerPubkey,
TreeSignatures: serializedSigs,
}

Expand Down Expand Up @@ -280,8 +280,8 @@ func (a *grpcClient) GetRound(
ID: round.GetId(),
StartedAt: &startedAt,
EndedAt: endedAt,
Tx: round.GetPoolTx(),
Tree: treeFromProto{round.GetCongestionTree()}.parse(),
Tx: round.GetRoundTx(),
Tree: treeFromProto{round.GetVtxoTree()}.parse(),
ForfeitTxs: round.GetForfeitTxs(),
Connectors: round.GetConnectors(),
Stage: client.RoundStage(int(round.GetStage())),
Expand All @@ -303,12 +303,12 @@ func (a *grpcClient) GetRoundByID(
t := time.Unix(round.GetEnd(), 0)
endedAt = &t
}
tree := treeFromProto{round.GetCongestionTree()}.parse()
tree := treeFromProto{round.GetVtxoTree()}.parse()
return &client.Round{
ID: round.GetId(),
StartedAt: &startedAt,
EndedAt: endedAt,
Tx: round.GetPoolTx(),
Tx: round.GetRoundTx(),
Tree: tree,
ForfeitTxs: round.GetForfeitTxs(),
Connectors: round.GetConnectors(),
Expand Down
10 changes: 5 additions & 5 deletions pkg/client-sdk/client/grpc/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ func (e event) toRoundEvent() (client.RoundEvent, error) {
}, nil
}
if ee := e.GetRoundFinalization(); ee != nil {
tree := treeFromProto{ee.GetCongestionTree()}.parse()
tree := treeFromProto{ee.GetVtxoTree()}.parse()
return client.RoundFinalizationEvent{
ID: ee.GetId(),
Tx: ee.GetPoolTx(),
Tx: ee.GetRoundTx(),
Tree: tree,
Connectors: ee.GetConnectors(),
MinRelayFeeRate: chainfee.SatPerKVByte(ee.MinRelayFeeRate),
Expand All @@ -68,7 +68,7 @@ func (e event) toRoundEvent() (client.RoundEvent, error) {
if ee := e.GetRoundFinalized(); ee != nil {
return client.RoundFinalizedEvent{
ID: ee.GetId(),
Txid: ee.GetPoolTxid(),
Txid: ee.GetRoundTxid(),
}, nil
}

Expand All @@ -88,7 +88,7 @@ func (e event) toRoundEvent() (client.RoundEvent, error) {

return client.RoundSigningStartedEvent{
ID: ee.GetId(),
UnsignedTree: treeFromProto{ee.GetUnsignedTree()}.parse(),
UnsignedTree: treeFromProto{ee.GetUnsignedVtxoTree()}.parse(),
CosignersPublicKeys: pubkeys,
UnsignedRoundTx: ee.GetUnsignedRoundTx(),
}, nil
Expand Down Expand Up @@ -130,7 +130,7 @@ func (v vtxo) toVtxo() client.Vtxo {
VOut: v.GetOutpoint().GetVout(),
},
Amount: v.GetAmount(),
RoundTxid: v.GetPoolTxid(),
RoundTxid: v.GetRoundTxid(),
ExpiresAt: expiresAt,
Pending: v.GetPending(),
RedeemTx: redeemTx,
Expand Down
24 changes: 12 additions & 12 deletions pkg/client-sdk/client/rest/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func (a *restClient) SubmitTreeNonces(

body := &models.V1SubmitTreeNoncesRequest{
RoundID: roundID,
PublicKey: cosignerPubkey,
Pubkey: cosignerPubkey,
TreeNonces: serializedNonces,
}

Expand All @@ -194,7 +194,7 @@ func (a *restClient) SubmitTreeSignatures(

body := &models.V1SubmitTreeSignaturesRequest{
RoundID: roundID,
PublicKey: cosignerPubkey,
Pubkey: cosignerPubkey,
TreeSignatures: serializedSigs,
}

Expand Down Expand Up @@ -287,7 +287,7 @@ func (a *restClient) Ping(
}, nil
}
if e := payload.RoundFinalization; e != nil {
tree := treeFromProto{e.CongestionTree}.parse()
tree := treeFromProto{e.VtxoTree}.parse()

minRelayFeeRate, err := strconv.Atoi(e.MinRelayFeeRate)
if err != nil {
Expand All @@ -296,7 +296,7 @@ func (a *restClient) Ping(

return client.RoundFinalizationEvent{
ID: e.ID,
Tx: e.PoolTx,
Tx: e.RoundTx,
Tree: tree,
Connectors: e.Connectors,
MinRelayFeeRate: chainfee.SatPerKVByte(minRelayFeeRate),
Expand All @@ -306,7 +306,7 @@ func (a *restClient) Ping(
if e := payload.RoundFinalized; e != nil {
return client.RoundFinalizedEvent{
ID: e.ID,
Txid: e.PoolTxid,
Txid: e.RoundTxid,
}, nil
}

Expand All @@ -326,7 +326,7 @@ func (a *restClient) Ping(

return client.RoundSigningStartedEvent{
ID: e.ID,
UnsignedTree: treeFromProto{e.UnsignedTree}.parse(),
UnsignedTree: treeFromProto{e.UnsignedVtxoTree}.parse(),
CosignersPublicKeys: pubkeys,
UnsignedRoundTx: e.UnsignedRoundTx,
}, nil
Expand Down Expand Up @@ -429,8 +429,8 @@ func (a *restClient) GetRound(
ID: resp.Payload.Round.ID,
StartedAt: &startedAt,
EndedAt: endedAt,
Tx: resp.Payload.Round.PoolTx,
Tree: treeFromProto{resp.Payload.Round.CongestionTree}.parse(),
Tx: resp.Payload.Round.RoundTx,
Tree: treeFromProto{resp.Payload.Round.VtxoTree}.parse(),
ForfeitTxs: resp.Payload.Round.ForfeitTxs,
Connectors: resp.Payload.Round.Connectors,
Stage: toRoundStage(*resp.Payload.Round.Stage),
Expand Down Expand Up @@ -468,8 +468,8 @@ func (a *restClient) GetRoundByID(
ID: resp.Payload.Round.ID,
StartedAt: &startedAt,
EndedAt: endedAt,
Tx: resp.Payload.Round.PoolTx,
Tree: treeFromProto{resp.Payload.Round.CongestionTree}.parse(),
Tx: resp.Payload.Round.RoundTx,
Tree: treeFromProto{resp.Payload.Round.VtxoTree}.parse(),
ForfeitTxs: resp.Payload.Round.ForfeitTxs,
Connectors: resp.Payload.Round.Connectors,
Stage: toRoundStage(*resp.Payload.Round.Stage),
Expand Down Expand Up @@ -516,7 +516,7 @@ func (a *restClient) ListVtxos(
VOut: uint32(v.Outpoint.Vout),
},
Amount: uint64(amount),
RoundTxid: v.PoolTxid,
RoundTxid: v.RoundTxid,
ExpiresAt: expiresAt,
Pending: v.Pending,
RedeemTx: redeemTx,
Expand Down Expand Up @@ -549,7 +549,7 @@ func (a *restClient) ListVtxos(
VOut: uint32(v.Outpoint.Vout),
},
Amount: uint64(amount),
RoundTxid: v.PoolTxid,
RoundTxid: v.RoundTxid,
ExpiresAt: expiresAt,
SpentBy: v.SpentBy,
Descriptor: v.Descriptor,
Expand Down
Loading
Loading