EOS.IO Go API library
BlockTimestampFormat
to blockTimestampFormat
making it private.BREAKING: We started adding an initial context.Context
to all interruptible functions. All method performing an HTTP call have the new parameter as well as a bunch of other method. We cannot list all of them. If the caller already have a context.Context
value, pass it to the function that now require one. Otherwise, simply pass context.Background()
.
BREAKING: Fixed binary unpacking of BlockState
, TransactionTrace
, SignedTransaction
, Action
(and some inner types). This required changing a few struct fields to better fit with EOSIO definition, here the full list:
MerkleRoot.ActiveNodes
is now a []Checksum256
, was previously []string
MerkleRoot.NodeCount
is now a uint64
, was previously uint32
Type EOSNameOrUint32
has been removed and replaced by PairAccountNameBlockNum
which is strictly typed now.
BlockState.ProducerToLastProduced
is now []PairAccountNameBlockNum
, was previously [][2]EOSNameOrUint32
.
BlockState.ProducerToLastImpliedIRB
is now []PairAccountNameBlockNum
, was previously [][2]EOSNameOrUint32
.
BlockState.BlockID
is now a Checksum256
, was previously string
.
BlockState.ActivatedProtocolFeatures
is now a *ProtocolFeatureActivationSet
, was previously map[string][]HexBytes
.
BlockState.ConfirmCount
is now a []uint8
, was previously []uint32
.
PendingSchedule.ScheduleHash
is now a Checksum256
, was previously HexBytes
.
ActionTraceReceipt.ActionDigest
is now a Checksum256
, was previously string
.
ActionTraceReceipt.CodeSequence
is now a Varuint32
, was previously Uint64
.
ActionTraceReceipt.ABISequence
is now a Varuint32
, was previously Uint64
.
ActionTrace.ActionOrdinal
is now a Varuint32
, was previously uint32
.
ActionTrace.CreatorActionOrdinal
is now a Varuint32
, was previously uint32
.
ActionTrace.ClosestUnnotifiedAncestorActionOrdinal
is now a Varuint32
, was previously uint32
.
Except.Code
is now a Int64
, was previously int
.
ExceptLogContext.Level
is now a ExceptLogLevel
, was previously string
.
ExceptLogContext.Line
is now a uint64
, was previously int
.
Note While those are flagged as breaking change to augment the visibility, they are really bug fixes to fit with the behavior of nodeos
directly.
BREAKING: The decoding for ABI variant
was not returning the correct json
representation. Now ABI variant
is returned as a two elements array, the first element being the variant
type name as a string
and the second the actual value as JSON. For example, assuming a variant
type defined as game_type: ["string", "uint32"]
, and a field
of type game_type
, before, the JSON serialization would have looked like {"field":"some_string"}
or {"field":100}
while after the change, it will get serialized to the correct form {"field":["string", "some_string"]}
or {"field":["uint32", 100]}
.
Note While this is flagged as breaking change to augment the visibility, this is really a bug fix to fit with the behavior of nodeos
directly.
BREAKING: The serialization for ExtendedAsset
was aligned with the eos
codebase. Beforehand, it would serialize the field name "Contract"
with a capital C
, and the Asset
field as "asset"
where it should have been "quantity"
.
BREAKING: Renamed ConsoleLog
to SafeString
for better re-usability in the codebase.
NameToString
(~230%
) method.TimePoint
will decode with 0
nanoseconds, when the fitNodeos
flag is set on the ABI.int128
and uint128
in decimal format when fitNodeos
flag is set on the ABIarrays
in ABI decoder.BlockState.Header
field of type SignedBlockHeader
that was previously missing from the struct definition.BlockState.AdditionalSignatures
field of type []ecc.Signature
that was previously missing from the struct definition.ActionTrace.ContextFree
field of type bool
that was previously missing from the struct definition.streamingfast/logging
and its trace enabled support.fmt.Errorf("...: %w", ..., err)
which is standard now in Go.Optional encoding of primitive types.
A struct with a non-pointer type tagged with eos:"optional"
is now properly encoded at the binary level. Important that means that for non-pointer type, when the value of the type is the "emtpy" value according to Golang rules, it will be written as not-present at the binary level. If it's something that you do want want, use a pointer to a primitive type. It's actually a good habit to use a pointer type for "optional" element anyway, to increase awarness.
Fix json tags for delegatebw action data.
Unpacking binary Except
now correctly works.
Unpacking binary Action
and ActionTrace
now correctly works.
Unpacking binary TransactionTrace
now correctly works.
Unpacking binary TransactionReceipt
type will now correctly set the inner TransactionWithID.ID
field correctly.
Unpacking binary BlockState
now correctly works but is restricted to EOSIO 2.0.x version.
AccountRAMDelta
to AccountDelta
which is the correct name in EOSIO.JSONFloat64
to Float64
, to follow the same convention that was changed years ago with Uint64
, etc. Type alias left for backwards compatibility.String()
method to TimePoint
and TimePointSec
EncodeTable
and Encode
(any valid struct)get_accounts_by_authorizers
.map<string, string>
action typesfmt.Errorf("...: %w", ..., err)
which is standard now in Goexpected_core_symbol
when calling /v1/chain/get_account
RPC call via client.GetAccount
context.Context
as a first parameter, to allow for cancellation to propagate to long calls (or stalling calls on nodes that are overloaded).AccountRAMDelta
which is not the right name used in EOSIOBlockState
ConfirmedCount
not of the right type, should have been a []uint8
MaxUint8
*Uint64
typesToNative
when encountering a int64
type idNameToString
nodeos
typesDecimalString
and MarshalJSON
implementationbnet
subpackage. Deprecated upstream, never used.omitempty
on AccountRAMDeltas
of TransactionTrace
String
implementationuint8[]
that is not needed anymoreeos
codebase.Bool
was aligned with the eos
codebase. Beforehand, it would serialize the value as "true /false"
where it should have been "0 / 1"
.context.Context
value).null
when field is mark as optional and value not presentThis release add support for ESIO 2.0 features, mainly WebAuthN keys support (no signing though) and WTMSIG_BLOCK_SIGNATURES
protocol feature that brings incompatibilities in the model layer when activated.
The v0.9.0 release add supports for that. We had to break compatibility of the type and field names in some base model present in the library. This was the occasion to make other "small" removal of some types that are not required anymore with the some small API changes of the EOSIO binary format decoder. Expect more structural changes to come in this area.
We renamed all fields that require logic changes from your code so you know quickly due to compilation errors that you need to handle some fields differently now.
Some fields were renamed and deprecated also, see Deprecation Notices section for further details.
The ecc
package has been upgraded to support WebAuthN key in EOSIO model. This supports add the following things:
CurveID
of type WA
PUB_WA_
keys from EOSIOSIG_WA_
keys from EOSIOPUB_WA_
format to ecdsa.PublicKey
(recovery of Y
curve point from compressed PUB_WA_
public key form).We now support all the models updates required for WTMSIG_BLOCK_SIGNATURES
protocol.
The WTMSIG_BLOCK_SIGNATURES
enable block to be signed by more than a single key. When this protocol feature is activated, the block can be signed by multiple key, using a key with some weights and a threshold to reach, must like standard EOS permission.
This means that once activated, models for block signing and schedule are now different to support the new feature.
Here the list of changes that occurred, usually, more explanation can be found in the eos-go#p2ptypes.go file directly.
BlockSigningKey
in BlockState
has been renamed to BlockSigningKeyV1
and now a *ecc.PublicKey
This field can now be nil
, which is the case after WTMSIG_BLOCK_SIGNATURES
activation.
blockState.BlockSigningKey
now
if blockState.BlockSigningKeyV1 != nil {
// Deal with EOSIO 1.x model
...
}
ValidBlockSigningAuthorityV2
has been added to BlockState
This replaces old BlockSigningKey
and is of type BlockSigningAuthority
.
ActiveSchedule
in BlockState
is now of type *ProducerScheduleOrAuthoritySchedule
This new type contains both a V1
field (of type ProducerSchedule
) and a V2
field (of type ProducerAuthoritySchedule
). Old code that rely on ActiveSchedule
now must deal with either ActiveSchedule.V1
(old format) or ActiveSchedule.V2
(new format)
Important There is an ambiguity when deciding about the type the field active_schedule
can take since structure can be identical: {version:0, producers:[]}
and {version:0,producers:[]}
. This means both V1
and V2
field can be present at the same time. This is not a problem when serializing back to JSON since they represent the same JSON, but something you must be aware when doing your conditions around this new type as V1 != nil && V2 != nil == true
in some circumstances. The value could be discriminated by checking if ActivatedProtocolFeatures
contains the correct feature, it's something we suggest implementer to do in their own code for now, but it's in discussion for a direct usage in eos-go library.
blockState.ActiveSchedule
now
if blockState.ActiveSchedule.V1 != nil {
// Old format model or indistinguishable from `ProducerAuthoritySchedule`
}
if blockState.ActivateSchedule.V2 != nil {
// New format model or indistinguishable from `ProducerAuthoritySchedule`
}
PendingSchedule.Schedule
is now of type *ProducerScheduleOrAuthoritySchedule
Same logic as ActiveProducer
changes above, but apply to the PendingSchedule
type.
BlockHeader
NewProducers
has been renamed NewProducersV1
.EOSIO 2.x does not have this field and has been replaced by a block header extension. Also, we changed how EOSIO binary optional value are handled throughout the library and removed the OptionalProducerSchedule
type, you now have a direct ProducerSchedule
field instead.
When the WTMSIG_BLOCK_SIGNATURES
will be activated, this field will never be populated anymore and must not be used anymore.
The new producers should now be extracted from the BlockHeader.HeaderExtensions
field. The library added supported for some know EOSIO BlockHeaderExtension
.
A block header extension contains a payload, when the producer_schedule_change_extension
block header extension is present, it means we are dealing with a new set of producers, as such, replacing the old BlockHeader.NewProducers
field.
if blockHeader.NewProducers != nil {
}
now
if blockHeader.NewProducersV1 != nil {
// Old format
}
OR
for _, e := range blockHeader.HeaderExtensions {
if e.Type == uint16(eos.EOS_ProducerScheduleChangeExtension) {
extension, err := e.AsBlockHeaderExtension("EOS")
if err != nil { ... }
// New format
scheduleChange := extension.(*eos.ProducerScheduleChangeExtension)
scheduleChange.Version
scheduleChange.Producers
}
}
GoAwayCrazy
enum for GoAwayReason
typeThis field was not defined in EOSIO software, as such, it was removed. If you were relying on this field to be set, you will need to adapt your code to use another one.
Those field were renamed to be in sync with other Golang fields. You should simply use the new field name. Those will be removed in a next major bump.
eos.TypeSize.UInt8
to eos.TypeSize.Uint8
eos.TypeSize.UInt16
to eos.TypeSize.Uint16
eos.TypeSize.UInt32
to eos.TypeSize.Uint32
eos.TypeSize.UInt64
to eos.TypeSize.Uint64
eos.TypeSize.UInt128
to eos.TypeSize.Uint128
eos.Decoder.ReadUInt8
to eos.Decoder.ReadUint8
pkgerrors.Wrap
error (ea8d35de13de2e2119cdeb6e359d291257131b0c)fix incompatibility with eos-js
Added support for following nodeos
RPC calls
get_table_by_scope
get_raw_abi
get_currency_stats
Other changes
Blob
type support