Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit e56bfef

Browse files
authored
Use *bool for the indexer optional bool parameters (#395)
* - Use *bool for the indexer HasTimelockCondition, HasExpirationCondition and RequiresStorageDepositReturn params, since omitempty will omit the default "false" value * - Fixed test
1 parent 6619890 commit e56bfef

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

nodeclient/indexer_client_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ import (
1515
)
1616

1717
func TestOutputsQuery_Build(t *testing.T) {
18+
trueCondition := true
1819
query := &nodeclient.BasicOutputsQuery{
1920
IndexerTimelockParas: nodeclient.IndexerTimelockParas{
20-
HasTimelockCondition: true,
21+
HasTimelockCondition: &trueCondition,
2122
TimelockedBefore: 1,
2223
TimelockedAfter: 2,
2324
},
2425
IndexerExpirationParas: nodeclient.IndexerExpirationParas{
25-
HasExpirationCondition: true,
26+
HasExpirationCondition: &trueCondition,
2627
ExpiresBefore: 5,
2728
ExpiresAfter: 6,
2829
},
@@ -31,7 +32,7 @@ func TestOutputsQuery_Build(t *testing.T) {
3132
CreatedAfter: 10,
3233
},
3334
IndexerStorageDepositParas: nodeclient.IndexerStorageDepositParas{
34-
RequiresStorageDepositReturn: true,
35+
RequiresStorageDepositReturn: &trueCondition,
3536
StorageDepositReturnAddressBech32: "",
3637
},
3738
AddressBech32: "alice",

nodeclient/indexer_models.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type IndexerCursorParas struct {
2929
// IndexerTimelockParas define timelock query parameters.
3030
type IndexerTimelockParas struct {
3131
// Filters outputs based on the presence of timelock unlock condition.
32-
HasTimelockCondition bool `qs:"hasTimelockCondition,omitempty"`
32+
HasTimelockCondition *bool `qs:"hasTimelockCondition,omitempty"`
3333
// Return outputs that are timelocked before a certain Unix timestamp.
3434
TimelockedBefore uint32 `qs:"timelockedBefore,omitempty"`
3535
// Return outputs that are timelocked after a certain Unix timestamp.
@@ -39,7 +39,7 @@ type IndexerTimelockParas struct {
3939
// IndexerExpirationParas define expiration query parameters.
4040
type IndexerExpirationParas struct {
4141
// Filters outputs based on the presence of expiration unlock condition.
42-
HasExpirationCondition bool `qs:"hasExpirationCondition,omitempty"`
42+
HasExpirationCondition *bool `qs:"hasExpirationCondition,omitempty"`
4343
// Return outputs that expire before a certain Unix timestamp.
4444
ExpiresBefore uint32 `qs:"expiresBefore,omitempty"`
4545
// Return outputs that expire after a certain Unix timestamp.
@@ -59,7 +59,7 @@ type IndexerCreationParas struct {
5959
// IndexerStorageDepositParas define storage deposit based query parameters.
6060
type IndexerStorageDepositParas struct {
6161
// Filters outputs based on the presence of storage deposit return unlock condition.
62-
RequiresStorageDepositReturn bool `qs:"requiresStorageDepositReturn,omitempty"`
62+
RequiresStorageDepositReturn *bool `qs:"requiresStorageDepositReturn,omitempty"`
6363
// Filter outputs based on the presence of a specific return address in the storage deposit return unlock condition.
6464
StorageDepositReturnAddressBech32 string `qs:"storageDepositAddress,omitempty"`
6565
}

0 commit comments

Comments
 (0)