We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
I'm using the below code for transferring the balance from alice to bob but facing the below issue:-
` func SendData(sign, data []byte) error { // This sample shows how to create a transaction to make a transfer from one an account to another.
// Instantiate the API api, err := gsrpc.NewSubstrateAPI(os.Getenv("B_HOST")) if err != nil { panic(err) } meta, err := api.RPC.State.GetMetadataLatest() if err != nil { panic(err) } // Create a call, transferring 12345 units to Bob bob, err := types.NewMultiAddressFromHexAccountID("0x8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48") if err != nil { panic(err) } // 1 unit of transfer bal, ok := new(big.Int).SetString("100000000000000", 10) if !ok { panic(fmt.Errorf("failed to convert balance")) } c, err := types.NewCall(meta, "Balances.dfs_transfer_keep_alive", bob, types.NewUCompact(bal)) if err != nil { panic(err) } // Create the extrinsic ext := types.NewExtrinsic(c) genesisHash, err := api.RPC.Chain.GetBlockHash(0) if err != nil { panic(err) } rv, err := api.RPC.State.GetRuntimeVersionLatest() if err != nil { panic(err) } key, err := types.CreateStorageKey(meta, "System", "Account", signature.TestKeyringPairAlice.PublicKey) if err != nil { panic(err) } var accountInfo types.AccountInfo ok, err = api.RPC.State.GetStorageLatest(key, &accountInfo) if err != nil || !ok { panic(err) } nonce := uint32(accountInfo.Nonce) o := types.SignatureOptions{ BlockHash: genesisHash, Era: types.ExtrinsicEra{IsMortalEra: false}, GenesisHash: genesisHash, Nonce: types.NewUCompactFromUInt(uint64(nonce)), SpecVersion: rv.SpecVersion, Tip: types.NewUCompactFromUInt(100), TransactionVersion: rv.TransactionVersion, } // Sign the transaction using Alice's default account err = ext.Sign(signature.TestKeyringPairAlice, o) if err != nil { panic(err) } // Send the extrinsic _, err = api.RPC.Author.SubmitExtrinsic(ext) if err != nil { panic(err) } fmt.Printf("Balance transferred from Alice to Bob: %v\n", bal.String())
} `
Code:1002 Message:"Verification Error: Runtime error: Execution failed: ApiError(FailedToConvertParameter { function: "validate_transaction", parameter: "tx", error: Error { cause: Some(Error { cause: None, desc: "unexpected first byte decoding Option" }), desc: "Could not decode ChargeAssetTxPayment::asset_id" } })"
How can i resolve this issue or what I'm doing wrong in above program snippet?
The text was updated successfully, but these errors were encountered:
Hi @puneetjindal3, this is most likely due to the fact that the signature options required in your case require more than a normal UCompact tip.
UCompact
Please refer to - https://github.com/centrifuge/go-substrate-rpc-client/blob/master/registry/retriever/extrinsic_retriever_live_test.go#L42 and try adjusting the SignatureOptions on your side accordingly.
SignatureOptions
Sorry, something went wrong.
No branches or pull requests
Hi,
I'm using the below code for transferring the balance from alice to bob but facing the below issue:-
`
func SendData(sign, data []byte) error {
// This sample shows how to create a transaction to make a transfer from one an account to another.
}
`
Code:1002
Message:"Verification Error: Runtime error: Execution failed: ApiError(FailedToConvertParameter { function: "validate_transaction", parameter: "tx", error: Error { cause: Some(Error { cause: None, desc: "unexpected first byte decoding Option" }), desc: "Could not decode ChargeAssetTxPayment::asset_id" } })"
How can i resolve this issue or what I'm doing wrong in above program snippet?
The text was updated successfully, but these errors were encountered: