You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.
Hi, I'm trying to decode an StdTx obtained from a node using the go-sdk for the Binance Chain. The StdTx is encoded so using codec.UnmarshalBinaryLengthPrefixed I'm able to decode it to an str json (following this example: bnb-chain/node-binary#53). Now I'm trying to code my own function to decode the tx (to read the outputs of a transaction on a system where I can't use UnmarshalBinaryLengthPrefixed or any library).
The Output struct looks like this:
type AccAddress []byte
// Coin def
type Coin struct {
Denom string `json:"denom"`
Amount int64 `json:"amount"`
}
// Coins def
type Coins []Coin
// Transaction Output
type Output struct {
Address AccAddress `json:"address"`
Coins Coins `json:"coins"`
}
I have managed to decode the Amount (int64) and the Denom (string) but I have difficulty understanding how the Address ([]byte) is decoded.
Looking into the function that is called to decode it I can see the following steps:
Initially I have:
https://github.com/binance-chain/bnc-go-amino/blob/b3a81203066cc46107dcf5e2ae6d78260ccc7c5a/binary-decode.go#L559
Hi, I'm trying to decode an StdTx obtained from a node using the go-sdk for the Binance Chain. The StdTx is encoded so using codec.UnmarshalBinaryLengthPrefixed I'm able to decode it to an str json (following this example: bnb-chain/node-binary#53). Now I'm trying to code my own function to decode the tx (to read the outputs of a transaction on a system where I can't use UnmarshalBinaryLengthPrefixed or any library).
The Output struct looks like this:
I have managed to decode the Amount (int64) and the Denom (string) but I have difficulty understanding how the Address ([]byte) is decoded.
Looking into the function that is called to decode it I can see the following steps:
Initially I have:
Then is called DecodeByteSlice(bz) and returns:
Then is called rv.Set(reflect.ValueOf(byteslice)) and I got in rv the Address decoded:
I don't understand how from byteslice I can obtain the final value of rv.
Can someone help me or guide me? I appreciate any response. Thanks in advance
The text was updated successfully, but these errors were encountered: