Skip to content

Commit 6ada453

Browse files
DaughterOfMarsCopilotthibault-martinez
authored
fix(ffi): Use strings for Epoch datetimes in FFI (#1081)
* fix(ffi): Use strings for Epoch datetimes in FFI Co-authored-by: Copilot <[email protected]> * update bindings and comment Co-authored-by: Copilot <[email protected]> * oops * clippy * clippy --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Thibault Martinez <[email protected]>
1 parent a269e50 commit 6ada453

6 files changed

Lines changed: 71 additions & 65 deletions

File tree

bindings/csharp/src/IotaSdk/IotaSdk.cs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50969,7 +50969,8 @@ public override void Write(EndOfEpochData value, BigEndianStream stream) {
5096950969
/// by one at every epoch change.
5097050970
/// </param>
5097150971
/// <param name="start_timestamp">
50972-
/// The epoch's starting timestamp.
50972+
/// The epoch's starting timestamp. RFC3339 in UTC with format:
50973+
/// YYYY-MM-DDTHH:MM:SS.mmmZ
5097350974
/// </param>
5097450975
/// <param name="fund_inflow">
5097550976
/// The storage fees paid for transactions executed during the epoch.
@@ -51002,7 +51003,7 @@ public override void Write(EndOfEpochData value, BigEndianStream stream) {
5100251003
/// </param>
5100351004
/// <param name="end_timestamp">
5100451005
/// The epoch's ending timestamp. Note that this is available only on epochs
51005-
/// that have ended.
51006+
/// that have ended. RFC3339 in UTC with format: YYYY-MM-DDTHH:MM:SS.mmmZ
5100651007
/// </param>
5100751008
/// <param name="system_state_version">
5100851009
/// The value of the `version` field of `0x5`, the
@@ -51040,9 +51041,10 @@ public record Epoch (
5104051041
/// </summary>
5104151042
ulong @epochId,
5104251043
/// <summary>
51043-
/// The epoch's starting timestamp.
51044+
/// The epoch's starting timestamp. RFC3339 in UTC with format:
51045+
/// YYYY-MM-DDTHH:MM:SS.mmmZ
5104451046
/// </summary>
51045-
ulong @startTimestamp,
51047+
string @startTimestamp,
5104651048
/// <summary>
5104751049
/// The storage fees paid for transactions executed during the epoch.
5104851050
/// </summary>
@@ -51081,9 +51083,9 @@ public record Epoch (
5108151083
string? @referenceGasPrice = null,
5108251084
/// <summary>
5108351085
/// The epoch's ending timestamp. Note that this is available only on epochs
51084-
/// that have ended.
51086+
/// that have ended. RFC3339 in UTC with format: YYYY-MM-DDTHH:MM:SS.mmmZ
5108551087
/// </summary>
51086-
ulong? @endTimestamp = null,
51088+
string? @endTimestamp = null,
5108751089
/// <summary>
5108851090
/// The value of the `version` field of `0x5`, the
5108951091
/// `0x3::iota::IotaSystemState` object. This version changes whenever
@@ -51149,8 +51151,8 @@ public override Epoch Read(BigEndianStream stream) {
5114951151
@netInflow: FfiConverterOptionalString.INSTANCE.Read(stream),
5115051152
@protocolConfigs: FfiConverterOptionalTypeProtocolConfigs.INSTANCE.Read(stream),
5115151153
@referenceGasPrice: FfiConverterOptionalString.INSTANCE.Read(stream),
51152-
@startTimestamp: FfiConverterUInt64.INSTANCE.Read(stream),
51153-
@endTimestamp: FfiConverterOptionalUInt64.INSTANCE.Read(stream),
51154+
@startTimestamp: FfiConverterString.INSTANCE.Read(stream),
51155+
@endTimestamp: FfiConverterOptionalString.INSTANCE.Read(stream),
5115451156
@systemStateVersion: FfiConverterOptionalUInt64.INSTANCE.Read(stream),
5115551157
@totalCheckpoints: FfiConverterOptionalUInt64.INSTANCE.Read(stream),
5115651158
@totalGasFees: FfiConverterOptionalString.INSTANCE.Read(stream),
@@ -51170,8 +51172,8 @@ public override int AllocationSize(Epoch value) {
5117051172
+ FfiConverterOptionalString.INSTANCE.AllocationSize(value.@netInflow)
5117151173
+ FfiConverterOptionalTypeProtocolConfigs.INSTANCE.AllocationSize(value.@protocolConfigs)
5117251174
+ FfiConverterOptionalString.INSTANCE.AllocationSize(value.@referenceGasPrice)
51173-
+ FfiConverterUInt64.INSTANCE.AllocationSize(value.@startTimestamp)
51174-
+ FfiConverterOptionalUInt64.INSTANCE.AllocationSize(value.@endTimestamp)
51175+
+ FfiConverterString.INSTANCE.AllocationSize(value.@startTimestamp)
51176+
+ FfiConverterOptionalString.INSTANCE.AllocationSize(value.@endTimestamp)
5117551177
+ FfiConverterOptionalUInt64.INSTANCE.AllocationSize(value.@systemStateVersion)
5117651178
+ FfiConverterOptionalUInt64.INSTANCE.AllocationSize(value.@totalCheckpoints)
5117751179
+ FfiConverterOptionalString.INSTANCE.AllocationSize(value.@totalGasFees)
@@ -51189,8 +51191,8 @@ public override void Write(Epoch value, BigEndianStream stream) {
5118951191
FfiConverterOptionalString.INSTANCE.Write(value.@netInflow, stream);
5119051192
FfiConverterOptionalTypeProtocolConfigs.INSTANCE.Write(value.@protocolConfigs, stream);
5119151193
FfiConverterOptionalString.INSTANCE.Write(value.@referenceGasPrice, stream);
51192-
FfiConverterUInt64.INSTANCE.Write(value.@startTimestamp, stream);
51193-
FfiConverterOptionalUInt64.INSTANCE.Write(value.@endTimestamp, stream);
51194+
FfiConverterString.INSTANCE.Write(value.@startTimestamp, stream);
51195+
FfiConverterOptionalString.INSTANCE.Write(value.@endTimestamp, stream);
5119451196
FfiConverterOptionalUInt64.INSTANCE.Write(value.@systemStateVersion, stream);
5119551197
FfiConverterOptionalUInt64.INSTANCE.Write(value.@totalCheckpoints, stream);
5119651198
FfiConverterOptionalString.INSTANCE.Write(value.@totalGasFees, stream);

bindings/go/iota_sdk/iota_sdk.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35269,11 +35269,12 @@ type Epoch struct {
3526935269
// The minimum gas price that a quorum of validators are guaranteed to sign
3527035270
// a transaction for.
3527135271
ReferenceGasPrice *string
35272-
// The epoch's starting timestamp.
35273-
StartTimestamp uint64
35272+
// The epoch's starting timestamp. RFC3339 in UTC with format:
35273+
// YYYY-MM-DDTHH:MM:SS.mmmZ
35274+
StartTimestamp string
3527435275
// The epoch's ending timestamp. Note that this is available only on epochs
35275-
// that have ended.
35276-
EndTimestamp *uint64
35276+
// that have ended. RFC3339 in UTC with format: YYYY-MM-DDTHH:MM:SS.mmmZ
35277+
EndTimestamp *string
3527735278
// The value of the `version` field of `0x5`, the
3527835279
// `0x3::iota::IotaSystemState` object. This version changes whenever
3527935280
// the fields contained in the system state object (held in a dynamic
@@ -35303,8 +35304,8 @@ func (r *Epoch) Destroy() {
3530335304
FfiDestroyerOptionalString{}.Destroy(r.NetInflow);
3530435305
FfiDestroyerOptionalProtocolConfigs{}.Destroy(r.ProtocolConfigs);
3530535306
FfiDestroyerOptionalString{}.Destroy(r.ReferenceGasPrice);
35306-
FfiDestroyerUint64{}.Destroy(r.StartTimestamp);
35307-
FfiDestroyerOptionalUint64{}.Destroy(r.EndTimestamp);
35307+
FfiDestroyerString{}.Destroy(r.StartTimestamp);
35308+
FfiDestroyerOptionalString{}.Destroy(r.EndTimestamp);
3530835309
FfiDestroyerOptionalUint64{}.Destroy(r.SystemStateVersion);
3530935310
FfiDestroyerOptionalUint64{}.Destroy(r.TotalCheckpoints);
3531035311
FfiDestroyerOptionalString{}.Destroy(r.TotalGasFees);
@@ -35331,8 +35332,8 @@ func (c FfiConverterEpoch) Read(reader io.Reader) Epoch {
3533135332
FfiConverterOptionalStringINSTANCE.Read(reader),
3533235333
FfiConverterOptionalProtocolConfigsINSTANCE.Read(reader),
3533335334
FfiConverterOptionalStringINSTANCE.Read(reader),
35334-
FfiConverterUint64INSTANCE.Read(reader),
35335-
FfiConverterOptionalUint64INSTANCE.Read(reader),
35335+
FfiConverterStringINSTANCE.Read(reader),
35336+
FfiConverterOptionalStringINSTANCE.Read(reader),
3533635337
FfiConverterOptionalUint64INSTANCE.Read(reader),
3533735338
FfiConverterOptionalUint64INSTANCE.Read(reader),
3533835339
FfiConverterOptionalStringINSTANCE.Read(reader),
@@ -35359,8 +35360,8 @@ func (c FfiConverterEpoch) Write(writer io.Writer, value Epoch) {
3535935360
FfiConverterOptionalStringINSTANCE.Write(writer, value.NetInflow);
3536035361
FfiConverterOptionalProtocolConfigsINSTANCE.Write(writer, value.ProtocolConfigs);
3536135362
FfiConverterOptionalStringINSTANCE.Write(writer, value.ReferenceGasPrice);
35362-
FfiConverterUint64INSTANCE.Write(writer, value.StartTimestamp);
35363-
FfiConverterOptionalUint64INSTANCE.Write(writer, value.EndTimestamp);
35363+
FfiConverterStringINSTANCE.Write(writer, value.StartTimestamp);
35364+
FfiConverterOptionalStringINSTANCE.Write(writer, value.EndTimestamp);
3536435365
FfiConverterOptionalUint64INSTANCE.Write(writer, value.SystemStateVersion);
3536535366
FfiConverterOptionalUint64INSTANCE.Write(writer, value.TotalCheckpoints);
3536635367
FfiConverterOptionalStringINSTANCE.Write(writer, value.TotalGasFees);

bindings/kotlin/lib/iota_sdk/iota_sdk.kt

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55169,14 +55169,15 @@ data class Epoch (
5516955169
*/
5517055170
var `referenceGasPrice`: kotlin.String? = null,
5517155171
/**
55172-
* The epoch's starting timestamp.
55172+
* The epoch's starting timestamp. RFC3339 in UTC with format:
55173+
* YYYY-MM-DDTHH:MM:SS.mmmZ
5517355174
*/
55174-
var `startTimestamp`: kotlin.ULong,
55175+
var `startTimestamp`: kotlin.String,
5517555176
/**
5517655177
* The epoch's ending timestamp. Note that this is available only on epochs
55177-
* that have ended.
55178+
* that have ended. RFC3339 in UTC with format: YYYY-MM-DDTHH:MM:SS.mmmZ
5517855179
*/
55179-
var `endTimestamp`: kotlin.ULong? = null,
55180+
var `endTimestamp`: kotlin.String? = null,
5518055181
/**
5518155182
* The value of the `version` field of `0x5`, the
5518255183
* `0x3::iota::IotaSystemState` object. This version changes whenever
@@ -55249,8 +55250,8 @@ public object FfiConverterTypeEpoch: FfiConverterRustBuffer<Epoch> {
5524955250
FfiConverterOptionalString.read(buf),
5525055251
FfiConverterOptionalTypeProtocolConfigs.read(buf),
5525155252
FfiConverterOptionalString.read(buf),
55252-
FfiConverterULong.read(buf),
55253-
FfiConverterOptionalULong.read(buf),
55253+
FfiConverterString.read(buf),
55254+
FfiConverterOptionalString.read(buf),
5525455255
FfiConverterOptionalULong.read(buf),
5525555256
FfiConverterOptionalULong.read(buf),
5525655257
FfiConverterOptionalString.read(buf),
@@ -55269,8 +55270,8 @@ public object FfiConverterTypeEpoch: FfiConverterRustBuffer<Epoch> {
5526955270
FfiConverterOptionalString.allocationSize(value.`netInflow`) +
5527055271
FfiConverterOptionalTypeProtocolConfigs.allocationSize(value.`protocolConfigs`) +
5527155272
FfiConverterOptionalString.allocationSize(value.`referenceGasPrice`) +
55272-
FfiConverterULong.allocationSize(value.`startTimestamp`) +
55273-
FfiConverterOptionalULong.allocationSize(value.`endTimestamp`) +
55273+
FfiConverterString.allocationSize(value.`startTimestamp`) +
55274+
FfiConverterOptionalString.allocationSize(value.`endTimestamp`) +
5527455275
FfiConverterOptionalULong.allocationSize(value.`systemStateVersion`) +
5527555276
FfiConverterOptionalULong.allocationSize(value.`totalCheckpoints`) +
5527655277
FfiConverterOptionalString.allocationSize(value.`totalGasFees`) +
@@ -55288,8 +55289,8 @@ public object FfiConverterTypeEpoch: FfiConverterRustBuffer<Epoch> {
5528855289
FfiConverterOptionalString.write(value.`netInflow`, buf)
5528955290
FfiConverterOptionalTypeProtocolConfigs.write(value.`protocolConfigs`, buf)
5529055291
FfiConverterOptionalString.write(value.`referenceGasPrice`, buf)
55291-
FfiConverterULong.write(value.`startTimestamp`, buf)
55292-
FfiConverterOptionalULong.write(value.`endTimestamp`, buf)
55292+
FfiConverterString.write(value.`startTimestamp`, buf)
55293+
FfiConverterOptionalString.write(value.`endTimestamp`, buf)
5529355294
FfiConverterOptionalULong.write(value.`systemStateVersion`, buf)
5529455295
FfiConverterOptionalULong.write(value.`totalCheckpoints`, buf)
5529555296
FfiConverterOptionalString.write(value.`totalGasFees`, buf)

bindings/python/lib/iota_sdk.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17260,15 +17260,16 @@ class Epoch:
1726017260
a transaction for.
1726117261
"""
1726217262

17263-
start_timestamp: "int"
17263+
start_timestamp: "str"
1726417264
"""
17265-
The epoch's starting timestamp.
17265+
The epoch's starting timestamp. RFC3339 in UTC with format:
17266+
YYYY-MM-DDTHH:MM:SS.mmmZ
1726617267
"""
1726717268

17268-
end_timestamp: "typing.Optional[int]"
17269+
end_timestamp: "typing.Optional[str]"
1726917270
"""
1727017271
The epoch's ending timestamp. Note that this is available only on epochs
17271-
that have ended.
17272+
that have ended. RFC3339 in UTC with format: YYYY-MM-DDTHH:MM:SS.mmmZ
1727217273
"""
1727317274

1727417275
system_state_version: "typing.Optional[int]"
@@ -17307,7 +17308,7 @@ class Epoch:
1730717308
of the epoch.
1730817309
"""
1730917310

17310-
def __init__(self, *, epoch_id: "int", fund_inflow: "typing.Optional[str]" = _DEFAULT, fund_outflow: "typing.Optional[str]" = _DEFAULT, fund_size: "typing.Optional[str]" = _DEFAULT, live_object_set_digest: "typing.Optional[str]" = _DEFAULT, net_inflow: "typing.Optional[str]" = _DEFAULT, protocol_configs: "typing.Optional[ProtocolConfigs]" = _DEFAULT, reference_gas_price: "typing.Optional[str]" = _DEFAULT, start_timestamp: "int", end_timestamp: "typing.Optional[int]" = _DEFAULT, system_state_version: "typing.Optional[int]" = _DEFAULT, total_checkpoints: "typing.Optional[int]" = _DEFAULT, total_gas_fees: "typing.Optional[str]" = _DEFAULT, total_stake_rewards: "typing.Optional[str]" = _DEFAULT, total_transactions: "typing.Optional[int]" = _DEFAULT, validator_set: "typing.Optional[ValidatorSet]" = _DEFAULT):
17311+
def __init__(self, *, epoch_id: "int", fund_inflow: "typing.Optional[str]" = _DEFAULT, fund_outflow: "typing.Optional[str]" = _DEFAULT, fund_size: "typing.Optional[str]" = _DEFAULT, live_object_set_digest: "typing.Optional[str]" = _DEFAULT, net_inflow: "typing.Optional[str]" = _DEFAULT, protocol_configs: "typing.Optional[ProtocolConfigs]" = _DEFAULT, reference_gas_price: "typing.Optional[str]" = _DEFAULT, start_timestamp: "str", end_timestamp: "typing.Optional[str]" = _DEFAULT, system_state_version: "typing.Optional[int]" = _DEFAULT, total_checkpoints: "typing.Optional[int]" = _DEFAULT, total_gas_fees: "typing.Optional[str]" = _DEFAULT, total_stake_rewards: "typing.Optional[str]" = _DEFAULT, total_transactions: "typing.Optional[int]" = _DEFAULT, validator_set: "typing.Optional[ValidatorSet]" = _DEFAULT):
1731117312
self.epoch_id = epoch_id
1731217313
if fund_inflow is _DEFAULT:
1731317314
self.fund_inflow = None
@@ -17417,8 +17418,8 @@ def read(buf):
1741717418
net_inflow=_UniffiConverterOptionalString.read(buf),
1741817419
protocol_configs=_UniffiConverterOptionalTypeProtocolConfigs.read(buf),
1741917420
reference_gas_price=_UniffiConverterOptionalString.read(buf),
17420-
start_timestamp=_UniffiConverterUInt64.read(buf),
17421-
end_timestamp=_UniffiConverterOptionalUInt64.read(buf),
17421+
start_timestamp=_UniffiConverterString.read(buf),
17422+
end_timestamp=_UniffiConverterOptionalString.read(buf),
1742217423
system_state_version=_UniffiConverterOptionalUInt64.read(buf),
1742317424
total_checkpoints=_UniffiConverterOptionalUInt64.read(buf),
1742417425
total_gas_fees=_UniffiConverterOptionalString.read(buf),
@@ -17437,8 +17438,8 @@ def check_lower(value):
1743717438
_UniffiConverterOptionalString.check_lower(value.net_inflow)
1743817439
_UniffiConverterOptionalTypeProtocolConfigs.check_lower(value.protocol_configs)
1743917440
_UniffiConverterOptionalString.check_lower(value.reference_gas_price)
17440-
_UniffiConverterUInt64.check_lower(value.start_timestamp)
17441-
_UniffiConverterOptionalUInt64.check_lower(value.end_timestamp)
17441+
_UniffiConverterString.check_lower(value.start_timestamp)
17442+
_UniffiConverterOptionalString.check_lower(value.end_timestamp)
1744217443
_UniffiConverterOptionalUInt64.check_lower(value.system_state_version)
1744317444
_UniffiConverterOptionalUInt64.check_lower(value.total_checkpoints)
1744417445
_UniffiConverterOptionalString.check_lower(value.total_gas_fees)
@@ -17456,8 +17457,8 @@ def write(value, buf):
1745617457
_UniffiConverterOptionalString.write(value.net_inflow, buf)
1745717458
_UniffiConverterOptionalTypeProtocolConfigs.write(value.protocol_configs, buf)
1745817459
_UniffiConverterOptionalString.write(value.reference_gas_price, buf)
17459-
_UniffiConverterUInt64.write(value.start_timestamp, buf)
17460-
_UniffiConverterOptionalUInt64.write(value.end_timestamp, buf)
17460+
_UniffiConverterString.write(value.start_timestamp, buf)
17461+
_UniffiConverterOptionalString.write(value.end_timestamp, buf)
1746117462
_UniffiConverterOptionalUInt64.write(value.system_state_version, buf)
1746217463
_UniffiConverterOptionalUInt64.write(value.total_checkpoints, buf)
1746317464
_UniffiConverterOptionalString.write(value.total_gas_fees, buf)

bindings/swift/Sources/IotaSDK/IotaSDK.swift

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28207,14 +28207,15 @@ public struct Epoch {
2820728207
*/
2820828208
public var referenceGasPrice: String?
2820928209
/**
28210-
* The epoch's starting timestamp.
28210+
* The epoch's starting timestamp. RFC3339 in UTC with format:
28211+
* YYYY-MM-DDTHH:MM:SS.mmmZ
2821128212
*/
28212-
public var startTimestamp: UInt64
28213+
public var startTimestamp: String
2821328214
/**
2821428215
* The epoch's ending timestamp. Note that this is available only on epochs
28215-
* that have ended.
28216+
* that have ended. RFC3339 in UTC with format: YYYY-MM-DDTHH:MM:SS.mmmZ
2821628217
*/
28217-
public var endTimestamp: UInt64?
28218+
public var endTimestamp: String?
2821828219
/**
2821928220
* The value of the `version` field of `0x5`, the
2822028221
* `0x3::iota::IotaSystemState` object. This version changes whenever
@@ -28283,12 +28284,13 @@ public struct Epoch {
2828328284
* a transaction for.
2828428285
*/referenceGasPrice: String? = nil,
2828528286
/**
28286-
* The epoch's starting timestamp.
28287-
*/startTimestamp: UInt64,
28287+
* The epoch's starting timestamp. RFC3339 in UTC with format:
28288+
* YYYY-MM-DDTHH:MM:SS.mmmZ
28289+
*/startTimestamp: String,
2828828290
/**
2828928291
* The epoch's ending timestamp. Note that this is available only on epochs
28290-
* that have ended.
28291-
*/endTimestamp: UInt64? = nil,
28292+
* that have ended. RFC3339 in UTC with format: YYYY-MM-DDTHH:MM:SS.mmmZ
28293+
*/endTimestamp: String? = nil,
2829228294
/**
2829328295
* The value of the `version` field of `0x5`, the
2829428296
* `0x3::iota::IotaSystemState` object. This version changes whenever
@@ -28353,8 +28355,8 @@ public struct FfiConverterTypeEpoch: FfiConverterRustBuffer {
2835328355
netInflow: FfiConverterOptionString.read(from: &buf),
2835428356
protocolConfigs: FfiConverterOptionTypeProtocolConfigs.read(from: &buf),
2835528357
referenceGasPrice: FfiConverterOptionString.read(from: &buf),
28356-
startTimestamp: FfiConverterUInt64.read(from: &buf),
28357-
endTimestamp: FfiConverterOptionUInt64.read(from: &buf),
28358+
startTimestamp: FfiConverterString.read(from: &buf),
28359+
endTimestamp: FfiConverterOptionString.read(from: &buf),
2835828360
systemStateVersion: FfiConverterOptionUInt64.read(from: &buf),
2835928361
totalCheckpoints: FfiConverterOptionUInt64.read(from: &buf),
2836028362
totalGasFees: FfiConverterOptionString.read(from: &buf),
@@ -28373,8 +28375,8 @@ public struct FfiConverterTypeEpoch: FfiConverterRustBuffer {
2837328375
FfiConverterOptionString.write(value.netInflow, into: &buf)
2837428376
FfiConverterOptionTypeProtocolConfigs.write(value.protocolConfigs, into: &buf)
2837528377
FfiConverterOptionString.write(value.referenceGasPrice, into: &buf)
28376-
FfiConverterUInt64.write(value.startTimestamp, into: &buf)
28377-
FfiConverterOptionUInt64.write(value.endTimestamp, into: &buf)
28378+
FfiConverterString.write(value.startTimestamp, into: &buf)
28379+
FfiConverterOptionString.write(value.endTimestamp, into: &buf)
2837828380
FfiConverterOptionUInt64.write(value.systemStateVersion, into: &buf)
2837928381
FfiConverterOptionUInt64.write(value.totalCheckpoints, into: &buf)
2838028382
FfiConverterOptionString.write(value.totalGasFees, into: &buf)

0 commit comments

Comments
 (0)