Skip to content

Commit a0f554c

Browse files
committed
fix(): fix review comment
1 parent 8cce866 commit a0f554c

File tree

4 files changed

+22
-17
lines changed

4 files changed

+22
-17
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ arClient := goar.NewClient("https://arweave.net", proxyUrl)
116116
- [x] CreateAndSignBundleItem
117117
- [x] SendBundleTxSpeedUp
118118
- [x] SendBundleTx
119+
- [x] SendPst
119120

120121
Initialize the instance, use a keyfile.json:
121122

types/swc.go

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package types
2+
3+
import (
4+
"encoding/json"
5+
"fmt"
6+
)
7+
8+
type Input map[string]interface{}
9+
10+
func (i Input) ToString() (string, error) {
11+
bb, err := json.Marshal(i)
12+
if err != nil {
13+
fmt.Println(fmt.Errorf("json marshal input err: %v", err))
14+
return "", err
15+
}
16+
return string(bb), nil
17+
}

types/transaction.go

-12
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package types
22

33
import (
44
"encoding/json"
5-
"fmt"
65
)
76

87
type Transaction struct {
@@ -34,14 +33,3 @@ type GetChunk struct {
3433
func (gc *GetChunk) Marshal() ([]byte, error) {
3534
return json.Marshal(gc)
3635
}
37-
38-
type Input map[string]interface{}
39-
40-
func (i Input) ToString() (string, error) {
41-
bb, err := json.Marshal(i)
42-
if err != nil {
43-
fmt.Println(fmt.Errorf("json marshal input err: %v", err))
44-
return "", err
45-
}
46-
return string(bb), nil
47-
}

wallet.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,13 @@ func (w *Wallet) SendTransaction(tx *types.Transaction) (id string, err error) {
150150
return
151151
}
152152

153-
func (w *Wallet) SendPstTransfer(contractId string, target string, qty int64, customTags []types.Tag, speedFactor int64) (string, error) {
153+
func (w *Wallet) SendPst(contractId string, target string, qty int64, customTags []types.Tag, speedFactor int64) (string, error) {
154154
// assemble tx tags
155-
txTags := make([]types.Tag, 0)
156155
swcTags, err := utils.PstTransferTags(contractId, target, qty)
157156
if err != nil {
158157
return "", err
159158
}
160-
txTags = append(txTags, swcTags...)
159+
161160
if len(customTags) > 0 {
162161
// customTags can not include pstTags
163162
mmap := map[string]struct{}{
@@ -171,13 +170,13 @@ func (w *Wallet) SendPstTransfer(contractId string, target string, qty int64, cu
171170
return "", errors.New("custom tags can not include smartweave tags")
172171
}
173172
}
174-
txTags = append(txTags, customTags...)
173+
swcTags = append(swcTags, customTags...)
175174
}
176175

177176
// rand data
178177
data := strconv.Itoa(rand.Intn(9999))
179178
// send data tx
180-
txId, err := w.SendDataSpeedUp([]byte(data), txTags, speedFactor)
179+
txId, err := w.SendDataSpeedUp([]byte(data), swcTags, speedFactor)
181180
if err != nil {
182181
return "", err
183182
}

0 commit comments

Comments
 (0)