@@ -103,13 +103,13 @@ func (w *Wallet) SendWinstonSpeedUp(amount *big.Int, target string, tags []types
103
103
return w .SendTransaction (tx )
104
104
}
105
105
106
- func (w * Wallet ) SendData (data []byte , tags []types.Tag ) (id string , err error ) {
106
+ func (w * Wallet ) SendData (data []byte , tags []types.Tag ) (tx types. Transaction , err error ) {
107
107
return w .SendDataSpeedUp (data , tags , 0 )
108
108
}
109
109
110
110
// SendDataSpeedUp set speedFactor for speed up
111
111
// eg: speedFactor = 10, reward = 1.1 * reward
112
- func (w * Wallet ) SendDataSpeedUp (data []byte , tags []types.Tag , speedFactor int64 ) (id string , err error ) {
112
+ func (w * Wallet ) SendDataSpeedUp (data []byte , tags []types.Tag , speedFactor int64 ) (signedTx types. Transaction , err error ) {
113
113
reward , err := w .Client .GetTransactionPrice (data , nil )
114
114
if err != nil {
115
115
return
@@ -125,7 +125,9 @@ func (w *Wallet) SendDataSpeedUp(data []byte, tags []types.Tag, speedFactor int6
125
125
Reward : fmt .Sprintf ("%d" , reward * (100 + speedFactor )/ 100 ),
126
126
}
127
127
128
- return w .SendTransaction (tx )
128
+ _ , err = w .SendTransaction (tx )
129
+ signedTx = * tx
130
+ return
129
131
}
130
132
131
133
// SendTransaction: if send success, should return pending
@@ -150,16 +152,16 @@ func (w *Wallet) SendTransaction(tx *types.Transaction) (id string, err error) {
150
152
return
151
153
}
152
154
153
- func (w * Wallet ) SendPst (contractId string , target string , qty * big.Int , customTags []types.Tag , speedFactor int64 ) (string , error ) {
155
+ func (w * Wallet ) SendPst (contractId string , target string , qty * big.Int , customTags []types.Tag , speedFactor int64 ) (types. Transaction , error ) {
154
156
maxQty := big .NewInt (9007199254740991 ) // swc support max js integer
155
157
if qty .Cmp (maxQty ) > 0 {
156
- return "" , fmt .Errorf ("qty:%s can not more than max integer:%s" , qty .String (), maxQty .String ())
158
+ return types. Transaction {} , fmt .Errorf ("qty:%s can not more than max integer:%s" , qty .String (), maxQty .String ())
157
159
}
158
160
159
161
// assemble tx tags
160
162
swcTags , err := utils .PstTransferTags (contractId , target , qty .Int64 ())
161
163
if err != nil {
162
- return "" , err
164
+ return types. Transaction {} , err
163
165
}
164
166
165
167
if len (customTags ) > 0 {
@@ -172,7 +174,7 @@ func (w *Wallet) SendPst(contractId string, target string, qty *big.Int, customT
172
174
}
173
175
for _ , tag := range customTags {
174
176
if _ , ok := mmap [tag .Name ]; ok {
175
- return "" , errors .New ("custom tags can not include smartweave tags" )
177
+ return types. Transaction {} , errors .New ("custom tags can not include smartweave tags" )
176
178
}
177
179
}
178
180
swcTags = append (swcTags , customTags ... )
@@ -181,9 +183,5 @@ func (w *Wallet) SendPst(contractId string, target string, qty *big.Int, customT
181
183
// rand data
182
184
data := strconv .Itoa (rand .Intn (9999 ))
183
185
// send data tx
184
- txId , err := w .SendDataSpeedUp ([]byte (data ), swcTags , speedFactor )
185
- if err != nil {
186
- return "" , err
187
- }
188
- return txId , nil
186
+ return w .SendDataSpeedUp ([]byte (data ), swcTags , speedFactor )
189
187
}
0 commit comments