@@ -3,6 +3,7 @@ package fuel
3
3
import (
4
4
"context"
5
5
"github.com/ethereum/go-ethereum/common"
6
+ "github.com/sentioxyz/fuel-go/types"
6
7
"github.com/sentioxyz/fuel-go/util"
7
8
"github.com/sentioxyz/fuel-go/util/query"
8
9
"github.com/stretchr/testify/assert"
@@ -16,7 +17,7 @@ func Test_ExecuteQuery(t *testing.T) {
16
17
cli := NewClient (testnetEndpoint )
17
18
18
19
type result struct {
19
- Block Block `json:"block"`
20
+ Block types. Block `json:"block"`
20
21
}
21
22
{
22
23
q := `
@@ -33,11 +34,11 @@ func Test_ExecuteQuery(t *testing.T) {
33
34
34
35
ti , _ := time .Parse (time .RFC3339 , "2024-04-15T02:44:02Z" )
35
36
assert .NoError (t , err )
36
- assert .Equal (t , Block {
37
- Id : BlockId {Hash : common .HexToHash ("0x5d7f48fc777144b21ea760525936db069329dee2ccce509550c1478c1c0b5b2c" )},
38
- Header : Header {
37
+ assert .Equal (t , types. Block {
38
+ Id : types. BlockId {Hash : common .HexToHash ("0x5d7f48fc777144b21ea760525936db069329dee2ccce509550c1478c1c0b5b2c" )},
39
+ Header : types. Header {
39
40
Height : 9758550 ,
40
- Time : Tai64Timestamp {Time : ti },
41
+ Time : types. Tai64Timestamp {Time : ti },
41
42
},
42
43
}, r .Block )
43
44
}
@@ -62,7 +63,7 @@ func Test_ExecuteQuery(t *testing.T) {
62
63
func Test_GenObjectQuery (t * testing.T ) {
63
64
assert .Equal (t ,
64
65
"id header { id daHeight transactionsCount messageReceiptCount transactionsRoot messageReceiptRoot height prevRoot time applicationHash } consensus { __typename ... on Genesis { chainConfigHash coinsRoot contractsRoot messagesRoot } ... on PoAConsensus { signature } } " ,
65
- query .Simple .GenObjectQuery (Block {}, query .IgnoreObjects (Transaction {})),
66
+ query .Simple .GenObjectQuery (types. Block {}, query .IgnoreObjects (types. Transaction {})),
66
67
)
67
68
assert .Equal (t , `id
68
69
header {
@@ -90,40 +91,40 @@ consensus {
90
91
}
91
92
}
92
93
` ,
93
- query .Beauty .GenObjectQuery (Block {}, query .IgnoreObjects (Transaction {})),
94
+ query .Beauty .GenObjectQuery (types. Block {}, query .IgnoreObjects (types. Transaction {})),
94
95
)
95
96
96
97
assert .Equal (t ,
97
98
"id header { id daHeight transactionsCount messageReceiptCount transactionsRoot messageReceiptRoot height prevRoot time applicationHash } consensus { __typename ... on Genesis { chainConfigHash coinsRoot contractsRoot messagesRoot } ... on PoAConsensus { signature } } transactions { id inputAssetIds inputContracts { id bytecode salt } inputContract { utxoId balanceRoot stateRoot txPointer contract { id bytecode salt } } policies { gasPrice witnessLimit maturity maxFee } gasPrice scriptGasLimit maturity mintAmount mintAssetId txPointer isScript isCreate isMint inputs { __typename ... on InputCoin { utxoId owner amount assetId txPointer witnessIndex maturity predicateGasUsed predicate predicateData } ... on InputContract { utxoId balanceRoot stateRoot txPointer contract { id bytecode salt } } ... on InputMessage { sender recipient amount nonce witnessIndex predicateGasUsed data predicate predicateData } } outputs { __typename ... on CoinOutput { to amount assetId } ... on ContractOutput { inputIndex balanceRoot stateRoot } ... on ChangeOutput { to amount assetId } ... on VariableOutput { to amount assetId } ... on ContractCreated { contract { id bytecode salt } stateRoot } } outputContract { inputIndex balanceRoot stateRoot } witnesses receiptsRoot status { __typename ... on SubmittedStatus { time } ... on SqueezedOutStatus { reason } } receipts { contract { id bytecode salt } pc is to { id bytecode salt } toAddress amount assetId gas param1 param2 val ptr digest reason ra rb rc rd len receiptType result gasUsed data sender recipient nonce contractId subId } script scriptData bytecodeWitnessIndex bytecodeLength salt storageSlots rawPayload } " ,
98
- query .Simple .GenObjectQuery (Block {}, query .IgnoreObjects (SuccessStatus {}, FailureStatus {})),
99
+ query .Simple .GenObjectQuery (types. Block {}, query .IgnoreObjects (types. SuccessStatus {}, types. FailureStatus {})),
99
100
)
100
101
}
101
102
102
103
func Test_GenParam (t * testing.T ) {
103
104
assert .Equal (t ,
104
105
`id: "0x5d7f48fc777144b21ea760525936db069329dee2ccce509550c1478c1c0b5b2c" height: "1234" ` ,
105
- query .Simple .GenParam (QueryBlockParams {
106
- Id : & BlockId {Hash : common .HexToHash ("0x5d7f48fc777144b21ea760525936db069329dee2ccce509550c1478c1c0b5b2c" )},
107
- Height : util.GetPointer [U32 ](1234 ),
106
+ query .Simple .GenParam (types. QueryBlockParams {
107
+ Id : & types. BlockId {Hash : common .HexToHash ("0x5d7f48fc777144b21ea760525936db069329dee2ccce509550c1478c1c0b5b2c" )},
108
+ Height : util.GetPointer [types. U32 ](1234 ),
108
109
}),
109
110
)
110
111
assert .Equal (t ,
111
112
"id: \" 0x5d7f48fc777144b21ea760525936db069329dee2ccce509550c1478c1c0b5b2c\" \n height: \" 1234\" \n " ,
112
- query .Beauty .GenParam (QueryBlockParams {
113
- Id : & BlockId {Hash : common .HexToHash ("0x5d7f48fc777144b21ea760525936db069329dee2ccce509550c1478c1c0b5b2c" )},
114
- Height : util.GetPointer [U32 ](1234 ),
113
+ query .Beauty .GenParam (types. QueryBlockParams {
114
+ Id : & types. BlockId {Hash : common .HexToHash ("0x5d7f48fc777144b21ea760525936db069329dee2ccce509550c1478c1c0b5b2c" )},
115
+ Height : util.GetPointer [types. U32 ](1234 ),
115
116
}),
116
117
)
117
118
assert .Equal (t ,
118
119
"height: \" 1234\" \n " ,
119
- query .Beauty .GenParam (QueryBlockParams {
120
- Height : util.GetPointer [U32 ](1234 ),
120
+ query .Beauty .GenParam (types. QueryBlockParams {
121
+ Height : util.GetPointer [types. U32 ](1234 ),
121
122
}),
122
123
)
123
124
assert .Equal (t ,
124
125
"id: \" 0x5d7f48fc777144b21ea760525936db069329dee2ccce509550c1478c1c0b5b2c\" \n " ,
125
- query .Beauty .GenParam (QueryBlockParams {
126
- Id : & BlockId {Hash : common .HexToHash ("0x5d7f48fc777144b21ea760525936db069329dee2ccce509550c1478c1c0b5b2c" )},
126
+ query .Beauty .GenParam (types. QueryBlockParams {
127
+ Id : & types. BlockId {Hash : common .HexToHash ("0x5d7f48fc777144b21ea760525936db069329dee2ccce509550c1478c1c0b5b2c" )},
127
128
}),
128
129
)
129
130
}
0 commit comments