-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: decode contract type, added decode demo (#8)
* fix: decode contract type, added decode demo * roll back default * change demo decode tx to transfer * added error treatment
- Loading branch information
1 parent
aed35ee
commit 5c859a1
Showing
2 changed files
with
42 additions
and
1 deletion.
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,41 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/klever-io/klever-go-sdk/cmd/demo" | ||
"github.com/klever-io/klever-go-sdk/models" | ||
) | ||
|
||
func main() { | ||
|
||
accounts, wallets, kc, err := demo.InitWallets() | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
base := accounts[0].NewBaseTX() | ||
tx, err := kc.MultiTransfer( | ||
base, | ||
"KLV", | ||
[]models.ToAmount{{ | ||
ToAddress: accounts[1].Address().Bech32(), | ||
Amount: 1000, | ||
}}) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
err = tx.Sign(wallets[0]) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
decodedTx, err := kc.Decode(tx) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
fmt.Println("\n\n\nEncodedTX: ", tx) | ||
fmt.Println("\n\n\nDecodedTX: ", decodedTx) | ||
} |
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