Comments (2)
https://github.com/eoscanada/eos-go/blob/develop/example_api_transfer_eos_test.go#L38 shows a transfer action, should be a good starting point.
Provide an example and I could help further.
from eos-go.
The code I'm using:
transferPermissionLevel, err := eos.NewPermissionLevel(from + "@active")
if err != nil {
panic("Error creating permission level")
}
// Fills in the transaction header information like ref block, delays and expiration is set to 30s
txOpts := &eos.TxOptions{}
err = txOpts.FillFromChain(context.Background(), api)
if err != nil {
panic("Error filling tx options")
}
trx := eos.NewTransaction([]*eos.Action{
{
Account: eos.AN(contractName), // The contract that will execute the action
Name: eos.ActN("addopname"), // The action name
Authorization: []eos.PermissionLevel{transferPermissionLevel},
ActionData: eos.NewActionData(OperationNamePost{
op_id: 1, //eos.Uint64
op_name: "aaa", //string
fields: fields, //[]string
types: types, //[]string
offchain_data: eos.Checksum256{}, //eos.Checksum256
}),
},
}, txOpts)
// keyBag := eos.NewKeyBag()
keyBag := &eos.KeyBag{}
err = keyBag.ImportPrivateKey(context.Background(), fromPrivateKey)
if err != nil {
panic(fmt.Errorf("import private key: %w", err))
}
api.SetSigner(keyBag)
_, packedTx, err := api.SignTransaction(context.Background(), trx, txOpts.ChainID, eos.CompressionNone)
if err != nil {
panic(fmt.Errorf("sign transaction: %w", err))
}
response, err := api.PushTransaction(context.Background(), packedTx)
if err != nil {
panic(fmt.Errorf("push transaction: %w", err))
}
fmt.Printf("Transaction [%s] submitted to the network succesfully.\n", hex.EncodeToString(response.Processed.ID))
and the error I'm getting is this:
sign transaction: get_required_keys: Internal Service Error: Invalid packed transaction: Failed to deserialize data for dopcontract:addopname: Failed to deserialize variant: Invalid transaction
Also, the struct i use for the transaction, have the fields and types that are in the transaction object.
I was following this example (link) but i have made some changes looking others examples.
Thanks in advance.
from eos-go.
Related Issues (20)
- run demo code ,an error happend when download streamingfast HOT 1
- Got an error when trying to import PVT_K1 format private key HOT 17
- how to push actions with raw json data? HOT 2
- {"code":500,"message":"Internal Service Error","error":{"code":3050003,"name":"eosio_assert_message_exception","what":"eosio_assert_message assertion failure","details":[{"message":"assertion failure with message: Cannot wear this item at the moment","file":"cf_system.cpp","line_number":14,"method":"eosio_assert"}]}} HOT 1
- get_actions result unmarsha into Go struct ActionsResp error
- The "next_key" field is missing in the GetTable rows API response HOT 2
- How to implement custom actions ,How to get serializetransaction,(PVT_K1 )Unable to verify, output public key does not match HOT 1
- (PVT_K1 )Unable to verify, output public key does not match HOT 5
- How to get serializetransaction?eosjs: api.serializeTransaction(sTransaction) HOT 1
- How to implement custom actions? HOT 1
- How to use the symbol is wax or other, and there are digits
- How to be a maintainer with merge permission HOT 3
- Pack action data issue after compiling contract with the Leap CDT 3.0.1 HOT 5
- Update `/v1/chain/push_transaction` expected response structure HOT 3
- Transaction Signing Issue with Custom Variant Definition HOT 8
- ecc.PublicKey is not string HOT 6
- /get_block does not get to the previous blocks HOT 2
- ecc privatekey signature error HOT 2
- There should be a powerup update for calculations. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eos-go.