-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added token_delete_transaction_test
- Loading branch information
1 parent
bbea5d5
commit 10ea1be
Showing
1 changed file
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package hedera | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"os" | ||
"testing" | ||
"time" | ||
) | ||
|
||
func TestTokenDeleteTransaction_Execute(t *testing.T) { | ||
var client *Client | ||
|
||
network := os.Getenv("HEDERA_NETWORK") | ||
|
||
if network == "previewnet" { | ||
client = ClientForPreviewnet() | ||
} | ||
|
||
var err error | ||
client, err = ClientFromJsonFile(os.Getenv("CONFIG_FILE")) | ||
|
||
if err != nil { | ||
client = ClientForTestnet() | ||
} | ||
|
||
client.SetMirrorNetwork([]string{"hcs.previewnet.mirrornode.hedera.com:5600"}) | ||
|
||
configOperatorID := os.Getenv("OPERATOR_ID") | ||
configOperatorKey := os.Getenv("OPERATOR_KEY") | ||
var operatorKey PrivateKey | ||
var operatorAccountID AccountID | ||
|
||
if configOperatorID != "" && configOperatorKey != "" { | ||
operatorAccountID, err = AccountIDFromString(configOperatorID) | ||
assert.NoError(t, err) | ||
|
||
operatorKey, err = PrivateKeyFromString(configOperatorKey) | ||
assert.NoError(t, err) | ||
|
||
client.SetOperator(operatorAccountID, operatorKey) | ||
} | ||
|
||
resp, err := NewTokenCreateTransaction(). | ||
SetName("ffff"). | ||
SetSymbol("F"). | ||
SetDecimals(3). | ||
SetInitialSupply(1000000). | ||
SetTreasury(operatorAccountID). | ||
SetAdminKey(operatorKey.PublicKey()). | ||
SetFreezeKey(operatorKey.PublicKey()). | ||
SetWipeKey(operatorKey.PublicKey()). | ||
SetKycKey(operatorKey.PublicKey()). | ||
SetSupplyKey(operatorKey.PublicKey()). | ||
SetFreezeDefault(false). | ||
SetExpirationTime(uint64(time.Now().Unix() + 86400*90)). | ||
Execute(client) | ||
assert.NoError(t, err) | ||
|
||
receipt, err := resp.GetReceipt(client) | ||
assert.NoError(t, err) | ||
|
||
tokenID := *receipt.TokenID | ||
|
||
resp, err = NewTokenDeleteTransaction(). | ||
SetNodeAccountIDs([]AccountID{resp.NodeID}). | ||
SetTokenID(tokenID). | ||
Execute(client) | ||
assert.NoError(t, err) | ||
|
||
_, err = resp.GetReceipt(client) | ||
assert.NoError(t, err) | ||
} |