Skip to content

Commit

Permalink
transfer test
Browse files Browse the repository at this point in the history
  • Loading branch information
QuestofIranon committed Feb 26, 2020
1 parent 1a2435d commit 46fac02
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions crypto_transfer_transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package hedera
import (
"github.com/bradleyjkemp/cupaloy"
"github.com/stretchr/testify/assert"
"os"
"testing"
)

Expand All @@ -12,3 +13,24 @@ func TestSerializeCryptoTransferTransaction(t *testing.T) {

cupaloy.SnapshotT(t, tx.String())
}

func TestCryptoTransferTransaction_Execute(t *testing.T) {
operatorAccountID, err := AccountIDFromString(os.Getenv("OPERATOR_ID"))
assert.NoError(t, err)

operatorPrivateKey, err := Ed25519PrivateKeyFromString(os.Getenv("OPERATOR_KEY"))
assert.NoError(t, err)

client := ClientForTestnet().
SetOperator(operatorAccountID, operatorPrivateKey)

txID, err := NewCryptoTransferTransaction().
AddSender(operatorAccountID, NewHbar(1)).
AddRecipient(AccountID{Account: 3}, NewHbar(1)).
SetMaxTransactionFee(NewHbar(1)).
Execute(client)
assert.NoError(t, err)

_, err = txID.GetReceipt(client)
assert.NoError(t, err)
}

0 comments on commit 46fac02

Please sign in to comment.