|
1 | 1 | package example
|
2 | 2 |
|
3 | 3 | import (
|
| 4 | + "github.com/everFinance/goar/types" |
| 5 | + "io/ioutil" |
4 | 6 | "testing"
|
5 | 7 |
|
6 | 8 | "github.com/everFinance/goar"
|
@@ -88,7 +90,7 @@ func Test_Arq(t *testing.T) {
|
88 | 90 | t.Log(ids)
|
89 | 91 | }
|
90 | 92 |
|
91 |
| -func Test_SendFormat1Tx(t *testing.T) { |
| 93 | +func Test_SendFormatTx(t *testing.T) { |
92 | 94 | // arNode := "https://arweave.net"
|
93 | 95 | // wallet, err := goar.NewWalletFromPath("./testKey.json", arNode)
|
94 | 96 | // assert.NoError(t, err)
|
@@ -131,3 +133,30 @@ func Test_SendFormat1Tx(t *testing.T) {
|
131 | 133 | // t.Log("from: ",wallet.Address)
|
132 | 134 | // t.Log("txHash: ", tx.ID)
|
133 | 135 | }
|
| 136 | + |
| 137 | +func Test_SendData(t *testing.T) { |
| 138 | + arNode := "https://arweave.net" |
| 139 | + w, err := goar.NewWalletFromPath("./wallet/account1.json", arNode) // your wallet private key |
| 140 | + assert.NoError(t, err) |
| 141 | + |
| 142 | + data, err := ioutil.ReadFile("/Users/sandyzhou/Downloads/abc.jpeg") // local file path |
| 143 | + if err != nil { |
| 144 | + panic(err) |
| 145 | + } |
| 146 | + tags := []types.Tag{ |
| 147 | + {Name: "Sender", Value: "Jie"}, |
| 148 | + {Name: "Data-Introduce", Value: "Happy anniversary, my google and dearest! I‘m so grateful to have you in my life. I love you to infinity and beyond! (⁎⁍̴̛ᴗ⁍̴̛⁎)"}, |
| 149 | + } |
| 150 | + tx, err := w.SendDataSpeedUp(data, tags, 10) |
| 151 | + assert.NoError(t, err) |
| 152 | + t.Logf("tx hash: %s", tx.ID) |
| 153 | +} |
| 154 | + |
| 155 | +func Test_LoadData(t *testing.T) { |
| 156 | + arCli := goar.NewClient("https://arweave.net") |
| 157 | + |
| 158 | + arId := "r90Z_PuhD-louq6uzLTI-xWMfB5TzIti30o7QvW-6A4" |
| 159 | + data, err := arCli.GetTransactionData(arId) |
| 160 | + assert.NoError(t, err) |
| 161 | + t.Log(len(data)) |
| 162 | +} |
0 commit comments