本文整理汇总了Golang中github.com/tendermint/tendermint/account.Account.Code方法的典型用法代码示例。如果您正苦于以下问题:Golang Account.Code方法的具体用法?Golang Account.Code怎么用?Golang Account.Code使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/tendermint/tendermint/account.Account
的用法示例。
在下文中一共展示了Account.Code方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: testSNativeCALL
func testSNativeCALL(t *testing.T, expectPass bool, blockCache *BlockCache, doug *acm.Account, snativeAddress, data []byte, f func([]byte) error) {
if expectPass {
perm, err := ptypes.PermStringToFlag(TrimmedString(snativeAddress))
if err != nil {
t.Fatal(err)
}
doug.Permissions.Base.Set(perm, true)
}
var addr []byte
contractCode := callContractCode(snativeAddress)
doug.Code = contractCode
blockCache.UpdateAccount(doug)
addr = doug.Address
tx, _ := types.NewCallTx(blockCache, user[0].PubKey, addr, data, 100, 10000, 100)
tx.Sign(chainID, user[0])
fmt.Println("subscribing to", types.EventStringAccCall(snativeAddress))
ev, exception := execTxWaitEvent(t, blockCache, tx, types.EventStringAccCall(snativeAddress))
if exception == ExceptionTimeOut {
t.Fatal("Timed out waiting for event")
}
if expectPass {
if exception != "" {
t.Fatal("Unexpected exception", exception)
}
evv := ev.(types.EventDataCall)
ret := evv.Return
if err := f(ret); err != nil {
t.Fatal(err)
}
} else {
if exception == "" {
t.Fatal("Expected exception")
}
}
}