diff --git a/bindings/go/iota_sdk_ffi/iota_sdk_ffi.go b/bindings/go/iota_sdk_ffi/iota_sdk_ffi.go index ff4829e66..6f9a02d05 100644 --- a/bindings/go/iota_sdk_ffi/iota_sdk_ffi.go +++ b/bindings/go/iota_sdk_ffi/iota_sdk_ffi.go @@ -386,6 +386,51 @@ func uniffiCheckChecksums() { } } { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_public_key() + }) + if checksum != 53765 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_public_key: UniFFI API checksum mismatch") + } + } + { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_scheme() + }) + if checksum != 8293 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_scheme: UniFFI API checksum mismatch") + } + } + { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_sign_checkpoint_summary() + }) + if checksum != 1487 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_sign_checkpoint_summary: UniFFI API checksum mismatch") + } + } + { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_try_sign() + }) + if checksum != 59341 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_try_sign: UniFFI API checksum mismatch") + } + } + { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_verifying_key() + }) + if checksum != 36438 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_verifying_key: UniFFI API checksum mismatch") + } + } + { checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { return C.uniffi_iota_sdk_ffi_checksum_method_bls12381publickey_to_bytes() }) @@ -404,6 +449,24 @@ func uniffiCheckChecksums() { } } { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_method_bls12381verifyingkey_public_key() + }) + if checksum != 59353 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_method_bls12381verifyingkey_public_key: UniFFI API checksum mismatch") + } + } + { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_method_bls12381verifyingkey_verify() + }) + if checksum != 54718 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_method_bls12381verifyingkey_verify: UniFFI API checksum mismatch") + } + } + { checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { return C.uniffi_iota_sdk_ffi_checksum_method_bn254fieldelement_padded() }) @@ -3698,6 +3761,96 @@ func uniffiCheckChecksums() { } } { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_method_validatoraggregatedsignature_bitmap_bytes() + }) + if checksum != 59039 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_method_validatoraggregatedsignature_bitmap_bytes: UniFFI API checksum mismatch") + } + } + { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_method_validatoraggregatedsignature_epoch() + }) + if checksum != 54283 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_method_validatoraggregatedsignature_epoch: UniFFI API checksum mismatch") + } + } + { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_method_validatoraggregatedsignature_signature() + }) + if checksum != 39125 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_method_validatoraggregatedsignature_signature: UniFFI API checksum mismatch") + } + } + { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureaggregator_add_signature() + }) + if checksum != 13923 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureaggregator_add_signature: UniFFI API checksum mismatch") + } + } + { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureaggregator_committee() + }) + if checksum != 36159 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureaggregator_committee: UniFFI API checksum mismatch") + } + } + { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureaggregator_finish() + }) + if checksum != 7324 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureaggregator_finish: UniFFI API checksum mismatch") + } + } + { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_committee() + }) + if checksum != 5093 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_committee: UniFFI API checksum mismatch") + } + } + { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_verify() + }) + if checksum != 29238 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_verify: UniFFI API checksum mismatch") + } + } + { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_verify_aggregated() + }) + if checksum != 46271 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_verify_aggregated: UniFFI API checksum mismatch") + } + } + { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_verify_checkpoint_summary() + }) + if checksum != 36331 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_verify_checkpoint_summary: UniFFI API checksum mismatch") + } + } + { checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { return C.uniffi_iota_sdk_ffi_checksum_method_validatorexecutiontimeobservation_duration() }) @@ -3716,6 +3869,33 @@ func uniffiCheckChecksums() { } } { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_method_validatorsignature_epoch() + }) + if checksum != 15301 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_method_validatorsignature_epoch: UniFFI API checksum mismatch") + } + } + { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_method_validatorsignature_public_key() + }) + if checksum != 16384 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_method_validatorsignature_public_key: UniFFI API checksum mismatch") + } + } + { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_method_validatorsignature_signature() + }) + if checksum != 58273 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_method_validatorsignature_signature: UniFFI API checksum mismatch") + } + } + { checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { return C.uniffi_iota_sdk_ffi_checksum_method_versionassignment_object_id() }) @@ -3959,6 +4139,24 @@ func uniffiCheckChecksums() { } } { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_constructor_bls12381privatekey_generate() + }) + if checksum != 14780 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_constructor_bls12381privatekey_generate: UniFFI API checksum mismatch") + } + } + { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_constructor_bls12381privatekey_new() + }) + if checksum != 52467 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_constructor_bls12381privatekey_new: UniFFI API checksum mismatch") + } + } + { checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { return C.uniffi_iota_sdk_ffi_checksum_constructor_bls12381publickey_from_bytes() }) @@ -4013,6 +4211,15 @@ func uniffiCheckChecksums() { } } { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_constructor_bls12381verifyingkey_new() + }) + if checksum != 22402 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_constructor_bls12381verifyingkey_new: UniFFI API checksum mismatch") + } + } + { checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { return C.uniffi_iota_sdk_ffi_checksum_constructor_bn254fieldelement_from_bytes() }) @@ -5561,6 +5768,33 @@ func uniffiCheckChecksums() { } } { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_constructor_validatoraggregatedsignature_new() + }) + if checksum != 15846 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_constructor_validatoraggregatedsignature_new: UniFFI API checksum mismatch") + } + } + { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_constructor_validatorcommitteesignatureaggregator_new_checkpoint_summary() + }) + if checksum != 25823 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_constructor_validatorcommitteesignatureaggregator_new_checkpoint_summary: UniFFI API checksum mismatch") + } + } + { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_constructor_validatorcommitteesignatureverifier_new() + }) + if checksum != 17424 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_constructor_validatorcommitteesignatureverifier_new: UniFFI API checksum mismatch") + } + } + { checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { return C.uniffi_iota_sdk_ffi_checksum_constructor_validatorexecutiontimeobservation_new() }) @@ -5570,6 +5804,15 @@ func uniffiCheckChecksums() { } } { + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_iota_sdk_ffi_checksum_constructor_validatorsignature_new() + }) + if checksum != 2599 { + // If this happens try cleaning and rebuilding your project + panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_constructor_validatorsignature_new: UniFFI API checksum mismatch") + } + } + { checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { return C.uniffi_iota_sdk_ffi_checksum_constructor_versionassignment_new() }) @@ -6428,6 +6671,141 @@ func (_ FfiDestroyerBatchSendStatus) Destroy(value *BatchSendStatus) { +type Bls12381PrivateKeyInterface interface { + PublicKey() *Bls12381PublicKey + Scheme() SignatureScheme + SignCheckpointSummary(summary *CheckpointSummary) *ValidatorSignature + TrySign(message []byte) (*Bls12381Signature, error) + VerifyingKey() *Bls12381VerifyingKey +} +type Bls12381PrivateKey struct { + ffiObject FfiObject +} +func NewBls12381PrivateKey(bytes []byte) (*Bls12381PrivateKey, error) { + _uniffiRV, _uniffiErr := rustCallWithError[SdkFfiError](FfiConverterSdkFfiError{},func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_iota_sdk_ffi_fn_constructor_bls12381privatekey_new(FfiConverterBytesINSTANCE.Lower(bytes),_uniffiStatus) + }) + if _uniffiErr != nil { + var _uniffiDefaultValue *Bls12381PrivateKey + return _uniffiDefaultValue, _uniffiErr + } else { + return FfiConverterBls12381PrivateKeyINSTANCE.Lift(_uniffiRV), nil + } +} + + +func Bls12381PrivateKeyGenerate() *Bls12381PrivateKey { + return FfiConverterBls12381PrivateKeyINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_iota_sdk_ffi_fn_constructor_bls12381privatekey_generate(_uniffiStatus) + })) +} + + + +func (_self *Bls12381PrivateKey) PublicKey() *Bls12381PublicKey { + _pointer := _self.ffiObject.incrementPointer("*Bls12381PrivateKey") + defer _self.ffiObject.decrementPointer() + return FfiConverterBls12381PublicKeyINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_public_key( + _pointer,_uniffiStatus) + })) +} + +func (_self *Bls12381PrivateKey) Scheme() SignatureScheme { + _pointer := _self.ffiObject.incrementPointer("*Bls12381PrivateKey") + defer _self.ffiObject.decrementPointer() + return FfiConverterSignatureSchemeINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { + return GoRustBuffer { + inner: C.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_scheme( + _pointer,_uniffiStatus), + } + })) +} + +func (_self *Bls12381PrivateKey) SignCheckpointSummary(summary *CheckpointSummary) *ValidatorSignature { + _pointer := _self.ffiObject.incrementPointer("*Bls12381PrivateKey") + defer _self.ffiObject.decrementPointer() + return FfiConverterValidatorSignatureINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_sign_checkpoint_summary( + _pointer,FfiConverterCheckpointSummaryINSTANCE.Lower(summary),_uniffiStatus) + })) +} + +func (_self *Bls12381PrivateKey) TrySign(message []byte) (*Bls12381Signature, error) { + _pointer := _self.ffiObject.incrementPointer("*Bls12381PrivateKey") + defer _self.ffiObject.decrementPointer() + _uniffiRV, _uniffiErr := rustCallWithError[SdkFfiError](FfiConverterSdkFfiError{},func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_try_sign( + _pointer,FfiConverterBytesINSTANCE.Lower(message),_uniffiStatus) + }) + if _uniffiErr != nil { + var _uniffiDefaultValue *Bls12381Signature + return _uniffiDefaultValue, _uniffiErr + } else { + return FfiConverterBls12381SignatureINSTANCE.Lift(_uniffiRV), nil + } +} + +func (_self *Bls12381PrivateKey) VerifyingKey() *Bls12381VerifyingKey { + _pointer := _self.ffiObject.incrementPointer("*Bls12381PrivateKey") + defer _self.ffiObject.decrementPointer() + return FfiConverterBls12381VerifyingKeyINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_verifying_key( + _pointer,_uniffiStatus) + })) +} +func (object *Bls12381PrivateKey) Destroy() { + runtime.SetFinalizer(object, nil) + object.ffiObject.destroy() +} + +type FfiConverterBls12381PrivateKey struct {} + +var FfiConverterBls12381PrivateKeyINSTANCE = FfiConverterBls12381PrivateKey{} + + +func (c FfiConverterBls12381PrivateKey) Lift(pointer unsafe.Pointer) *Bls12381PrivateKey { + result := &Bls12381PrivateKey { + newFfiObject( + pointer, + func(pointer unsafe.Pointer, status *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_iota_sdk_ffi_fn_clone_bls12381privatekey(pointer, status) + }, + func(pointer unsafe.Pointer, status *C.RustCallStatus) { + C.uniffi_iota_sdk_ffi_fn_free_bls12381privatekey(pointer, status) + }, + ), + } + runtime.SetFinalizer(result, (*Bls12381PrivateKey).Destroy) + return result +} + +func (c FfiConverterBls12381PrivateKey) Read(reader io.Reader) *Bls12381PrivateKey { + return c.Lift(unsafe.Pointer(uintptr(readUint64(reader)))) +} + +func (c FfiConverterBls12381PrivateKey) Lower(value *Bls12381PrivateKey) unsafe.Pointer { + // TODO: this is bad - all synchronization from ObjectRuntime.go is discarded here, + // because the pointer will be decremented immediately after this function returns, + // and someone will be left holding onto a non-locked pointer. + pointer := value.ffiObject.incrementPointer("*Bls12381PrivateKey") + defer value.ffiObject.decrementPointer() + return pointer + +} + +func (c FfiConverterBls12381PrivateKey) Write(writer io.Writer, value *Bls12381PrivateKey) { + writeUint64(writer, uint64(uintptr(c.Lower(value)))) +} + +type FfiDestroyerBls12381PrivateKey struct {} + +func (_ FfiDestroyerBls12381PrivateKey) Destroy(value *Bls12381PrivateKey) { + value.Destroy() +} + + + // A bls12381 min-sig public key. // // # BCS @@ -6688,10 +7066,103 @@ func (_ FfiDestroyerBls12381Signature) Destroy(value *Bls12381Signature) { -// A point on the BN254 elliptic curve. -// -// This is a 32-byte, or 256-bit, value that is generally represented as -// radix10 when a human-readable display format is needed, and is represented +type Bls12381VerifyingKeyInterface interface { + PublicKey() *Bls12381PublicKey + Verify(message []byte, signature *Bls12381Signature) error +} +type Bls12381VerifyingKey struct { + ffiObject FfiObject +} +func NewBls12381VerifyingKey(publicKey *Bls12381PublicKey) (*Bls12381VerifyingKey, error) { + _uniffiRV, _uniffiErr := rustCallWithError[SdkFfiError](FfiConverterSdkFfiError{},func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_iota_sdk_ffi_fn_constructor_bls12381verifyingkey_new(FfiConverterBls12381PublicKeyINSTANCE.Lower(publicKey),_uniffiStatus) + }) + if _uniffiErr != nil { + var _uniffiDefaultValue *Bls12381VerifyingKey + return _uniffiDefaultValue, _uniffiErr + } else { + return FfiConverterBls12381VerifyingKeyINSTANCE.Lift(_uniffiRV), nil + } +} + + + + +func (_self *Bls12381VerifyingKey) PublicKey() *Bls12381PublicKey { + _pointer := _self.ffiObject.incrementPointer("*Bls12381VerifyingKey") + defer _self.ffiObject.decrementPointer() + return FfiConverterBls12381PublicKeyINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_iota_sdk_ffi_fn_method_bls12381verifyingkey_public_key( + _pointer,_uniffiStatus) + })) +} + +func (_self *Bls12381VerifyingKey) Verify(message []byte, signature *Bls12381Signature) error { + _pointer := _self.ffiObject.incrementPointer("*Bls12381VerifyingKey") + defer _self.ffiObject.decrementPointer() + _, _uniffiErr := rustCallWithError[SdkFfiError](FfiConverterSdkFfiError{},func(_uniffiStatus *C.RustCallStatus) bool { + C.uniffi_iota_sdk_ffi_fn_method_bls12381verifyingkey_verify( + _pointer,FfiConverterBytesINSTANCE.Lower(message), FfiConverterBls12381SignatureINSTANCE.Lower(signature),_uniffiStatus) + return false + }) + return _uniffiErr.AsError() +} +func (object *Bls12381VerifyingKey) Destroy() { + runtime.SetFinalizer(object, nil) + object.ffiObject.destroy() +} + +type FfiConverterBls12381VerifyingKey struct {} + +var FfiConverterBls12381VerifyingKeyINSTANCE = FfiConverterBls12381VerifyingKey{} + + +func (c FfiConverterBls12381VerifyingKey) Lift(pointer unsafe.Pointer) *Bls12381VerifyingKey { + result := &Bls12381VerifyingKey { + newFfiObject( + pointer, + func(pointer unsafe.Pointer, status *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_iota_sdk_ffi_fn_clone_bls12381verifyingkey(pointer, status) + }, + func(pointer unsafe.Pointer, status *C.RustCallStatus) { + C.uniffi_iota_sdk_ffi_fn_free_bls12381verifyingkey(pointer, status) + }, + ), + } + runtime.SetFinalizer(result, (*Bls12381VerifyingKey).Destroy) + return result +} + +func (c FfiConverterBls12381VerifyingKey) Read(reader io.Reader) *Bls12381VerifyingKey { + return c.Lift(unsafe.Pointer(uintptr(readUint64(reader)))) +} + +func (c FfiConverterBls12381VerifyingKey) Lower(value *Bls12381VerifyingKey) unsafe.Pointer { + // TODO: this is bad - all synchronization from ObjectRuntime.go is discarded here, + // because the pointer will be decremented immediately after this function returns, + // and someone will be left holding onto a non-locked pointer. + pointer := value.ffiObject.incrementPointer("*Bls12381VerifyingKey") + defer value.ffiObject.decrementPointer() + return pointer + +} + +func (c FfiConverterBls12381VerifyingKey) Write(writer io.Writer, value *Bls12381VerifyingKey) { + writeUint64(writer, uint64(uintptr(c.Lower(value)))) +} + +type FfiDestroyerBls12381VerifyingKey struct {} + +func (_ FfiDestroyerBls12381VerifyingKey) Destroy(value *Bls12381VerifyingKey) { + value.Destroy() +} + + + +// A point on the BN254 elliptic curve. +// +// This is a 32-byte, or 256-bit, value that is generally represented as +// radix10 when a human-readable display format is needed, and is represented // as a 32-byte big-endian value while in memory. // // # BCS @@ -20685,6 +21156,380 @@ func (_ FfiDestroyerUserSignatureVerifier) Destroy(value *UserSignatureVerifier) +// An aggregated signature from multiple Validators. +// +// # BCS +// +// The BCS serialized form for this type is defined by the following ABNF: +// +// ```text +// validator-aggregated-signature = u64 ; epoch +// bls-signature +// roaring-bitmap +// roaring-bitmap = bytes ; where the contents of the bytes are valid +// ; according to the serialized spec for +// ; roaring bitmaps +// ``` +// +// See [here](https://github.com/RoaringBitmap/RoaringFormatSpec) for the specification for the +// serialized format of RoaringBitmaps. +type ValidatorAggregatedSignatureInterface interface { + BitmapBytes() ([]byte, error) + Epoch() uint64 + Signature() *Bls12381Signature +} +// An aggregated signature from multiple Validators. +// +// # BCS +// +// The BCS serialized form for this type is defined by the following ABNF: +// +// ```text +// validator-aggregated-signature = u64 ; epoch +// bls-signature +// roaring-bitmap +// roaring-bitmap = bytes ; where the contents of the bytes are valid +// ; according to the serialized spec for +// ; roaring bitmaps +// ``` +// +// See [here](https://github.com/RoaringBitmap/RoaringFormatSpec) for the specification for the +// serialized format of RoaringBitmaps. +type ValidatorAggregatedSignature struct { + ffiObject FfiObject +} +func NewValidatorAggregatedSignature(epoch uint64, signature *Bls12381Signature, bitmapBytes []byte) (*ValidatorAggregatedSignature, error) { + _uniffiRV, _uniffiErr := rustCallWithError[SdkFfiError](FfiConverterSdkFfiError{},func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_iota_sdk_ffi_fn_constructor_validatoraggregatedsignature_new(FfiConverterUint64INSTANCE.Lower(epoch), FfiConverterBls12381SignatureINSTANCE.Lower(signature), FfiConverterBytesINSTANCE.Lower(bitmapBytes),_uniffiStatus) + }) + if _uniffiErr != nil { + var _uniffiDefaultValue *ValidatorAggregatedSignature + return _uniffiDefaultValue, _uniffiErr + } else { + return FfiConverterValidatorAggregatedSignatureINSTANCE.Lift(_uniffiRV), nil + } +} + + + + +func (_self *ValidatorAggregatedSignature) BitmapBytes() ([]byte, error) { + _pointer := _self.ffiObject.incrementPointer("*ValidatorAggregatedSignature") + defer _self.ffiObject.decrementPointer() + _uniffiRV, _uniffiErr := rustCallWithError[SdkFfiError](FfiConverterSdkFfiError{},func(_uniffiStatus *C.RustCallStatus) RustBufferI { + return GoRustBuffer { + inner: C.uniffi_iota_sdk_ffi_fn_method_validatoraggregatedsignature_bitmap_bytes( + _pointer,_uniffiStatus), + } + }) + if _uniffiErr != nil { + var _uniffiDefaultValue []byte + return _uniffiDefaultValue, _uniffiErr + } else { + return FfiConverterBytesINSTANCE.Lift(_uniffiRV), nil + } +} + +func (_self *ValidatorAggregatedSignature) Epoch() uint64 { + _pointer := _self.ffiObject.incrementPointer("*ValidatorAggregatedSignature") + defer _self.ffiObject.decrementPointer() + return FfiConverterUint64INSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint64_t { + return C.uniffi_iota_sdk_ffi_fn_method_validatoraggregatedsignature_epoch( + _pointer,_uniffiStatus) + })) +} + +func (_self *ValidatorAggregatedSignature) Signature() *Bls12381Signature { + _pointer := _self.ffiObject.incrementPointer("*ValidatorAggregatedSignature") + defer _self.ffiObject.decrementPointer() + return FfiConverterBls12381SignatureINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_iota_sdk_ffi_fn_method_validatoraggregatedsignature_signature( + _pointer,_uniffiStatus) + })) +} +func (object *ValidatorAggregatedSignature) Destroy() { + runtime.SetFinalizer(object, nil) + object.ffiObject.destroy() +} + +type FfiConverterValidatorAggregatedSignature struct {} + +var FfiConverterValidatorAggregatedSignatureINSTANCE = FfiConverterValidatorAggregatedSignature{} + + +func (c FfiConverterValidatorAggregatedSignature) Lift(pointer unsafe.Pointer) *ValidatorAggregatedSignature { + result := &ValidatorAggregatedSignature { + newFfiObject( + pointer, + func(pointer unsafe.Pointer, status *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_iota_sdk_ffi_fn_clone_validatoraggregatedsignature(pointer, status) + }, + func(pointer unsafe.Pointer, status *C.RustCallStatus) { + C.uniffi_iota_sdk_ffi_fn_free_validatoraggregatedsignature(pointer, status) + }, + ), + } + runtime.SetFinalizer(result, (*ValidatorAggregatedSignature).Destroy) + return result +} + +func (c FfiConverterValidatorAggregatedSignature) Read(reader io.Reader) *ValidatorAggregatedSignature { + return c.Lift(unsafe.Pointer(uintptr(readUint64(reader)))) +} + +func (c FfiConverterValidatorAggregatedSignature) Lower(value *ValidatorAggregatedSignature) unsafe.Pointer { + // TODO: this is bad - all synchronization from ObjectRuntime.go is discarded here, + // because the pointer will be decremented immediately after this function returns, + // and someone will be left holding onto a non-locked pointer. + pointer := value.ffiObject.incrementPointer("*ValidatorAggregatedSignature") + defer value.ffiObject.decrementPointer() + return pointer + +} + +func (c FfiConverterValidatorAggregatedSignature) Write(writer io.Writer, value *ValidatorAggregatedSignature) { + writeUint64(writer, uint64(uintptr(c.Lower(value)))) +} + +type FfiDestroyerValidatorAggregatedSignature struct {} + +func (_ FfiDestroyerValidatorAggregatedSignature) Destroy(value *ValidatorAggregatedSignature) { + value.Destroy() +} + + + +type ValidatorCommitteeSignatureAggregatorInterface interface { + AddSignature(signature *ValidatorSignature) error + Committee() ValidatorCommittee + Finish() (*ValidatorAggregatedSignature, error) +} +type ValidatorCommitteeSignatureAggregator struct { + ffiObject FfiObject +} + + +func ValidatorCommitteeSignatureAggregatorNewCheckpointSummary(committee ValidatorCommittee, summary *CheckpointSummary) (*ValidatorCommitteeSignatureAggregator, error) { + _uniffiRV, _uniffiErr := rustCallWithError[SdkFfiError](FfiConverterSdkFfiError{},func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_iota_sdk_ffi_fn_constructor_validatorcommitteesignatureaggregator_new_checkpoint_summary(FfiConverterValidatorCommitteeINSTANCE.Lower(committee), FfiConverterCheckpointSummaryINSTANCE.Lower(summary),_uniffiStatus) + }) + if _uniffiErr != nil { + var _uniffiDefaultValue *ValidatorCommitteeSignatureAggregator + return _uniffiDefaultValue, _uniffiErr + } else { + return FfiConverterValidatorCommitteeSignatureAggregatorINSTANCE.Lift(_uniffiRV), nil + } +} + + + +func (_self *ValidatorCommitteeSignatureAggregator) AddSignature(signature *ValidatorSignature) error { + _pointer := _self.ffiObject.incrementPointer("*ValidatorCommitteeSignatureAggregator") + defer _self.ffiObject.decrementPointer() + _, _uniffiErr := rustCallWithError[SdkFfiError](FfiConverterSdkFfiError{},func(_uniffiStatus *C.RustCallStatus) bool { + C.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureaggregator_add_signature( + _pointer,FfiConverterValidatorSignatureINSTANCE.Lower(signature),_uniffiStatus) + return false + }) + return _uniffiErr.AsError() +} + +func (_self *ValidatorCommitteeSignatureAggregator) Committee() ValidatorCommittee { + _pointer := _self.ffiObject.incrementPointer("*ValidatorCommitteeSignatureAggregator") + defer _self.ffiObject.decrementPointer() + return FfiConverterValidatorCommitteeINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { + return GoRustBuffer { + inner: C.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureaggregator_committee( + _pointer,_uniffiStatus), + } + })) +} + +func (_self *ValidatorCommitteeSignatureAggregator) Finish() (*ValidatorAggregatedSignature, error) { + _pointer := _self.ffiObject.incrementPointer("*ValidatorCommitteeSignatureAggregator") + defer _self.ffiObject.decrementPointer() + _uniffiRV, _uniffiErr := rustCallWithError[SdkFfiError](FfiConverterSdkFfiError{},func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureaggregator_finish( + _pointer,_uniffiStatus) + }) + if _uniffiErr != nil { + var _uniffiDefaultValue *ValidatorAggregatedSignature + return _uniffiDefaultValue, _uniffiErr + } else { + return FfiConverterValidatorAggregatedSignatureINSTANCE.Lift(_uniffiRV), nil + } +} +func (object *ValidatorCommitteeSignatureAggregator) Destroy() { + runtime.SetFinalizer(object, nil) + object.ffiObject.destroy() +} + +type FfiConverterValidatorCommitteeSignatureAggregator struct {} + +var FfiConverterValidatorCommitteeSignatureAggregatorINSTANCE = FfiConverterValidatorCommitteeSignatureAggregator{} + + +func (c FfiConverterValidatorCommitteeSignatureAggregator) Lift(pointer unsafe.Pointer) *ValidatorCommitteeSignatureAggregator { + result := &ValidatorCommitteeSignatureAggregator { + newFfiObject( + pointer, + func(pointer unsafe.Pointer, status *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_iota_sdk_ffi_fn_clone_validatorcommitteesignatureaggregator(pointer, status) + }, + func(pointer unsafe.Pointer, status *C.RustCallStatus) { + C.uniffi_iota_sdk_ffi_fn_free_validatorcommitteesignatureaggregator(pointer, status) + }, + ), + } + runtime.SetFinalizer(result, (*ValidatorCommitteeSignatureAggregator).Destroy) + return result +} + +func (c FfiConverterValidatorCommitteeSignatureAggregator) Read(reader io.Reader) *ValidatorCommitteeSignatureAggregator { + return c.Lift(unsafe.Pointer(uintptr(readUint64(reader)))) +} + +func (c FfiConverterValidatorCommitteeSignatureAggregator) Lower(value *ValidatorCommitteeSignatureAggregator) unsafe.Pointer { + // TODO: this is bad - all synchronization from ObjectRuntime.go is discarded here, + // because the pointer will be decremented immediately after this function returns, + // and someone will be left holding onto a non-locked pointer. + pointer := value.ffiObject.incrementPointer("*ValidatorCommitteeSignatureAggregator") + defer value.ffiObject.decrementPointer() + return pointer + +} + +func (c FfiConverterValidatorCommitteeSignatureAggregator) Write(writer io.Writer, value *ValidatorCommitteeSignatureAggregator) { + writeUint64(writer, uint64(uintptr(c.Lower(value)))) +} + +type FfiDestroyerValidatorCommitteeSignatureAggregator struct {} + +func (_ FfiDestroyerValidatorCommitteeSignatureAggregator) Destroy(value *ValidatorCommitteeSignatureAggregator) { + value.Destroy() +} + + + +type ValidatorCommitteeSignatureVerifierInterface interface { + Committee() ValidatorCommittee + Verify(message []byte, signature *ValidatorSignature) error + VerifyAggregated(message []byte, signature *ValidatorAggregatedSignature) error + VerifyCheckpointSummary(summary *CheckpointSummary, signature *ValidatorAggregatedSignature) error +} +type ValidatorCommitteeSignatureVerifier struct { + ffiObject FfiObject +} +func NewValidatorCommitteeSignatureVerifier(committee ValidatorCommittee) (*ValidatorCommitteeSignatureVerifier, error) { + _uniffiRV, _uniffiErr := rustCallWithError[SdkFfiError](FfiConverterSdkFfiError{},func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_iota_sdk_ffi_fn_constructor_validatorcommitteesignatureverifier_new(FfiConverterValidatorCommitteeINSTANCE.Lower(committee),_uniffiStatus) + }) + if _uniffiErr != nil { + var _uniffiDefaultValue *ValidatorCommitteeSignatureVerifier + return _uniffiDefaultValue, _uniffiErr + } else { + return FfiConverterValidatorCommitteeSignatureVerifierINSTANCE.Lift(_uniffiRV), nil + } +} + + + + +func (_self *ValidatorCommitteeSignatureVerifier) Committee() ValidatorCommittee { + _pointer := _self.ffiObject.incrementPointer("*ValidatorCommitteeSignatureVerifier") + defer _self.ffiObject.decrementPointer() + return FfiConverterValidatorCommitteeINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { + return GoRustBuffer { + inner: C.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_committee( + _pointer,_uniffiStatus), + } + })) +} + +func (_self *ValidatorCommitteeSignatureVerifier) Verify(message []byte, signature *ValidatorSignature) error { + _pointer := _self.ffiObject.incrementPointer("*ValidatorCommitteeSignatureVerifier") + defer _self.ffiObject.decrementPointer() + _, _uniffiErr := rustCallWithError[SdkFfiError](FfiConverterSdkFfiError{},func(_uniffiStatus *C.RustCallStatus) bool { + C.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_verify( + _pointer,FfiConverterBytesINSTANCE.Lower(message), FfiConverterValidatorSignatureINSTANCE.Lower(signature),_uniffiStatus) + return false + }) + return _uniffiErr.AsError() +} + +func (_self *ValidatorCommitteeSignatureVerifier) VerifyAggregated(message []byte, signature *ValidatorAggregatedSignature) error { + _pointer := _self.ffiObject.incrementPointer("*ValidatorCommitteeSignatureVerifier") + defer _self.ffiObject.decrementPointer() + _, _uniffiErr := rustCallWithError[SdkFfiError](FfiConverterSdkFfiError{},func(_uniffiStatus *C.RustCallStatus) bool { + C.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_verify_aggregated( + _pointer,FfiConverterBytesINSTANCE.Lower(message), FfiConverterValidatorAggregatedSignatureINSTANCE.Lower(signature),_uniffiStatus) + return false + }) + return _uniffiErr.AsError() +} + +func (_self *ValidatorCommitteeSignatureVerifier) VerifyCheckpointSummary(summary *CheckpointSummary, signature *ValidatorAggregatedSignature) error { + _pointer := _self.ffiObject.incrementPointer("*ValidatorCommitteeSignatureVerifier") + defer _self.ffiObject.decrementPointer() + _, _uniffiErr := rustCallWithError[SdkFfiError](FfiConverterSdkFfiError{},func(_uniffiStatus *C.RustCallStatus) bool { + C.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_verify_checkpoint_summary( + _pointer,FfiConverterCheckpointSummaryINSTANCE.Lower(summary), FfiConverterValidatorAggregatedSignatureINSTANCE.Lower(signature),_uniffiStatus) + return false + }) + return _uniffiErr.AsError() +} +func (object *ValidatorCommitteeSignatureVerifier) Destroy() { + runtime.SetFinalizer(object, nil) + object.ffiObject.destroy() +} + +type FfiConverterValidatorCommitteeSignatureVerifier struct {} + +var FfiConverterValidatorCommitteeSignatureVerifierINSTANCE = FfiConverterValidatorCommitteeSignatureVerifier{} + + +func (c FfiConverterValidatorCommitteeSignatureVerifier) Lift(pointer unsafe.Pointer) *ValidatorCommitteeSignatureVerifier { + result := &ValidatorCommitteeSignatureVerifier { + newFfiObject( + pointer, + func(pointer unsafe.Pointer, status *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_iota_sdk_ffi_fn_clone_validatorcommitteesignatureverifier(pointer, status) + }, + func(pointer unsafe.Pointer, status *C.RustCallStatus) { + C.uniffi_iota_sdk_ffi_fn_free_validatorcommitteesignatureverifier(pointer, status) + }, + ), + } + runtime.SetFinalizer(result, (*ValidatorCommitteeSignatureVerifier).Destroy) + return result +} + +func (c FfiConverterValidatorCommitteeSignatureVerifier) Read(reader io.Reader) *ValidatorCommitteeSignatureVerifier { + return c.Lift(unsafe.Pointer(uintptr(readUint64(reader)))) +} + +func (c FfiConverterValidatorCommitteeSignatureVerifier) Lower(value *ValidatorCommitteeSignatureVerifier) unsafe.Pointer { + // TODO: this is bad - all synchronization from ObjectRuntime.go is discarded here, + // because the pointer will be decremented immediately after this function returns, + // and someone will be left holding onto a non-locked pointer. + pointer := value.ffiObject.incrementPointer("*ValidatorCommitteeSignatureVerifier") + defer value.ffiObject.decrementPointer() + return pointer + +} + +func (c FfiConverterValidatorCommitteeSignatureVerifier) Write(writer io.Writer, value *ValidatorCommitteeSignatureVerifier) { + writeUint64(writer, uint64(uintptr(c.Lower(value)))) +} + +type FfiDestroyerValidatorCommitteeSignatureVerifier struct {} + +func (_ FfiDestroyerValidatorCommitteeSignatureVerifier) Destroy(value *ValidatorCommitteeSignatureVerifier) { + value.Destroy() +} + + + // An execution time observation from a particular validator // // # BCS @@ -20794,6 +21639,123 @@ func (_ FfiDestroyerValidatorExecutionTimeObservation) Destroy(value *ValidatorE +// A signature from a Validator +// +// # BCS +// +// The BCS serialized form for this type is defined by the following ABNF: +// +// ```text +// validator-signature = u64 ; epoch +// bls-public-key +// bls-signature +// ``` +type ValidatorSignatureInterface interface { + Epoch() uint64 + PublicKey() *Bls12381PublicKey + Signature() *Bls12381Signature +} +// A signature from a Validator +// +// # BCS +// +// The BCS serialized form for this type is defined by the following ABNF: +// +// ```text +// validator-signature = u64 ; epoch +// bls-public-key +// bls-signature +// ``` +type ValidatorSignature struct { + ffiObject FfiObject +} +func NewValidatorSignature(epoch uint64, publicKey *Bls12381PublicKey, signature *Bls12381Signature) *ValidatorSignature { + return FfiConverterValidatorSignatureINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_iota_sdk_ffi_fn_constructor_validatorsignature_new(FfiConverterUint64INSTANCE.Lower(epoch), FfiConverterBls12381PublicKeyINSTANCE.Lower(publicKey), FfiConverterBls12381SignatureINSTANCE.Lower(signature),_uniffiStatus) + })) +} + + + + +func (_self *ValidatorSignature) Epoch() uint64 { + _pointer := _self.ffiObject.incrementPointer("*ValidatorSignature") + defer _self.ffiObject.decrementPointer() + return FfiConverterUint64INSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint64_t { + return C.uniffi_iota_sdk_ffi_fn_method_validatorsignature_epoch( + _pointer,_uniffiStatus) + })) +} + +func (_self *ValidatorSignature) PublicKey() *Bls12381PublicKey { + _pointer := _self.ffiObject.incrementPointer("*ValidatorSignature") + defer _self.ffiObject.decrementPointer() + return FfiConverterBls12381PublicKeyINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_iota_sdk_ffi_fn_method_validatorsignature_public_key( + _pointer,_uniffiStatus) + })) +} + +func (_self *ValidatorSignature) Signature() *Bls12381Signature { + _pointer := _self.ffiObject.incrementPointer("*ValidatorSignature") + defer _self.ffiObject.decrementPointer() + return FfiConverterBls12381SignatureINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_iota_sdk_ffi_fn_method_validatorsignature_signature( + _pointer,_uniffiStatus) + })) +} +func (object *ValidatorSignature) Destroy() { + runtime.SetFinalizer(object, nil) + object.ffiObject.destroy() +} + +type FfiConverterValidatorSignature struct {} + +var FfiConverterValidatorSignatureINSTANCE = FfiConverterValidatorSignature{} + + +func (c FfiConverterValidatorSignature) Lift(pointer unsafe.Pointer) *ValidatorSignature { + result := &ValidatorSignature { + newFfiObject( + pointer, + func(pointer unsafe.Pointer, status *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_iota_sdk_ffi_fn_clone_validatorsignature(pointer, status) + }, + func(pointer unsafe.Pointer, status *C.RustCallStatus) { + C.uniffi_iota_sdk_ffi_fn_free_validatorsignature(pointer, status) + }, + ), + } + runtime.SetFinalizer(result, (*ValidatorSignature).Destroy) + return result +} + +func (c FfiConverterValidatorSignature) Read(reader io.Reader) *ValidatorSignature { + return c.Lift(unsafe.Pointer(uintptr(readUint64(reader)))) +} + +func (c FfiConverterValidatorSignature) Lower(value *ValidatorSignature) unsafe.Pointer { + // TODO: this is bad - all synchronization from ObjectRuntime.go is discarded here, + // because the pointer will be decremented immediately after this function returns, + // and someone will be left holding onto a non-locked pointer. + pointer := value.ffiObject.incrementPointer("*ValidatorSignature") + defer value.ffiObject.decrementPointer() + return pointer + +} + +func (c FfiConverterValidatorSignature) Write(writer io.Writer, value *ValidatorSignature) { + writeUint64(writer, uint64(uintptr(c.Lower(value)))) +} + +type FfiDestroyerValidatorSignature struct {} + +func (_ FfiDestroyerValidatorSignature) Destroy(value *ValidatorSignature) { + value.Destroy() +} + + + // Object version assignment from consensus // // # BCS @@ -25068,6 +26030,55 @@ type FfiDestroyerValidator struct {} func (_ FfiDestroyerValidator) Destroy(value Validator) { value.Destroy() } +// The Validator Set for a particular epoch. +// +// # BCS +// +// The BCS serialized form for this type is defined by the following ABNF: +// +// ```text +// validator-committee = u64 ; epoch +// (vector validator-committee-member) +// ``` +type ValidatorCommittee struct { + Epoch uint64 + Members []ValidatorCommitteeMember +} + +func (r *ValidatorCommittee) Destroy() { + FfiDestroyerUint64{}.Destroy(r.Epoch); + FfiDestroyerSequenceValidatorCommitteeMember{}.Destroy(r.Members); +} + +type FfiConverterValidatorCommittee struct {} + +var FfiConverterValidatorCommitteeINSTANCE = FfiConverterValidatorCommittee{} + +func (c FfiConverterValidatorCommittee) Lift(rb RustBufferI) ValidatorCommittee { + return LiftFromRustBuffer[ValidatorCommittee](c, rb) +} + +func (c FfiConverterValidatorCommittee) Read(reader io.Reader) ValidatorCommittee { + return ValidatorCommittee { + FfiConverterUint64INSTANCE.Read(reader), + FfiConverterSequenceValidatorCommitteeMemberINSTANCE.Read(reader), + } +} + +func (c FfiConverterValidatorCommittee) Lower(value ValidatorCommittee) C.RustBuffer { + return LowerIntoRustBuffer[ValidatorCommittee](c, value) +} + +func (c FfiConverterValidatorCommittee) Write(writer io.Writer, value ValidatorCommittee) { + FfiConverterUint64INSTANCE.Write(writer, value.Epoch); + FfiConverterSequenceValidatorCommitteeMemberINSTANCE.Write(writer, value.Members); +} + +type FfiDestroyerValidatorCommittee struct {} + +func (_ FfiDestroyerValidatorCommittee) Destroy(value ValidatorCommittee) { + value.Destroy() +} // A member of a Validator Committee // // # BCS diff --git a/bindings/go/iota_sdk_ffi/iota_sdk_ffi.h b/bindings/go/iota_sdk_ffi/iota_sdk_ffi.h index 106ae1795..86d9bedef 100644 --- a/bindings/go/iota_sdk_ffi/iota_sdk_ffi.h +++ b/bindings/go/iota_sdk_ffi/iota_sdk_ffi.h @@ -460,6 +460,52 @@ void* uniffi_iota_sdk_ffi_fn_clone_batchsendstatus(void* ptr, RustCallStatus *ou void uniffi_iota_sdk_ffi_fn_free_batchsendstatus(void* ptr, RustCallStatus *out_status ); #endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CLONE_BLS12381PRIVATEKEY +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CLONE_BLS12381PRIVATEKEY +void* uniffi_iota_sdk_ffi_fn_clone_bls12381privatekey(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_FREE_BLS12381PRIVATEKEY +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_FREE_BLS12381PRIVATEKEY +void uniffi_iota_sdk_ffi_fn_free_bls12381privatekey(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_BLS12381PRIVATEKEY_GENERATE +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_BLS12381PRIVATEKEY_GENERATE +void* uniffi_iota_sdk_ffi_fn_constructor_bls12381privatekey_generate(RustCallStatus *out_status + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_BLS12381PRIVATEKEY_NEW +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_BLS12381PRIVATEKEY_NEW +void* uniffi_iota_sdk_ffi_fn_constructor_bls12381privatekey_new(RustBuffer bytes, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_BLS12381PRIVATEKEY_PUBLIC_KEY +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_BLS12381PRIVATEKEY_PUBLIC_KEY +void* uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_public_key(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_BLS12381PRIVATEKEY_SCHEME +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_BLS12381PRIVATEKEY_SCHEME +RustBuffer uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_scheme(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_BLS12381PRIVATEKEY_SIGN_CHECKPOINT_SUMMARY +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_BLS12381PRIVATEKEY_SIGN_CHECKPOINT_SUMMARY +void* uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_sign_checkpoint_summary(void* ptr, void* summary, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_BLS12381PRIVATEKEY_TRY_SIGN +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_BLS12381PRIVATEKEY_TRY_SIGN +void* uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_try_sign(void* ptr, RustBuffer message, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_BLS12381PRIVATEKEY_VERIFYING_KEY +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_BLS12381PRIVATEKEY_VERIFYING_KEY +void* uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_verifying_key(void* ptr, RustCallStatus *out_status +); +#endif #ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CLONE_BLS12381PUBLICKEY #define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CLONE_BLS12381PUBLICKEY void* uniffi_iota_sdk_ffi_fn_clone_bls12381publickey(void* ptr, RustCallStatus *out_status @@ -522,6 +568,31 @@ void* uniffi_iota_sdk_ffi_fn_constructor_bls12381signature_generate(RustCallStat RustBuffer uniffi_iota_sdk_ffi_fn_method_bls12381signature_to_bytes(void* ptr, RustCallStatus *out_status ); #endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CLONE_BLS12381VERIFYINGKEY +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CLONE_BLS12381VERIFYINGKEY +void* uniffi_iota_sdk_ffi_fn_clone_bls12381verifyingkey(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_FREE_BLS12381VERIFYINGKEY +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_FREE_BLS12381VERIFYINGKEY +void uniffi_iota_sdk_ffi_fn_free_bls12381verifyingkey(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_BLS12381VERIFYINGKEY_NEW +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_BLS12381VERIFYINGKEY_NEW +void* uniffi_iota_sdk_ffi_fn_constructor_bls12381verifyingkey_new(void* public_key, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_BLS12381VERIFYINGKEY_PUBLIC_KEY +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_BLS12381VERIFYINGKEY_PUBLIC_KEY +void* uniffi_iota_sdk_ffi_fn_method_bls12381verifyingkey_public_key(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_BLS12381VERIFYINGKEY_VERIFY +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_BLS12381VERIFYINGKEY_VERIFY +void uniffi_iota_sdk_ffi_fn_method_bls12381verifyingkey_verify(void* ptr, RustBuffer message, void* signature, RustCallStatus *out_status +); +#endif #ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CLONE_BN254FIELDELEMENT #define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CLONE_BN254FIELDELEMENT void* uniffi_iota_sdk_ffi_fn_clone_bn254fieldelement(void* ptr, RustCallStatus *out_status @@ -4086,6 +4157,101 @@ void* uniffi_iota_sdk_ffi_fn_method_usersignatureverifier_with_zklogin_verifier( RustBuffer uniffi_iota_sdk_ffi_fn_method_usersignatureverifier_zklogin_verifier(void* ptr, RustCallStatus *out_status ); #endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CLONE_VALIDATORAGGREGATEDSIGNATURE +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CLONE_VALIDATORAGGREGATEDSIGNATURE +void* uniffi_iota_sdk_ffi_fn_clone_validatoraggregatedsignature(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_FREE_VALIDATORAGGREGATEDSIGNATURE +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_FREE_VALIDATORAGGREGATEDSIGNATURE +void uniffi_iota_sdk_ffi_fn_free_validatoraggregatedsignature(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_VALIDATORAGGREGATEDSIGNATURE_NEW +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_VALIDATORAGGREGATEDSIGNATURE_NEW +void* uniffi_iota_sdk_ffi_fn_constructor_validatoraggregatedsignature_new(uint64_t epoch, void* signature, RustBuffer bitmap_bytes, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORAGGREGATEDSIGNATURE_BITMAP_BYTES +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORAGGREGATEDSIGNATURE_BITMAP_BYTES +RustBuffer uniffi_iota_sdk_ffi_fn_method_validatoraggregatedsignature_bitmap_bytes(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORAGGREGATEDSIGNATURE_EPOCH +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORAGGREGATEDSIGNATURE_EPOCH +uint64_t uniffi_iota_sdk_ffi_fn_method_validatoraggregatedsignature_epoch(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORAGGREGATEDSIGNATURE_SIGNATURE +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORAGGREGATEDSIGNATURE_SIGNATURE +void* uniffi_iota_sdk_ffi_fn_method_validatoraggregatedsignature_signature(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CLONE_VALIDATORCOMMITTEESIGNATUREAGGREGATOR +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CLONE_VALIDATORCOMMITTEESIGNATUREAGGREGATOR +void* uniffi_iota_sdk_ffi_fn_clone_validatorcommitteesignatureaggregator(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_FREE_VALIDATORCOMMITTEESIGNATUREAGGREGATOR +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_FREE_VALIDATORCOMMITTEESIGNATUREAGGREGATOR +void uniffi_iota_sdk_ffi_fn_free_validatorcommitteesignatureaggregator(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_VALIDATORCOMMITTEESIGNATUREAGGREGATOR_NEW_CHECKPOINT_SUMMARY +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_VALIDATORCOMMITTEESIGNATUREAGGREGATOR_NEW_CHECKPOINT_SUMMARY +void* uniffi_iota_sdk_ffi_fn_constructor_validatorcommitteesignatureaggregator_new_checkpoint_summary(RustBuffer committee, void* summary, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORCOMMITTEESIGNATUREAGGREGATOR_ADD_SIGNATURE +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORCOMMITTEESIGNATUREAGGREGATOR_ADD_SIGNATURE +void uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureaggregator_add_signature(void* ptr, void* signature, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORCOMMITTEESIGNATUREAGGREGATOR_COMMITTEE +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORCOMMITTEESIGNATUREAGGREGATOR_COMMITTEE +RustBuffer uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureaggregator_committee(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORCOMMITTEESIGNATUREAGGREGATOR_FINISH +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORCOMMITTEESIGNATUREAGGREGATOR_FINISH +void* uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureaggregator_finish(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CLONE_VALIDATORCOMMITTEESIGNATUREVERIFIER +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CLONE_VALIDATORCOMMITTEESIGNATUREVERIFIER +void* uniffi_iota_sdk_ffi_fn_clone_validatorcommitteesignatureverifier(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_FREE_VALIDATORCOMMITTEESIGNATUREVERIFIER +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_FREE_VALIDATORCOMMITTEESIGNATUREVERIFIER +void uniffi_iota_sdk_ffi_fn_free_validatorcommitteesignatureverifier(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_VALIDATORCOMMITTEESIGNATUREVERIFIER_NEW +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_VALIDATORCOMMITTEESIGNATUREVERIFIER_NEW +void* uniffi_iota_sdk_ffi_fn_constructor_validatorcommitteesignatureverifier_new(RustBuffer committee, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORCOMMITTEESIGNATUREVERIFIER_COMMITTEE +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORCOMMITTEESIGNATUREVERIFIER_COMMITTEE +RustBuffer uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_committee(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORCOMMITTEESIGNATUREVERIFIER_VERIFY +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORCOMMITTEESIGNATUREVERIFIER_VERIFY +void uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_verify(void* ptr, RustBuffer message, void* signature, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORCOMMITTEESIGNATUREVERIFIER_VERIFY_AGGREGATED +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORCOMMITTEESIGNATUREVERIFIER_VERIFY_AGGREGATED +void uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_verify_aggregated(void* ptr, RustBuffer message, void* signature, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORCOMMITTEESIGNATUREVERIFIER_VERIFY_CHECKPOINT_SUMMARY +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORCOMMITTEESIGNATUREVERIFIER_VERIFY_CHECKPOINT_SUMMARY +void uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_verify_checkpoint_summary(void* ptr, void* summary, void* signature, RustCallStatus *out_status +); +#endif #ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CLONE_VALIDATOREXECUTIONTIMEOBSERVATION #define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CLONE_VALIDATOREXECUTIONTIMEOBSERVATION void* uniffi_iota_sdk_ffi_fn_clone_validatorexecutiontimeobservation(void* ptr, RustCallStatus *out_status @@ -4111,6 +4277,36 @@ RustBuffer uniffi_iota_sdk_ffi_fn_method_validatorexecutiontimeobservation_durat void* uniffi_iota_sdk_ffi_fn_method_validatorexecutiontimeobservation_validator(void* ptr, RustCallStatus *out_status ); #endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CLONE_VALIDATORSIGNATURE +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CLONE_VALIDATORSIGNATURE +void* uniffi_iota_sdk_ffi_fn_clone_validatorsignature(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_FREE_VALIDATORSIGNATURE +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_FREE_VALIDATORSIGNATURE +void uniffi_iota_sdk_ffi_fn_free_validatorsignature(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_VALIDATORSIGNATURE_NEW +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_VALIDATORSIGNATURE_NEW +void* uniffi_iota_sdk_ffi_fn_constructor_validatorsignature_new(uint64_t epoch, void* public_key, void* signature, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORSIGNATURE_EPOCH +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORSIGNATURE_EPOCH +uint64_t uniffi_iota_sdk_ffi_fn_method_validatorsignature_epoch(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORSIGNATURE_PUBLIC_KEY +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORSIGNATURE_PUBLIC_KEY +void* uniffi_iota_sdk_ffi_fn_method_validatorsignature_public_key(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORSIGNATURE_SIGNATURE +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_METHOD_VALIDATORSIGNATURE_SIGNATURE +void* uniffi_iota_sdk_ffi_fn_method_validatorsignature_signature(void* ptr, RustCallStatus *out_status +); +#endif #ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CLONE_VERSIONASSIGNMENT #define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CLONE_VERSIONASSIGNMENT void* uniffi_iota_sdk_ffi_fn_clone_versionassignment(void* ptr, RustCallStatus *out_status @@ -4604,6 +4800,36 @@ uint16_t uniffi_iota_sdk_ffi_checksum_method_address_to_hex(void #define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_ARGUMENT_GET_NESTED_RESULT uint16_t uniffi_iota_sdk_ffi_checksum_method_argument_get_nested_result(void +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_BLS12381PRIVATEKEY_PUBLIC_KEY +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_BLS12381PRIVATEKEY_PUBLIC_KEY +uint16_t uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_public_key(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_BLS12381PRIVATEKEY_SCHEME +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_BLS12381PRIVATEKEY_SCHEME +uint16_t uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_scheme(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_BLS12381PRIVATEKEY_SIGN_CHECKPOINT_SUMMARY +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_BLS12381PRIVATEKEY_SIGN_CHECKPOINT_SUMMARY +uint16_t uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_sign_checkpoint_summary(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_BLS12381PRIVATEKEY_TRY_SIGN +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_BLS12381PRIVATEKEY_TRY_SIGN +uint16_t uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_try_sign(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_BLS12381PRIVATEKEY_VERIFYING_KEY +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_BLS12381PRIVATEKEY_VERIFYING_KEY +uint16_t uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_verifying_key(void + ); #endif #ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_BLS12381PUBLICKEY_TO_BYTES @@ -4616,6 +4842,18 @@ uint16_t uniffi_iota_sdk_ffi_checksum_method_bls12381publickey_to_bytes(void #define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_BLS12381SIGNATURE_TO_BYTES uint16_t uniffi_iota_sdk_ffi_checksum_method_bls12381signature_to_bytes(void +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_BLS12381VERIFYINGKEY_PUBLIC_KEY +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_BLS12381VERIFYINGKEY_PUBLIC_KEY +uint16_t uniffi_iota_sdk_ffi_checksum_method_bls12381verifyingkey_public_key(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_BLS12381VERIFYINGKEY_VERIFY +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_BLS12381VERIFYINGKEY_VERIFY +uint16_t uniffi_iota_sdk_ffi_checksum_method_bls12381verifyingkey_verify(void + ); #endif #ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_BN254FIELDELEMENT_PADDED @@ -6812,6 +7050,66 @@ uint16_t uniffi_iota_sdk_ffi_checksum_method_usersignatureverifier_with_zklogin_ #define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_USERSIGNATUREVERIFIER_ZKLOGIN_VERIFIER uint16_t uniffi_iota_sdk_ffi_checksum_method_usersignatureverifier_zklogin_verifier(void +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORAGGREGATEDSIGNATURE_BITMAP_BYTES +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORAGGREGATEDSIGNATURE_BITMAP_BYTES +uint16_t uniffi_iota_sdk_ffi_checksum_method_validatoraggregatedsignature_bitmap_bytes(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORAGGREGATEDSIGNATURE_EPOCH +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORAGGREGATEDSIGNATURE_EPOCH +uint16_t uniffi_iota_sdk_ffi_checksum_method_validatoraggregatedsignature_epoch(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORAGGREGATEDSIGNATURE_SIGNATURE +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORAGGREGATEDSIGNATURE_SIGNATURE +uint16_t uniffi_iota_sdk_ffi_checksum_method_validatoraggregatedsignature_signature(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORCOMMITTEESIGNATUREAGGREGATOR_ADD_SIGNATURE +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORCOMMITTEESIGNATUREAGGREGATOR_ADD_SIGNATURE +uint16_t uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureaggregator_add_signature(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORCOMMITTEESIGNATUREAGGREGATOR_COMMITTEE +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORCOMMITTEESIGNATUREAGGREGATOR_COMMITTEE +uint16_t uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureaggregator_committee(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORCOMMITTEESIGNATUREAGGREGATOR_FINISH +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORCOMMITTEESIGNATUREAGGREGATOR_FINISH +uint16_t uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureaggregator_finish(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORCOMMITTEESIGNATUREVERIFIER_COMMITTEE +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORCOMMITTEESIGNATUREVERIFIER_COMMITTEE +uint16_t uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_committee(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORCOMMITTEESIGNATUREVERIFIER_VERIFY +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORCOMMITTEESIGNATUREVERIFIER_VERIFY +uint16_t uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_verify(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORCOMMITTEESIGNATUREVERIFIER_VERIFY_AGGREGATED +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORCOMMITTEESIGNATUREVERIFIER_VERIFY_AGGREGATED +uint16_t uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_verify_aggregated(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORCOMMITTEESIGNATUREVERIFIER_VERIFY_CHECKPOINT_SUMMARY +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORCOMMITTEESIGNATUREVERIFIER_VERIFY_CHECKPOINT_SUMMARY +uint16_t uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_verify_checkpoint_summary(void + ); #endif #ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATOREXECUTIONTIMEOBSERVATION_DURATION @@ -6824,6 +7122,24 @@ uint16_t uniffi_iota_sdk_ffi_checksum_method_validatorexecutiontimeobservation_d #define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATOREXECUTIONTIMEOBSERVATION_VALIDATOR uint16_t uniffi_iota_sdk_ffi_checksum_method_validatorexecutiontimeobservation_validator(void +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORSIGNATURE_EPOCH +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORSIGNATURE_EPOCH +uint16_t uniffi_iota_sdk_ffi_checksum_method_validatorsignature_epoch(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORSIGNATURE_PUBLIC_KEY +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORSIGNATURE_PUBLIC_KEY +uint16_t uniffi_iota_sdk_ffi_checksum_method_validatorsignature_public_key(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORSIGNATURE_SIGNATURE +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VALIDATORSIGNATURE_SIGNATURE +uint16_t uniffi_iota_sdk_ffi_checksum_method_validatorsignature_signature(void + ); #endif #ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_METHOD_VERSIONASSIGNMENT_OBJECT_ID @@ -6986,6 +7302,18 @@ uint16_t uniffi_iota_sdk_ffi_checksum_constructor_argument_new_nested_result(voi #define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_ARGUMENT_NEW_RESULT uint16_t uniffi_iota_sdk_ffi_checksum_constructor_argument_new_result(void +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_BLS12381PRIVATEKEY_GENERATE +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_BLS12381PRIVATEKEY_GENERATE +uint16_t uniffi_iota_sdk_ffi_checksum_constructor_bls12381privatekey_generate(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_BLS12381PRIVATEKEY_NEW +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_BLS12381PRIVATEKEY_NEW +uint16_t uniffi_iota_sdk_ffi_checksum_constructor_bls12381privatekey_new(void + ); #endif #ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_BLS12381PUBLICKEY_FROM_BYTES @@ -7022,6 +7350,12 @@ uint16_t uniffi_iota_sdk_ffi_checksum_constructor_bls12381signature_from_str(voi #define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_BLS12381SIGNATURE_GENERATE uint16_t uniffi_iota_sdk_ffi_checksum_constructor_bls12381signature_generate(void +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_BLS12381VERIFYINGKEY_NEW +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_BLS12381VERIFYINGKEY_NEW +uint16_t uniffi_iota_sdk_ffi_checksum_constructor_bls12381verifyingkey_new(void + ); #endif #ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_BN254FIELDELEMENT_FROM_BYTES @@ -8054,12 +8388,36 @@ uint16_t uniffi_iota_sdk_ffi_checksum_constructor_usersignature_new_zklogin(void #define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_USERSIGNATUREVERIFIER_NEW uint16_t uniffi_iota_sdk_ffi_checksum_constructor_usersignatureverifier_new(void +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_VALIDATORAGGREGATEDSIGNATURE_NEW +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_VALIDATORAGGREGATEDSIGNATURE_NEW +uint16_t uniffi_iota_sdk_ffi_checksum_constructor_validatoraggregatedsignature_new(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_VALIDATORCOMMITTEESIGNATUREAGGREGATOR_NEW_CHECKPOINT_SUMMARY +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_VALIDATORCOMMITTEESIGNATUREAGGREGATOR_NEW_CHECKPOINT_SUMMARY +uint16_t uniffi_iota_sdk_ffi_checksum_constructor_validatorcommitteesignatureaggregator_new_checkpoint_summary(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_VALIDATORCOMMITTEESIGNATUREVERIFIER_NEW +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_VALIDATORCOMMITTEESIGNATUREVERIFIER_NEW +uint16_t uniffi_iota_sdk_ffi_checksum_constructor_validatorcommitteesignatureverifier_new(void + ); #endif #ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_VALIDATOREXECUTIONTIMEOBSERVATION_NEW #define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_VALIDATOREXECUTIONTIMEOBSERVATION_NEW uint16_t uniffi_iota_sdk_ffi_checksum_constructor_validatorexecutiontimeobservation_new(void +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_VALIDATORSIGNATURE_NEW +#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_VALIDATORSIGNATURE_NEW +uint16_t uniffi_iota_sdk_ffi_checksum_constructor_validatorsignature_new(void + ); #endif #ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_VERSIONASSIGNMENT_NEW diff --git a/bindings/kotlin/lib/iota_sdk/iota_sdk_ffi.kt b/bindings/kotlin/lib/iota_sdk/iota_sdk_ffi.kt index 673bde718..7672729fb 100644 --- a/bindings/kotlin/lib/iota_sdk/iota_sdk_ffi.kt +++ b/bindings/kotlin/lib/iota_sdk/iota_sdk_ffi.kt @@ -2060,6 +2060,72 @@ internal interface UniffiForeignFutureCompleteVoid : com.sun.jna.Callback { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2102,10 +2168,24 @@ fun uniffi_iota_sdk_ffi_checksum_method_address_to_hex( ): Short fun uniffi_iota_sdk_ffi_checksum_method_argument_get_nested_result( ): Short +fun uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_public_key( +): Short +fun uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_scheme( +): Short +fun uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_sign_checkpoint_summary( +): Short +fun uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_try_sign( +): Short +fun uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_verifying_key( +): Short fun uniffi_iota_sdk_ffi_checksum_method_bls12381publickey_to_bytes( ): Short fun uniffi_iota_sdk_ffi_checksum_method_bls12381signature_to_bytes( ): Short +fun uniffi_iota_sdk_ffi_checksum_method_bls12381verifyingkey_public_key( +): Short +fun uniffi_iota_sdk_ffi_checksum_method_bls12381verifyingkey_verify( +): Short fun uniffi_iota_sdk_ffi_checksum_method_bn254fieldelement_padded( ): Short fun uniffi_iota_sdk_ffi_checksum_method_bn254fieldelement_unpadded( @@ -2838,10 +2918,36 @@ fun uniffi_iota_sdk_ffi_checksum_method_usersignatureverifier_with_zklogin_verif ): Short fun uniffi_iota_sdk_ffi_checksum_method_usersignatureverifier_zklogin_verifier( ): Short +fun uniffi_iota_sdk_ffi_checksum_method_validatoraggregatedsignature_bitmap_bytes( +): Short +fun uniffi_iota_sdk_ffi_checksum_method_validatoraggregatedsignature_epoch( +): Short +fun uniffi_iota_sdk_ffi_checksum_method_validatoraggregatedsignature_signature( +): Short +fun uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureaggregator_add_signature( +): Short +fun uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureaggregator_committee( +): Short +fun uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureaggregator_finish( +): Short +fun uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_committee( +): Short +fun uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_verify( +): Short +fun uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_verify_aggregated( +): Short +fun uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_verify_checkpoint_summary( +): Short fun uniffi_iota_sdk_ffi_checksum_method_validatorexecutiontimeobservation_duration( ): Short fun uniffi_iota_sdk_ffi_checksum_method_validatorexecutiontimeobservation_validator( ): Short +fun uniffi_iota_sdk_ffi_checksum_method_validatorsignature_epoch( +): Short +fun uniffi_iota_sdk_ffi_checksum_method_validatorsignature_public_key( +): Short +fun uniffi_iota_sdk_ffi_checksum_method_validatorsignature_signature( +): Short fun uniffi_iota_sdk_ffi_checksum_method_versionassignment_object_id( ): Short fun uniffi_iota_sdk_ffi_checksum_method_versionassignment_version( @@ -2896,6 +3002,10 @@ fun uniffi_iota_sdk_ffi_checksum_constructor_argument_new_nested_result( ): Short fun uniffi_iota_sdk_ffi_checksum_constructor_argument_new_result( ): Short +fun uniffi_iota_sdk_ffi_checksum_constructor_bls12381privatekey_generate( +): Short +fun uniffi_iota_sdk_ffi_checksum_constructor_bls12381privatekey_new( +): Short fun uniffi_iota_sdk_ffi_checksum_constructor_bls12381publickey_from_bytes( ): Short fun uniffi_iota_sdk_ffi_checksum_constructor_bls12381publickey_from_str( @@ -2908,6 +3018,8 @@ fun uniffi_iota_sdk_ffi_checksum_constructor_bls12381signature_from_str( ): Short fun uniffi_iota_sdk_ffi_checksum_constructor_bls12381signature_generate( ): Short +fun uniffi_iota_sdk_ffi_checksum_constructor_bls12381verifyingkey_new( +): Short fun uniffi_iota_sdk_ffi_checksum_constructor_bn254fieldelement_from_bytes( ): Short fun uniffi_iota_sdk_ffi_checksum_constructor_bn254fieldelement_from_str( @@ -3252,8 +3364,16 @@ fun uniffi_iota_sdk_ffi_checksum_constructor_usersignature_new_zklogin( ): Short fun uniffi_iota_sdk_ffi_checksum_constructor_usersignatureverifier_new( ): Short +fun uniffi_iota_sdk_ffi_checksum_constructor_validatoraggregatedsignature_new( +): Short +fun uniffi_iota_sdk_ffi_checksum_constructor_validatorcommitteesignatureaggregator_new_checkpoint_summary( +): Short +fun uniffi_iota_sdk_ffi_checksum_constructor_validatorcommitteesignatureverifier_new( +): Short fun uniffi_iota_sdk_ffi_checksum_constructor_validatorexecutiontimeobservation_new( ): Short +fun uniffi_iota_sdk_ffi_checksum_constructor_validatorsignature_new( +): Short fun uniffi_iota_sdk_ffi_checksum_constructor_versionassignment_new( ): Short fun uniffi_iota_sdk_ffi_checksum_constructor_zkloginauthenticator_new( @@ -3349,6 +3469,24 @@ fun uniffi_iota_sdk_ffi_fn_clone_batchsendstatus(`ptr`: Pointer,uniffi_out_err: ): Pointer fun uniffi_iota_sdk_ffi_fn_free_batchsendstatus(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, ): Unit +fun uniffi_iota_sdk_ffi_fn_clone_bls12381privatekey(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Pointer +fun uniffi_iota_sdk_ffi_fn_free_bls12381privatekey(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Unit +fun uniffi_iota_sdk_ffi_fn_constructor_bls12381privatekey_generate(uniffi_out_err: UniffiRustCallStatus, +): Pointer +fun uniffi_iota_sdk_ffi_fn_constructor_bls12381privatekey_new(`bytes`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): Pointer +fun uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_public_key(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Pointer +fun uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_scheme(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): RustBuffer.ByValue +fun uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_sign_checkpoint_summary(`ptr`: Pointer,`summary`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Pointer +fun uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_try_sign(`ptr`: Pointer,`message`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): Pointer +fun uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_verifying_key(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Pointer fun uniffi_iota_sdk_ffi_fn_clone_bls12381publickey(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, ): Pointer fun uniffi_iota_sdk_ffi_fn_free_bls12381publickey(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, @@ -3373,6 +3511,16 @@ fun uniffi_iota_sdk_ffi_fn_constructor_bls12381signature_generate(uniffi_out_err ): Pointer fun uniffi_iota_sdk_ffi_fn_method_bls12381signature_to_bytes(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue +fun uniffi_iota_sdk_ffi_fn_clone_bls12381verifyingkey(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Pointer +fun uniffi_iota_sdk_ffi_fn_free_bls12381verifyingkey(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Unit +fun uniffi_iota_sdk_ffi_fn_constructor_bls12381verifyingkey_new(`publicKey`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Pointer +fun uniffi_iota_sdk_ffi_fn_method_bls12381verifyingkey_public_key(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Pointer +fun uniffi_iota_sdk_ffi_fn_method_bls12381verifyingkey_verify(`ptr`: Pointer,`message`: RustBuffer.ByValue,`signature`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Unit fun uniffi_iota_sdk_ffi_fn_clone_bn254fieldelement(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, ): Pointer fun uniffi_iota_sdk_ffi_fn_free_bn254fieldelement(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, @@ -4781,6 +4929,44 @@ fun uniffi_iota_sdk_ffi_fn_method_usersignatureverifier_with_zklogin_verifier(`p ): Pointer fun uniffi_iota_sdk_ffi_fn_method_usersignatureverifier_zklogin_verifier(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue +fun uniffi_iota_sdk_ffi_fn_clone_validatoraggregatedsignature(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Pointer +fun uniffi_iota_sdk_ffi_fn_free_validatoraggregatedsignature(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Unit +fun uniffi_iota_sdk_ffi_fn_constructor_validatoraggregatedsignature_new(`epoch`: Long,`signature`: Pointer,`bitmapBytes`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): Pointer +fun uniffi_iota_sdk_ffi_fn_method_validatoraggregatedsignature_bitmap_bytes(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): RustBuffer.ByValue +fun uniffi_iota_sdk_ffi_fn_method_validatoraggregatedsignature_epoch(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Long +fun uniffi_iota_sdk_ffi_fn_method_validatoraggregatedsignature_signature(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Pointer +fun uniffi_iota_sdk_ffi_fn_clone_validatorcommitteesignatureaggregator(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Pointer +fun uniffi_iota_sdk_ffi_fn_free_validatorcommitteesignatureaggregator(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Unit +fun uniffi_iota_sdk_ffi_fn_constructor_validatorcommitteesignatureaggregator_new_checkpoint_summary(`committee`: RustBuffer.ByValue,`summary`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Pointer +fun uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureaggregator_add_signature(`ptr`: Pointer,`signature`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Unit +fun uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureaggregator_committee(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): RustBuffer.ByValue +fun uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureaggregator_finish(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Pointer +fun uniffi_iota_sdk_ffi_fn_clone_validatorcommitteesignatureverifier(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Pointer +fun uniffi_iota_sdk_ffi_fn_free_validatorcommitteesignatureverifier(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Unit +fun uniffi_iota_sdk_ffi_fn_constructor_validatorcommitteesignatureverifier_new(`committee`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): Pointer +fun uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_committee(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): RustBuffer.ByValue +fun uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_verify(`ptr`: Pointer,`message`: RustBuffer.ByValue,`signature`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Unit +fun uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_verify_aggregated(`ptr`: Pointer,`message`: RustBuffer.ByValue,`signature`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Unit +fun uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_verify_checkpoint_summary(`ptr`: Pointer,`summary`: Pointer,`signature`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Unit fun uniffi_iota_sdk_ffi_fn_clone_validatorexecutiontimeobservation(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, ): Pointer fun uniffi_iota_sdk_ffi_fn_free_validatorexecutiontimeobservation(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, @@ -4791,6 +4977,18 @@ fun uniffi_iota_sdk_ffi_fn_method_validatorexecutiontimeobservation_duration(`pt ): RustBuffer.ByValue fun uniffi_iota_sdk_ffi_fn_method_validatorexecutiontimeobservation_validator(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, ): Pointer +fun uniffi_iota_sdk_ffi_fn_clone_validatorsignature(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Pointer +fun uniffi_iota_sdk_ffi_fn_free_validatorsignature(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Unit +fun uniffi_iota_sdk_ffi_fn_constructor_validatorsignature_new(`epoch`: Long,`publicKey`: Pointer,`signature`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Pointer +fun uniffi_iota_sdk_ffi_fn_method_validatorsignature_epoch(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Long +fun uniffi_iota_sdk_ffi_fn_method_validatorsignature_public_key(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Pointer +fun uniffi_iota_sdk_ffi_fn_method_validatorsignature_signature(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, +): Pointer fun uniffi_iota_sdk_ffi_fn_clone_versionassignment(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, ): Pointer fun uniffi_iota_sdk_ffi_fn_free_versionassignment(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, @@ -5004,12 +5202,33 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) { if (lib.uniffi_iota_sdk_ffi_checksum_method_argument_get_nested_result() != 53358.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_public_key() != 53765.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_scheme() != 8293.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_sign_checkpoint_summary() != 1487.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_try_sign() != 59341.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_verifying_key() != 36438.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_iota_sdk_ffi_checksum_method_bls12381publickey_to_bytes() != 9890.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } if (lib.uniffi_iota_sdk_ffi_checksum_method_bls12381signature_to_bytes() != 56969.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_iota_sdk_ffi_checksum_method_bls12381verifyingkey_public_key() != 59353.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_iota_sdk_ffi_checksum_method_bls12381verifyingkey_verify() != 54718.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_iota_sdk_ffi_checksum_method_bn254fieldelement_padded() != 44301.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -6108,12 +6327,51 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) { if (lib.uniffi_iota_sdk_ffi_checksum_method_usersignatureverifier_zklogin_verifier() != 9821.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_iota_sdk_ffi_checksum_method_validatoraggregatedsignature_bitmap_bytes() != 59039.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_iota_sdk_ffi_checksum_method_validatoraggregatedsignature_epoch() != 54283.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_iota_sdk_ffi_checksum_method_validatoraggregatedsignature_signature() != 39125.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureaggregator_add_signature() != 13923.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureaggregator_committee() != 36159.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureaggregator_finish() != 7324.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_committee() != 5093.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_verify() != 29238.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_verify_aggregated() != 46271.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_verify_checkpoint_summary() != 36331.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_iota_sdk_ffi_checksum_method_validatorexecutiontimeobservation_duration() != 59803.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } if (lib.uniffi_iota_sdk_ffi_checksum_method_validatorexecutiontimeobservation_validator() != 10003.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_iota_sdk_ffi_checksum_method_validatorsignature_epoch() != 15301.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_iota_sdk_ffi_checksum_method_validatorsignature_public_key() != 16384.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_iota_sdk_ffi_checksum_method_validatorsignature_signature() != 58273.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_iota_sdk_ffi_checksum_method_versionassignment_object_id() != 50440.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -6195,6 +6453,12 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) { if (lib.uniffi_iota_sdk_ffi_checksum_constructor_argument_new_result() != 44025.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381privatekey_generate() != 14780.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381privatekey_new() != 52467.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381publickey_from_bytes() != 6069.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -6213,6 +6477,9 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) { if (lib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381signature_generate() != 58435.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381verifyingkey_new() != 22402.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_iota_sdk_ffi_checksum_constructor_bn254fieldelement_from_bytes() != 3672.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -6729,9 +6996,21 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) { if (lib.uniffi_iota_sdk_ffi_checksum_constructor_usersignatureverifier_new() != 32322.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_iota_sdk_ffi_checksum_constructor_validatoraggregatedsignature_new() != 15846.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_iota_sdk_ffi_checksum_constructor_validatorcommitteesignatureaggregator_new_checkpoint_summary() != 25823.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_iota_sdk_ffi_checksum_constructor_validatorcommitteesignatureverifier_new() != 17424.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_iota_sdk_ffi_checksum_constructor_validatorexecutiontimeobservation_new() != 47546.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_iota_sdk_ffi_checksum_constructor_validatorsignature_new() != 2599.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_iota_sdk_ffi_checksum_constructor_versionassignment_new() != 14186.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -8267,46 +8546,22 @@ public object FfiConverterTypeBatchSendStatus: FfiConverter + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_bls12381privatekey_new( + FfiConverterByteArray.lower(`bytes`),_status) +} + ) protected val pointer: Pointer? protected val cleanable: UniffiCleaner.Cleanable @@ -8376,7 +8638,7 @@ open class Bls12381PublicKey: Disposable, AutoCloseable, Bls12381PublicKeyInterf override fun run() { pointer?.let { ptr -> uniffiRustCall { status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_bls12381publickey(ptr, status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_bls12381privatekey(ptr, status) } } } @@ -8384,15 +8646,27 @@ open class Bls12381PublicKey: Disposable, AutoCloseable, Bls12381PublicKeyInterf fun uniffiClonePointer(): Pointer { return uniffiRustCall() { status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_bls12381publickey(pointer!!, status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_bls12381privatekey(pointer!!, status) } } - override fun `toBytes`(): kotlin.ByteArray { - return FfiConverterByteArray.lift( + override fun `publicKey`(): Bls12381PublicKey { + return FfiConverterTypeBls12381PublicKey.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_bls12381publickey_to_bytes( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_public_key( + it, _status) +} + } + ) + } + + + override fun `scheme`(): SignatureScheme { + return FfiConverterTypeSignatureScheme.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_scheme( it, _status) } } @@ -8400,36 +8674,51 @@ open class Bls12381PublicKey: Disposable, AutoCloseable, Bls12381PublicKeyInterf } + override fun `signCheckpointSummary`(`summary`: CheckpointSummary): ValidatorSignature { + return FfiConverterTypeValidatorSignature.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_sign_checkpoint_summary( + it, FfiConverterTypeCheckpointSummary.lower(`summary`),_status) +} + } + ) + } - companion object { - - @Throws(SdkFfiException::class) fun `fromBytes`(`bytes`: kotlin.ByteArray): Bls12381PublicKey { - return FfiConverterTypeBls12381PublicKey.lift( + @Throws(SdkFfiException::class)override fun `trySign`(`message`: kotlin.ByteArray): Bls12381Signature { + return FfiConverterTypeBls12381Signature.lift( + callWithPointer { uniffiRustCallWithError(SdkFfiException) { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_bls12381publickey_from_bytes( - FfiConverterByteArray.lower(`bytes`),_status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_try_sign( + it, FfiConverterByteArray.lower(`message`),_status) } + } ) } - - @Throws(SdkFfiException::class) fun `fromStr`(`s`: kotlin.String): Bls12381PublicKey { - return FfiConverterTypeBls12381PublicKey.lift( - uniffiRustCallWithError(SdkFfiException) { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_bls12381publickey_from_str( - FfiConverterString.lower(`s`),_status) + override fun `verifyingKey`(): Bls12381VerifyingKey { + return FfiConverterTypeBls12381VerifyingKey.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_verifying_key( + it, _status) } + } ) } - fun `generate`(): Bls12381PublicKey { - return FfiConverterTypeBls12381PublicKey.lift( + + + + companion object { + fun `generate`(): Bls12381PrivateKey { + return FfiConverterTypeBls12381PrivateKey.lift( uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_bls12381publickey_generate( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_bls12381privatekey_generate( _status) } ) @@ -8444,25 +8733,25 @@ open class Bls12381PublicKey: Disposable, AutoCloseable, Bls12381PublicKeyInterf /** * @suppress */ -public object FfiConverterTypeBls12381PublicKey: FfiConverter { +public object FfiConverterTypeBls12381PrivateKey: FfiConverter { - override fun lower(value: Bls12381PublicKey): Pointer { + override fun lower(value: Bls12381PrivateKey): Pointer { return value.uniffiClonePointer() } - override fun lift(value: Pointer): Bls12381PublicKey { - return Bls12381PublicKey(value) + override fun lift(value: Pointer): Bls12381PrivateKey { + return Bls12381PrivateKey(value) } - override fun read(buf: ByteBuffer): Bls12381PublicKey { + override fun read(buf: ByteBuffer): Bls12381PrivateKey { // The Rust code always writes pointers as 8 bytes, and will // fail to compile if they don't fit. return lift(Pointer(buf.getLong())) } - override fun allocationSize(value: Bls12381PublicKey) = 8UL + override fun allocationSize(value: Bls12381PrivateKey) = 8UL - override fun write(value: Bls12381PublicKey, buf: ByteBuffer) { + override fun write(value: Bls12381PrivateKey, buf: ByteBuffer) { // The Rust code always expects pointers written as 8 bytes, // and will fail to compile if they don't fit. buf.putLong(Pointer.nativeValue(lower(value))) @@ -8584,7 +8873,7 @@ public object FfiConverterTypeBls12381PublicKey: FfiConverter uniffiRustCall { status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_bls12381signature(ptr, status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_bls12381publickey(ptr, status) } } } @@ -8685,7 +8974,7 @@ open class Bls12381Signature: Disposable, AutoCloseable, Bls12381SignatureInterf fun uniffiClonePointer(): Pointer { return uniffiRustCall() { status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_bls12381signature(pointer!!, status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_bls12381publickey(pointer!!, status) } } @@ -8693,7 +8982,7 @@ open class Bls12381Signature: Disposable, AutoCloseable, Bls12381SignatureInterf return FfiConverterByteArray.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_bls12381signature_to_bytes( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_bls12381publickey_to_bytes( it, _status) } } @@ -8706,10 +8995,10 @@ open class Bls12381Signature: Disposable, AutoCloseable, Bls12381SignatureInterf companion object { - @Throws(SdkFfiException::class) fun `fromBytes`(`bytes`: kotlin.ByteArray): Bls12381Signature { - return FfiConverterTypeBls12381Signature.lift( + @Throws(SdkFfiException::class) fun `fromBytes`(`bytes`: kotlin.ByteArray): Bls12381PublicKey { + return FfiConverterTypeBls12381PublicKey.lift( uniffiRustCallWithError(SdkFfiException) { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_bls12381signature_from_bytes( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_bls12381publickey_from_bytes( FfiConverterByteArray.lower(`bytes`),_status) } ) @@ -8717,20 +9006,20 @@ open class Bls12381Signature: Disposable, AutoCloseable, Bls12381SignatureInterf - @Throws(SdkFfiException::class) fun `fromStr`(`s`: kotlin.String): Bls12381Signature { - return FfiConverterTypeBls12381Signature.lift( + @Throws(SdkFfiException::class) fun `fromStr`(`s`: kotlin.String): Bls12381PublicKey { + return FfiConverterTypeBls12381PublicKey.lift( uniffiRustCallWithError(SdkFfiException) { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_bls12381signature_from_str( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_bls12381publickey_from_str( FfiConverterString.lower(`s`),_status) } ) } - fun `generate`(): Bls12381Signature { - return FfiConverterTypeBls12381Signature.lift( + fun `generate`(): Bls12381PublicKey { + return FfiConverterTypeBls12381PublicKey.lift( uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_bls12381signature_generate( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_bls12381publickey_generate( _status) } ) @@ -8745,25 +9034,25 @@ open class Bls12381Signature: Disposable, AutoCloseable, Bls12381SignatureInterf /** * @suppress */ -public object FfiConverterTypeBls12381Signature: FfiConverter { +public object FfiConverterTypeBls12381PublicKey: FfiConverter { - override fun lower(value: Bls12381Signature): Pointer { + override fun lower(value: Bls12381PublicKey): Pointer { return value.uniffiClonePointer() } - override fun lift(value: Pointer): Bls12381Signature { - return Bls12381Signature(value) + override fun lift(value: Pointer): Bls12381PublicKey { + return Bls12381PublicKey(value) } - override fun read(buf: ByteBuffer): Bls12381Signature { + override fun read(buf: ByteBuffer): Bls12381PublicKey { // The Rust code always writes pointers as 8 bytes, and will // fail to compile if they don't fit. return lift(Pointer(buf.getLong())) } - override fun allocationSize(value: Bls12381Signature) = 8UL + override fun allocationSize(value: Bls12381PublicKey) = 8UL - override fun write(value: Bls12381Signature, buf: ByteBuffer) { + override fun write(value: Bls12381PublicKey, buf: ByteBuffer) { // The Rust code always expects pointers written as 8 bytes, // and will fail to compile if they don't fit. buf.putLong(Pointer.nativeValue(lower(value))) @@ -8870,45 +9159,45 @@ public object FfiConverterTypeBls12381Signature: FfiConverter uniffiRustCall { status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_bn254fieldelement(ptr, status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_bls12381signature(ptr, status) } } } @@ -8986,27 +9275,15 @@ open class Bn254FieldElement: Disposable, AutoCloseable, Bn254FieldElementInterf fun uniffiClonePointer(): Pointer { return uniffiRustCall() { status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_bn254fieldelement(pointer!!, status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_bls12381signature(pointer!!, status) } } - override fun `padded`(): kotlin.ByteArray { - return FfiConverterByteArray.lift( - callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_bn254fieldelement_padded( - it, _status) -} - } - ) - } - - - override fun `unpadded`(): kotlin.ByteArray { + override fun `toBytes`(): kotlin.ByteArray { return FfiConverterByteArray.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_bn254fieldelement_unpadded( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_bls12381signature_to_bytes( it, _status) } } @@ -9019,10 +9296,10 @@ open class Bn254FieldElement: Disposable, AutoCloseable, Bn254FieldElementInterf companion object { - @Throws(SdkFfiException::class) fun `fromBytes`(`bytes`: kotlin.ByteArray): Bn254FieldElement { - return FfiConverterTypeBn254FieldElement.lift( + @Throws(SdkFfiException::class) fun `fromBytes`(`bytes`: kotlin.ByteArray): Bls12381Signature { + return FfiConverterTypeBls12381Signature.lift( uniffiRustCallWithError(SdkFfiException) { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_bn254fieldelement_from_bytes( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_bls12381signature_from_bytes( FfiConverterByteArray.lower(`bytes`),_status) } ) @@ -9030,22 +9307,21 @@ open class Bn254FieldElement: Disposable, AutoCloseable, Bn254FieldElementInterf - @Throws(SdkFfiException::class) fun `fromStr`(`s`: kotlin.String): Bn254FieldElement { - return FfiConverterTypeBn254FieldElement.lift( + @Throws(SdkFfiException::class) fun `fromStr`(`s`: kotlin.String): Bls12381Signature { + return FfiConverterTypeBls12381Signature.lift( uniffiRustCallWithError(SdkFfiException) { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_bn254fieldelement_from_str( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_bls12381signature_from_str( FfiConverterString.lower(`s`),_status) } ) } - - @Throws(SdkFfiException::class) fun `fromStrRadix10`(`s`: kotlin.String): Bn254FieldElement { - return FfiConverterTypeBn254FieldElement.lift( - uniffiRustCallWithError(SdkFfiException) { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_bn254fieldelement_from_str_radix_10( - FfiConverterString.lower(`s`),_status) + fun `generate`(): Bls12381Signature { + return FfiConverterTypeBls12381Signature.lift( + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_bls12381signature_generate( + _status) } ) } @@ -9059,25 +9335,25 @@ open class Bn254FieldElement: Disposable, AutoCloseable, Bn254FieldElementInterf /** * @suppress */ -public object FfiConverterTypeBn254FieldElement: FfiConverter { +public object FfiConverterTypeBls12381Signature: FfiConverter { - override fun lower(value: Bn254FieldElement): Pointer { + override fun lower(value: Bls12381Signature): Pointer { return value.uniffiClonePointer() } - override fun lift(value: Pointer): Bn254FieldElement { - return Bn254FieldElement(value) + override fun lift(value: Pointer): Bls12381Signature { + return Bls12381Signature(value) } - override fun read(buf: ByteBuffer): Bn254FieldElement { + override fun read(buf: ByteBuffer): Bls12381Signature { // The Rust code always writes pointers as 8 bytes, and will // fail to compile if they don't fit. return lift(Pointer(buf.getLong())) } - override fun allocationSize(value: Bn254FieldElement) = 8UL + override fun allocationSize(value: Bls12381Signature) = 8UL - override fun write(value: Bn254FieldElement, buf: ByteBuffer) { + override fun write(value: Bls12381Signature, buf: ByteBuffer) { // The Rust code always expects pointers written as 8 bytes, // and will fail to compile if they don't fit. buf.putLong(Pointer.nativeValue(lower(value))) @@ -9183,38 +9459,16 @@ public object FfiConverterTypeBn254FieldElement: FfiConverter + fun `verify`(`message`: kotlin.ByteArray, `signature`: Bls12381Signature) companion object } -/** - * A transaction that was cancelled - * - * # BCS - * - * The BCS serialized form for this type is defined by the following ABNF: - * - * ```text - * cancelled-transaction = digest (vector version-assignment) - * ``` - */ -open class CancelledTransaction: Disposable, AutoCloseable, CancelledTransactionInterface +open class Bls12381VerifyingKey: Disposable, AutoCloseable, Bls12381VerifyingKeyInterface { constructor(pointer: Pointer) { @@ -9232,11 +9486,11 @@ open class CancelledTransaction: Disposable, AutoCloseable, CancelledTransaction this.pointer = null this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) } - constructor(`digest`: Digest, `versionAssignments`: List) : + constructor(`publicKey`: Bls12381PublicKey) : this( - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_cancelledtransaction_new( - FfiConverterTypeDigest.lower(`digest`),FfiConverterSequenceTypeVersionAssignment.lower(`versionAssignments`),_status) + uniffiRustCallWithError(SdkFfiException) { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_bls12381verifyingkey_new( + FfiConverterTypeBls12381PublicKey.lower(`publicKey`),_status) } ) @@ -9291,7 +9545,7 @@ open class CancelledTransaction: Disposable, AutoCloseable, CancelledTransaction override fun run() { pointer?.let { ptr -> uniffiRustCall { status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_cancelledtransaction(ptr, status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_bls12381verifyingkey(ptr, status) } } } @@ -9299,15 +9553,15 @@ open class CancelledTransaction: Disposable, AutoCloseable, CancelledTransaction fun uniffiClonePointer(): Pointer { return uniffiRustCall() { status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_cancelledtransaction(pointer!!, status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_bls12381verifyingkey(pointer!!, status) } } - override fun `digest`(): Digest { - return FfiConverterTypeDigest.lift( + override fun `publicKey`(): Bls12381PublicKey { + return FfiConverterTypeBls12381PublicKey.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_cancelledtransaction_digest( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_bls12381verifyingkey_public_key( it, _status) } } @@ -9315,16 +9569,16 @@ open class CancelledTransaction: Disposable, AutoCloseable, CancelledTransaction } - override fun `versionAssignments`(): List { - return FfiConverterSequenceTypeVersionAssignment.lift( + + @Throws(SdkFfiException::class)override fun `verify`(`message`: kotlin.ByteArray, `signature`: Bls12381Signature) + = callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_cancelledtransaction_version_assignments( - it, _status) + uniffiRustCallWithError(SdkFfiException) { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_bls12381verifyingkey_verify( + it, FfiConverterByteArray.lower(`message`),FfiConverterTypeBls12381Signature.lower(`signature`),_status) } } - ) - } + @@ -9338,25 +9592,25 @@ open class CancelledTransaction: Disposable, AutoCloseable, CancelledTransaction /** * @suppress */ -public object FfiConverterTypeCancelledTransaction: FfiConverter { +public object FfiConverterTypeBls12381VerifyingKey: FfiConverter { - override fun lower(value: CancelledTransaction): Pointer { + override fun lower(value: Bls12381VerifyingKey): Pointer { return value.uniffiClonePointer() } - override fun lift(value: Pointer): CancelledTransaction { - return CancelledTransaction(value) + override fun lift(value: Pointer): Bls12381VerifyingKey { + return Bls12381VerifyingKey(value) } - override fun read(buf: ByteBuffer): CancelledTransaction { + override fun read(buf: ByteBuffer): Bls12381VerifyingKey { // The Rust code always writes pointers as 8 bytes, and will // fail to compile if they don't fit. return lift(Pointer(buf.getLong())) } - override fun allocationSize(value: CancelledTransaction) = 8UL + override fun allocationSize(value: Bls12381VerifyingKey) = 8UL - override fun write(value: CancelledTransaction, buf: ByteBuffer) { + override fun write(value: Bls12381VerifyingKey, buf: ByteBuffer) { // The Rust code always expects pointers written as 8 bytes, // and will fail to compile if they don't fit. buf.putLong(Pointer.nativeValue(lower(value))) @@ -9463,88 +9717,45 @@ public object FfiConverterTypeCancelledTransaction: FfiConverter + fun `unpadded`(): kotlin.ByteArray companion object } /** - * System transaction used to change the epoch + * A point on the BN254 elliptic curve. + * + * This is a 32-byte, or 256-bit, value that is generally represented as + * radix10 when a human-readable display format is needed, and is represented + * as a 32-byte big-endian value while in memory. * * # BCS * * The BCS serialized form for this type is defined by the following ABNF: * * ```text - * change-epoch = u64 ; next epoch - * u64 ; protocol version - * u64 ; storage charge - * u64 ; computation charge - * u64 ; storage rebate - * u64 ; non-refundable storage fee - * u64 ; epoch start timestamp - * (vector system-package) + * bn254-field-element = *DIGIT ; which is then interpreted as a radix10 encoded 32-byte value * ``` */ -open class ChangeEpoch: Disposable, AutoCloseable, ChangeEpochInterface +open class Bn254FieldElement: Disposable, AutoCloseable, Bn254FieldElementInterface { constructor(pointer: Pointer) { @@ -9562,13 +9773,6 @@ open class ChangeEpoch: Disposable, AutoCloseable, ChangeEpochInterface this.pointer = null this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) } - constructor(`epoch`: kotlin.ULong, `protocolVersion`: kotlin.ULong, `storageCharge`: kotlin.ULong, `computationCharge`: kotlin.ULong, `storageRebate`: kotlin.ULong, `nonRefundableStorageFee`: kotlin.ULong, `epochStartTimestampMs`: kotlin.ULong, `systemPackages`: List) : - this( - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_changeepoch_new( - FfiConverterULong.lower(`epoch`),FfiConverterULong.lower(`protocolVersion`),FfiConverterULong.lower(`storageCharge`),FfiConverterULong.lower(`computationCharge`),FfiConverterULong.lower(`storageRebate`),FfiConverterULong.lower(`nonRefundableStorageFee`),FfiConverterULong.lower(`epochStartTimestampMs`),FfiConverterSequenceTypeSystemPackage.lower(`systemPackages`),_status) -} - ) protected val pointer: Pointer? protected val cleanable: UniffiCleaner.Cleanable @@ -9621,7 +9825,7 @@ open class ChangeEpoch: Disposable, AutoCloseable, ChangeEpochInterface override fun run() { pointer?.let { ptr -> uniffiRustCall { status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_changeepoch(ptr, status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_bn254fieldelement(ptr, status) } } } @@ -9629,18 +9833,15 @@ open class ChangeEpoch: Disposable, AutoCloseable, ChangeEpochInterface fun uniffiClonePointer(): Pointer { return uniffiRustCall() { status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_changeepoch(pointer!!, status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_bn254fieldelement(pointer!!, status) } } - - /** - * The total amount of gas charged for computation during the epoch. - */override fun `computationCharge`(): kotlin.ULong { - return FfiConverterULong.lift( + override fun `padded`(): kotlin.ByteArray { + return FfiConverterByteArray.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepoch_computation_charge( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_bn254fieldelement_padded( it, _status) } } @@ -9648,14 +9849,11 @@ open class ChangeEpoch: Disposable, AutoCloseable, ChangeEpochInterface } - - /** - * The next (to become) epoch ID. - */override fun `epoch`(): kotlin.ULong { - return FfiConverterULong.lift( + override fun `unpadded`(): kotlin.ByteArray { + return FfiConverterByteArray.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepoch_epoch( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_bn254fieldelement_unpadded( it, _status) } } @@ -9664,73 +9862,299 @@ open class ChangeEpoch: Disposable, AutoCloseable, ChangeEpochInterface - /** - * Unix timestamp when epoch started - */override fun `epochStartTimestampMs`(): kotlin.ULong { - return FfiConverterULong.lift( - callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepoch_epoch_start_timestamp_ms( - it, _status) + + + companion object { + + @Throws(SdkFfiException::class) fun `fromBytes`(`bytes`: kotlin.ByteArray): Bn254FieldElement { + return FfiConverterTypeBn254FieldElement.lift( + uniffiRustCallWithError(SdkFfiException) { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_bn254fieldelement_from_bytes( + FfiConverterByteArray.lower(`bytes`),_status) } - } ) } - - /** - * The non-refundable storage fee. - */override fun `nonRefundableStorageFee`(): kotlin.ULong { - return FfiConverterULong.lift( - callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepoch_non_refundable_storage_fee( - it, _status) + + @Throws(SdkFfiException::class) fun `fromStr`(`s`: kotlin.String): Bn254FieldElement { + return FfiConverterTypeBn254FieldElement.lift( + uniffiRustCallWithError(SdkFfiException) { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_bn254fieldelement_from_str( + FfiConverterString.lower(`s`),_status) } + ) } + + + + @Throws(SdkFfiException::class) fun `fromStrRadix10`(`s`: kotlin.String): Bn254FieldElement { + return FfiConverterTypeBn254FieldElement.lift( + uniffiRustCallWithError(SdkFfiException) { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_bn254fieldelement_from_str_radix_10( + FfiConverterString.lower(`s`),_status) +} ) } + + } - /** - * The protocol version in effect in the new epoch. - */override fun `protocolVersion`(): kotlin.ULong { - return FfiConverterULong.lift( - callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepoch_protocol_version( - it, _status) } + +/** + * @suppress + */ +public object FfiConverterTypeBn254FieldElement: FfiConverter { + + override fun lower(value: Bn254FieldElement): Pointer { + return value.uniffiClonePointer() } - ) + + override fun lift(value: Pointer): Bn254FieldElement { + return Bn254FieldElement(value) } - + override fun read(buf: ByteBuffer): Bn254FieldElement { + // The Rust code always writes pointers as 8 bytes, and will + // fail to compile if they don't fit. + return lift(Pointer(buf.getLong())) + } + + override fun allocationSize(value: Bn254FieldElement) = 8UL + + override fun write(value: Bn254FieldElement, buf: ByteBuffer) { + // The Rust code always expects pointers written as 8 bytes, + // and will fail to compile if they don't fit. + buf.putLong(Pointer.nativeValue(lower(value))) + } +} + + +// This template implements a class for working with a Rust struct via a Pointer/Arc +// to the live Rust struct on the other side of the FFI. +// +// Each instance implements core operations for working with the Rust `Arc` and the +// Kotlin Pointer to work with the live Rust struct on the other side of the FFI. +// +// There's some subtlety here, because we have to be careful not to operate on a Rust +// struct after it has been dropped, and because we must expose a public API for freeing +// theq Kotlin wrapper object in lieu of reliable finalizers. The core requirements are: +// +// * Each instance holds an opaque pointer to the underlying Rust struct. +// Method calls need to read this pointer from the object's state and pass it in to +// the Rust FFI. +// +// * When an instance is no longer needed, its pointer should be passed to a +// special destructor function provided by the Rust FFI, which will drop the +// underlying Rust struct. +// +// * Given an instance, calling code is expected to call the special +// `destroy` method in order to free it after use, either by calling it explicitly +// or by using a higher-level helper like the `use` method. Failing to do so risks +// leaking the underlying Rust struct. +// +// * We can't assume that calling code will do the right thing, and must be prepared +// to handle Kotlin method calls executing concurrently with or even after a call to +// `destroy`, and to handle multiple (possibly concurrent!) calls to `destroy`. +// +// * We must never allow Rust code to operate on the underlying Rust struct after +// the destructor has been called, and must never call the destructor more than once. +// Doing so may trigger memory unsafety. +// +// * To mitigate many of the risks of leaking memory and use-after-free unsafety, a `Cleaner` +// is implemented to call the destructor when the Kotlin object becomes unreachable. +// This is done in a background thread. This is not a panacea, and client code should be aware that +// 1. the thread may starve if some there are objects that have poorly performing +// `drop` methods or do significant work in their `drop` methods. +// 2. the thread is shared across the whole library. This can be tuned by using `android_cleaner = true`, +// or `android = true` in the [`kotlin` section of the `uniffi.toml` file](https://mozilla.github.io/uniffi-rs/kotlin/configuration.html). +// +// If we try to implement this with mutual exclusion on access to the pointer, there is the +// possibility of a race between a method call and a concurrent call to `destroy`: +// +// * Thread A starts a method call, reads the value of the pointer, but is interrupted +// before it can pass the pointer over the FFI to Rust. +// * Thread B calls `destroy` and frees the underlying Rust struct. +// * Thread A resumes, passing the already-read pointer value to Rust and triggering +// a use-after-free. +// +// One possible solution would be to use a `ReadWriteLock`, with each method call taking +// a read lock (and thus allowed to run concurrently) and the special `destroy` method +// taking a write lock (and thus blocking on live method calls). However, we aim not to +// generate methods with any hidden blocking semantics, and a `destroy` method that might +// block if called incorrectly seems to meet that bar. +// +// So, we achieve our goals by giving each instance an associated `AtomicLong` counter to track +// the number of in-flight method calls, and an `AtomicBoolean` flag to indicate whether `destroy` +// has been called. These are updated according to the following rules: +// +// * The initial value of the counter is 1, indicating a live object with no in-flight calls. +// The initial value for the flag is false. +// +// * At the start of each method call, we atomically check the counter. +// If it is 0 then the underlying Rust struct has already been destroyed and the call is aborted. +// If it is nonzero them we atomically increment it by 1 and proceed with the method call. +// +// * At the end of each method call, we atomically decrement and check the counter. +// If it has reached zero then we destroy the underlying Rust struct. +// +// * When `destroy` is called, we atomically flip the flag from false to true. +// If the flag was already true we silently fail. +// Otherwise we atomically decrement and check the counter. +// If it has reached zero then we destroy the underlying Rust struct. +// +// Astute readers may observe that this all sounds very similar to the way that Rust's `Arc` works, +// and indeed it is, with the addition of a flag to guard against multiple calls to `destroy`. +// +// The overall effect is that the underlying Rust struct is destroyed only when `destroy` has been +// called *and* all in-flight method calls have completed, avoiding violating any of the expectations +// of the underlying Rust code. +// +// This makes a cleaner a better alternative to _not_ calling `destroy()` as +// and when the object is finished with, but the abstraction is not perfect: if the Rust object's `drop` +// method is slow, and/or there are many objects to cleanup, and it's on a low end Android device, then the cleaner +// thread may be starved, and the app will leak memory. +// +// In this case, `destroy`ing manually may be a better solution. +// +// The cleaner can live side by side with the manual calling of `destroy`. In the order of responsiveness, uniffi objects +// with Rust peers are reclaimed: +// +// 1. By calling the `destroy` method of the object, which calls `rustObject.free()`. If that doesn't happen: +// 2. When the object becomes unreachable, AND the Cleaner thread gets to call `rustObject.free()`. If the thread is starved then: +// 3. The memory is reclaimed when the process terminates. +// +// [1] https://stackoverflow.com/questions/24376768/can-java-finalize-an-object-when-it-is-still-in-scope/24380219 +// + + +/** + * A transaction that was cancelled + * + * # BCS + * + * The BCS serialized form for this type is defined by the following ABNF: + * + * ```text + * cancelled-transaction = digest (vector version-assignment) + * ``` + */ +public interface CancelledTransactionInterface { + + fun `digest`(): Digest + fun `versionAssignments`(): List + + companion object +} + +/** + * A transaction that was cancelled + * + * # BCS + * + * The BCS serialized form for this type is defined by the following ABNF: + * + * ```text + * cancelled-transaction = digest (vector version-assignment) + * ``` + */ +open class CancelledTransaction: Disposable, AutoCloseable, CancelledTransactionInterface +{ + + constructor(pointer: Pointer) { + this.pointer = pointer + this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) + } + /** - * The total amount of gas charged for storage during the epoch. - */override fun `storageCharge`(): kotlin.ULong { - return FfiConverterULong.lift( - callWithPointer { + * This constructor can be used to instantiate a fake object. Only used for tests. Any + * attempt to actually use an object constructed this way will fail as there is no + * connected Rust object. + */ + @Suppress("UNUSED_PARAMETER") + constructor(noPointer: NoPointer) { + this.pointer = null + this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) + } + constructor(`digest`: Digest, `versionAssignments`: List) : + this( uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepoch_storage_charge( - it, _status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_cancelledtransaction_new( + FfiConverterTypeDigest.lower(`digest`),FfiConverterSequenceTypeVersionAssignment.lower(`versionAssignments`),_status) } - } ) + + protected val pointer: Pointer? + protected val cleanable: UniffiCleaner.Cleanable + + private val wasDestroyed = AtomicBoolean(false) + private val callCounter = AtomicLong(1) + + override fun destroy() { + // Only allow a single call to this method. + // TODO: maybe we should log a warning if called more than once? + if (this.wasDestroyed.compareAndSet(false, true)) { + // This decrement always matches the initial count of 1 given at creation time. + if (this.callCounter.decrementAndGet() == 0L) { + cleanable.clean() + } + } } - - - /** - * The amount of storage rebate refunded to the txn senders. - */override fun `storageRebate`(): kotlin.ULong { - return FfiConverterULong.lift( + @Synchronized + override fun close() { + this.destroy() + } + + internal inline fun callWithPointer(block: (ptr: Pointer) -> R): R { + // Check and increment the call counter, to keep the object alive. + // This needs a compare-and-set retry loop in case of concurrent updates. + do { + val c = this.callCounter.get() + if (c == 0L) { + throw IllegalStateException("${this.javaClass.simpleName} object has already been destroyed") + } + if (c == Long.MAX_VALUE) { + throw IllegalStateException("${this.javaClass.simpleName} call counter would overflow") + } + } while (! this.callCounter.compareAndSet(c, c + 1L)) + // Now we can safely do the method call without the pointer being freed concurrently. + try { + return block(this.uniffiClonePointer()) + } finally { + // This decrement always matches the increment we performed above. + if (this.callCounter.decrementAndGet() == 0L) { + cleanable.clean() + } + } + } + + // Use a static inner class instead of a closure so as not to accidentally + // capture `this` as part of the cleanable's action. + private class UniffiCleanAction(private val pointer: Pointer?) : Runnable { + override fun run() { + pointer?.let { ptr -> + uniffiRustCall { status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_cancelledtransaction(ptr, status) + } + } + } + } + + fun uniffiClonePointer(): Pointer { + return uniffiRustCall() { status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_cancelledtransaction(pointer!!, status) + } + } + + override fun `digest`(): Digest { + return FfiConverterTypeDigest.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepoch_storage_rebate( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_cancelledtransaction_digest( it, _status) } } @@ -9738,15 +10162,11 @@ open class ChangeEpoch: Disposable, AutoCloseable, ChangeEpochInterface } - - /** - * System packages (specifically framework and move stdlib) that are - * written before the new epoch starts. - */override fun `systemPackages`(): List { - return FfiConverterSequenceTypeSystemPackage.lift( + override fun `versionAssignments`(): List { + return FfiConverterSequenceTypeVersionAssignment.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepoch_system_packages( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_cancelledtransaction_version_assignments( it, _status) } } @@ -9765,25 +10185,25 @@ open class ChangeEpoch: Disposable, AutoCloseable, ChangeEpochInterface /** * @suppress */ -public object FfiConverterTypeChangeEpoch: FfiConverter { +public object FfiConverterTypeCancelledTransaction: FfiConverter { - override fun lower(value: ChangeEpoch): Pointer { + override fun lower(value: CancelledTransaction): Pointer { return value.uniffiClonePointer() } - override fun lift(value: Pointer): ChangeEpoch { - return ChangeEpoch(value) + override fun lift(value: Pointer): CancelledTransaction { + return CancelledTransaction(value) } - override fun read(buf: ByteBuffer): ChangeEpoch { + override fun read(buf: ByteBuffer): CancelledTransaction { // The Rust code always writes pointers as 8 bytes, and will // fail to compile if they don't fit. return lift(Pointer(buf.getLong())) } - override fun allocationSize(value: ChangeEpoch) = 8UL + override fun allocationSize(value: CancelledTransaction) = 8UL - override fun write(value: ChangeEpoch, buf: ByteBuffer) { + override fun write(value: CancelledTransaction, buf: ByteBuffer) { // The Rust code always expects pointers written as 8 bytes, // and will fail to compile if they don't fit. buf.putLong(Pointer.nativeValue(lower(value))) @@ -9901,25 +10321,19 @@ public object FfiConverterTypeChangeEpoch: FfiConverter { * u64 ; protocol version * u64 ; storage charge * u64 ; computation charge - * u64 ; computation charge burned * u64 ; storage rebate * u64 ; non-refundable storage fee * u64 ; epoch start timestamp * (vector system-package) * ``` */ -public interface ChangeEpochV2Interface { +public interface ChangeEpochInterface { /** * The total amount of gas charged for computation during the epoch. */ fun `computationCharge`(): kotlin.ULong - /** - * The total amount of gas burned for computation during the epoch. - */ - fun `computationChargeBurned`(): kotlin.ULong - /** * The next (to become) epoch ID. */ @@ -9971,14 +10385,13 @@ public interface ChangeEpochV2Interface { * u64 ; protocol version * u64 ; storage charge * u64 ; computation charge - * u64 ; computation charge burned * u64 ; storage rebate * u64 ; non-refundable storage fee * u64 ; epoch start timestamp * (vector system-package) * ``` */ -open class ChangeEpochV2: Disposable, AutoCloseable, ChangeEpochV2Interface +open class ChangeEpoch: Disposable, AutoCloseable, ChangeEpochInterface { constructor(pointer: Pointer) { @@ -9996,11 +10409,11 @@ open class ChangeEpochV2: Disposable, AutoCloseable, ChangeEpochV2Interface this.pointer = null this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) } - constructor(`epoch`: kotlin.ULong, `protocolVersion`: kotlin.ULong, `storageCharge`: kotlin.ULong, `computationCharge`: kotlin.ULong, `computationChargeBurned`: kotlin.ULong, `storageRebate`: kotlin.ULong, `nonRefundableStorageFee`: kotlin.ULong, `epochStartTimestampMs`: kotlin.ULong, `systemPackages`: List) : + constructor(`epoch`: kotlin.ULong, `protocolVersion`: kotlin.ULong, `storageCharge`: kotlin.ULong, `computationCharge`: kotlin.ULong, `storageRebate`: kotlin.ULong, `nonRefundableStorageFee`: kotlin.ULong, `epochStartTimestampMs`: kotlin.ULong, `systemPackages`: List) : this( uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_changeepochv2_new( - FfiConverterULong.lower(`epoch`),FfiConverterULong.lower(`protocolVersion`),FfiConverterULong.lower(`storageCharge`),FfiConverterULong.lower(`computationCharge`),FfiConverterULong.lower(`computationChargeBurned`),FfiConverterULong.lower(`storageRebate`),FfiConverterULong.lower(`nonRefundableStorageFee`),FfiConverterULong.lower(`epochStartTimestampMs`),FfiConverterSequenceTypeSystemPackage.lower(`systemPackages`),_status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_changeepoch_new( + FfiConverterULong.lower(`epoch`),FfiConverterULong.lower(`protocolVersion`),FfiConverterULong.lower(`storageCharge`),FfiConverterULong.lower(`computationCharge`),FfiConverterULong.lower(`storageRebate`),FfiConverterULong.lower(`nonRefundableStorageFee`),FfiConverterULong.lower(`epochStartTimestampMs`),FfiConverterSequenceTypeSystemPackage.lower(`systemPackages`),_status) } ) @@ -10055,7 +10468,7 @@ open class ChangeEpochV2: Disposable, AutoCloseable, ChangeEpochV2Interface override fun run() { pointer?.let { ptr -> uniffiRustCall { status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_changeepochv2(ptr, status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_changeepoch(ptr, status) } } } @@ -10063,7 +10476,7 @@ open class ChangeEpochV2: Disposable, AutoCloseable, ChangeEpochV2Interface fun uniffiClonePointer(): Pointer { return uniffiRustCall() { status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_changeepochv2(pointer!!, status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_changeepoch(pointer!!, status) } } @@ -10074,22 +10487,7 @@ open class ChangeEpochV2: Disposable, AutoCloseable, ChangeEpochV2Interface return FfiConverterULong.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepochv2_computation_charge( - it, _status) -} - } - ) - } - - - - /** - * The total amount of gas burned for computation during the epoch. - */override fun `computationChargeBurned`(): kotlin.ULong { - return FfiConverterULong.lift( - callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepochv2_computation_charge_burned( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepoch_computation_charge( it, _status) } } @@ -10104,7 +10502,7 @@ open class ChangeEpochV2: Disposable, AutoCloseable, ChangeEpochV2Interface return FfiConverterULong.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepochv2_epoch( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepoch_epoch( it, _status) } } @@ -10119,7 +10517,7 @@ open class ChangeEpochV2: Disposable, AutoCloseable, ChangeEpochV2Interface return FfiConverterULong.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepochv2_epoch_start_timestamp_ms( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepoch_epoch_start_timestamp_ms( it, _status) } } @@ -10134,7 +10532,7 @@ open class ChangeEpochV2: Disposable, AutoCloseable, ChangeEpochV2Interface return FfiConverterULong.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepochv2_non_refundable_storage_fee( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepoch_non_refundable_storage_fee( it, _status) } } @@ -10149,7 +10547,7 @@ open class ChangeEpochV2: Disposable, AutoCloseable, ChangeEpochV2Interface return FfiConverterULong.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepochv2_protocol_version( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepoch_protocol_version( it, _status) } } @@ -10164,7 +10562,7 @@ open class ChangeEpochV2: Disposable, AutoCloseable, ChangeEpochV2Interface return FfiConverterULong.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepochv2_storage_charge( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepoch_storage_charge( it, _status) } } @@ -10179,7 +10577,7 @@ open class ChangeEpochV2: Disposable, AutoCloseable, ChangeEpochV2Interface return FfiConverterULong.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepochv2_storage_rebate( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepoch_storage_rebate( it, _status) } } @@ -10195,7 +10593,7 @@ open class ChangeEpochV2: Disposable, AutoCloseable, ChangeEpochV2Interface return FfiConverterSequenceTypeSystemPackage.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepochv2_system_packages( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepoch_system_packages( it, _status) } } @@ -10214,25 +10612,25 @@ open class ChangeEpochV2: Disposable, AutoCloseable, ChangeEpochV2Interface /** * @suppress */ -public object FfiConverterTypeChangeEpochV2: FfiConverter { +public object FfiConverterTypeChangeEpoch: FfiConverter { - override fun lower(value: ChangeEpochV2): Pointer { + override fun lower(value: ChangeEpoch): Pointer { return value.uniffiClonePointer() } - override fun lift(value: Pointer): ChangeEpochV2 { - return ChangeEpochV2(value) + override fun lift(value: Pointer): ChangeEpoch { + return ChangeEpoch(value) } - override fun read(buf: ByteBuffer): ChangeEpochV2 { + override fun read(buf: ByteBuffer): ChangeEpoch { // The Rust code always writes pointers as 8 bytes, and will // fail to compile if they don't fit. return lift(Pointer(buf.getLong())) } - override fun allocationSize(value: ChangeEpochV2) = 8UL + override fun allocationSize(value: ChangeEpoch) = 8UL - override fun write(value: ChangeEpochV2, buf: ByteBuffer) { + override fun write(value: ChangeEpoch, buf: ByteBuffer) { // The Rust code always expects pointers written as 8 bytes, // and will fail to compile if they don't fit. buf.putLong(Pointer.nativeValue(lower(value))) @@ -10339,41 +10737,95 @@ public object FfiConverterTypeChangeEpochV2: FfiConverter companion object } /** - * A commitment made by a checkpoint. + * System transaction used to change the epoch * * # BCS * * The BCS serialized form for this type is defined by the following ABNF: * * ```text - * ; CheckpointCommitment is an enum and each variant is prefixed with its index - * checkpoint-commitment = ecmh-live-object-set - * ecmh-live-object-set = %x00 digest + * change-epoch = u64 ; next epoch + * u64 ; protocol version + * u64 ; storage charge + * u64 ; computation charge + * u64 ; computation charge burned + * u64 ; storage rebate + * u64 ; non-refundable storage fee + * u64 ; epoch start timestamp + * (vector system-package) * ``` */ -open class CheckpointCommitment: Disposable, AutoCloseable, CheckpointCommitmentInterface +open class ChangeEpochV2: Disposable, AutoCloseable, ChangeEpochV2Interface { constructor(pointer: Pointer) { @@ -10391,6 +10843,13 @@ open class CheckpointCommitment: Disposable, AutoCloseable, CheckpointCommitment this.pointer = null this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) } + constructor(`epoch`: kotlin.ULong, `protocolVersion`: kotlin.ULong, `storageCharge`: kotlin.ULong, `computationCharge`: kotlin.ULong, `computationChargeBurned`: kotlin.ULong, `storageRebate`: kotlin.ULong, `nonRefundableStorageFee`: kotlin.ULong, `epochStartTimestampMs`: kotlin.ULong, `systemPackages`: List) : + this( + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_changeepochv2_new( + FfiConverterULong.lower(`epoch`),FfiConverterULong.lower(`protocolVersion`),FfiConverterULong.lower(`storageCharge`),FfiConverterULong.lower(`computationCharge`),FfiConverterULong.lower(`computationChargeBurned`),FfiConverterULong.lower(`storageRebate`),FfiConverterULong.lower(`nonRefundableStorageFee`),FfiConverterULong.lower(`epochStartTimestampMs`),FfiConverterSequenceTypeSystemPackage.lower(`systemPackages`),_status) +} + ) protected val pointer: Pointer? protected val cleanable: UniffiCleaner.Cleanable @@ -10443,7 +10902,7 @@ open class CheckpointCommitment: Disposable, AutoCloseable, CheckpointCommitment override fun run() { pointer?.let { ptr -> uniffiRustCall { status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_checkpointcommitment(ptr, status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_changeepochv2(ptr, status) } } } @@ -10451,11 +10910,399 @@ open class CheckpointCommitment: Disposable, AutoCloseable, CheckpointCommitment fun uniffiClonePointer(): Pointer { return uniffiRustCall() { status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_checkpointcommitment(pointer!!, status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_changeepochv2(pointer!!, status) } } - override fun `asEcmhLiveObjectSetDigest`(): Digest { + + /** + * The total amount of gas charged for computation during the epoch. + */override fun `computationCharge`(): kotlin.ULong { + return FfiConverterULong.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepochv2_computation_charge( + it, _status) +} + } + ) + } + + + + /** + * The total amount of gas burned for computation during the epoch. + */override fun `computationChargeBurned`(): kotlin.ULong { + return FfiConverterULong.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepochv2_computation_charge_burned( + it, _status) +} + } + ) + } + + + + /** + * The next (to become) epoch ID. + */override fun `epoch`(): kotlin.ULong { + return FfiConverterULong.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepochv2_epoch( + it, _status) +} + } + ) + } + + + + /** + * Unix timestamp when epoch started + */override fun `epochStartTimestampMs`(): kotlin.ULong { + return FfiConverterULong.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepochv2_epoch_start_timestamp_ms( + it, _status) +} + } + ) + } + + + + /** + * The non-refundable storage fee. + */override fun `nonRefundableStorageFee`(): kotlin.ULong { + return FfiConverterULong.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepochv2_non_refundable_storage_fee( + it, _status) +} + } + ) + } + + + + /** + * The protocol version in effect in the new epoch. + */override fun `protocolVersion`(): kotlin.ULong { + return FfiConverterULong.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepochv2_protocol_version( + it, _status) +} + } + ) + } + + + + /** + * The total amount of gas charged for storage during the epoch. + */override fun `storageCharge`(): kotlin.ULong { + return FfiConverterULong.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepochv2_storage_charge( + it, _status) +} + } + ) + } + + + + /** + * The amount of storage rebate refunded to the txn senders. + */override fun `storageRebate`(): kotlin.ULong { + return FfiConverterULong.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepochv2_storage_rebate( + it, _status) +} + } + ) + } + + + + /** + * System packages (specifically framework and move stdlib) that are + * written before the new epoch starts. + */override fun `systemPackages`(): List { + return FfiConverterSequenceTypeSystemPackage.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_changeepochv2_system_packages( + it, _status) +} + } + ) + } + + + + + + + companion object + +} + +/** + * @suppress + */ +public object FfiConverterTypeChangeEpochV2: FfiConverter { + + override fun lower(value: ChangeEpochV2): Pointer { + return value.uniffiClonePointer() + } + + override fun lift(value: Pointer): ChangeEpochV2 { + return ChangeEpochV2(value) + } + + override fun read(buf: ByteBuffer): ChangeEpochV2 { + // The Rust code always writes pointers as 8 bytes, and will + // fail to compile if they don't fit. + return lift(Pointer(buf.getLong())) + } + + override fun allocationSize(value: ChangeEpochV2) = 8UL + + override fun write(value: ChangeEpochV2, buf: ByteBuffer) { + // The Rust code always expects pointers written as 8 bytes, + // and will fail to compile if they don't fit. + buf.putLong(Pointer.nativeValue(lower(value))) + } +} + + +// This template implements a class for working with a Rust struct via a Pointer/Arc +// to the live Rust struct on the other side of the FFI. +// +// Each instance implements core operations for working with the Rust `Arc` and the +// Kotlin Pointer to work with the live Rust struct on the other side of the FFI. +// +// There's some subtlety here, because we have to be careful not to operate on a Rust +// struct after it has been dropped, and because we must expose a public API for freeing +// theq Kotlin wrapper object in lieu of reliable finalizers. The core requirements are: +// +// * Each instance holds an opaque pointer to the underlying Rust struct. +// Method calls need to read this pointer from the object's state and pass it in to +// the Rust FFI. +// +// * When an instance is no longer needed, its pointer should be passed to a +// special destructor function provided by the Rust FFI, which will drop the +// underlying Rust struct. +// +// * Given an instance, calling code is expected to call the special +// `destroy` method in order to free it after use, either by calling it explicitly +// or by using a higher-level helper like the `use` method. Failing to do so risks +// leaking the underlying Rust struct. +// +// * We can't assume that calling code will do the right thing, and must be prepared +// to handle Kotlin method calls executing concurrently with or even after a call to +// `destroy`, and to handle multiple (possibly concurrent!) calls to `destroy`. +// +// * We must never allow Rust code to operate on the underlying Rust struct after +// the destructor has been called, and must never call the destructor more than once. +// Doing so may trigger memory unsafety. +// +// * To mitigate many of the risks of leaking memory and use-after-free unsafety, a `Cleaner` +// is implemented to call the destructor when the Kotlin object becomes unreachable. +// This is done in a background thread. This is not a panacea, and client code should be aware that +// 1. the thread may starve if some there are objects that have poorly performing +// `drop` methods or do significant work in their `drop` methods. +// 2. the thread is shared across the whole library. This can be tuned by using `android_cleaner = true`, +// or `android = true` in the [`kotlin` section of the `uniffi.toml` file](https://mozilla.github.io/uniffi-rs/kotlin/configuration.html). +// +// If we try to implement this with mutual exclusion on access to the pointer, there is the +// possibility of a race between a method call and a concurrent call to `destroy`: +// +// * Thread A starts a method call, reads the value of the pointer, but is interrupted +// before it can pass the pointer over the FFI to Rust. +// * Thread B calls `destroy` and frees the underlying Rust struct. +// * Thread A resumes, passing the already-read pointer value to Rust and triggering +// a use-after-free. +// +// One possible solution would be to use a `ReadWriteLock`, with each method call taking +// a read lock (and thus allowed to run concurrently) and the special `destroy` method +// taking a write lock (and thus blocking on live method calls). However, we aim not to +// generate methods with any hidden blocking semantics, and a `destroy` method that might +// block if called incorrectly seems to meet that bar. +// +// So, we achieve our goals by giving each instance an associated `AtomicLong` counter to track +// the number of in-flight method calls, and an `AtomicBoolean` flag to indicate whether `destroy` +// has been called. These are updated according to the following rules: +// +// * The initial value of the counter is 1, indicating a live object with no in-flight calls. +// The initial value for the flag is false. +// +// * At the start of each method call, we atomically check the counter. +// If it is 0 then the underlying Rust struct has already been destroyed and the call is aborted. +// If it is nonzero them we atomically increment it by 1 and proceed with the method call. +// +// * At the end of each method call, we atomically decrement and check the counter. +// If it has reached zero then we destroy the underlying Rust struct. +// +// * When `destroy` is called, we atomically flip the flag from false to true. +// If the flag was already true we silently fail. +// Otherwise we atomically decrement and check the counter. +// If it has reached zero then we destroy the underlying Rust struct. +// +// Astute readers may observe that this all sounds very similar to the way that Rust's `Arc` works, +// and indeed it is, with the addition of a flag to guard against multiple calls to `destroy`. +// +// The overall effect is that the underlying Rust struct is destroyed only when `destroy` has been +// called *and* all in-flight method calls have completed, avoiding violating any of the expectations +// of the underlying Rust code. +// +// This makes a cleaner a better alternative to _not_ calling `destroy()` as +// and when the object is finished with, but the abstraction is not perfect: if the Rust object's `drop` +// method is slow, and/or there are many objects to cleanup, and it's on a low end Android device, then the cleaner +// thread may be starved, and the app will leak memory. +// +// In this case, `destroy`ing manually may be a better solution. +// +// The cleaner can live side by side with the manual calling of `destroy`. In the order of responsiveness, uniffi objects +// with Rust peers are reclaimed: +// +// 1. By calling the `destroy` method of the object, which calls `rustObject.free()`. If that doesn't happen: +// 2. When the object becomes unreachable, AND the Cleaner thread gets to call `rustObject.free()`. If the thread is starved then: +// 3. The memory is reclaimed when the process terminates. +// +// [1] https://stackoverflow.com/questions/24376768/can-java-finalize-an-object-when-it-is-still-in-scope/24380219 +// + + +/** + * A commitment made by a checkpoint. + * + * # BCS + * + * The BCS serialized form for this type is defined by the following ABNF: + * + * ```text + * ; CheckpointCommitment is an enum and each variant is prefixed with its index + * checkpoint-commitment = ecmh-live-object-set + * ecmh-live-object-set = %x00 digest + * ``` + */ +public interface CheckpointCommitmentInterface { + + fun `asEcmhLiveObjectSetDigest`(): Digest + + fun `isEcmhLiveObjectSet`(): kotlin.Boolean + + companion object +} + +/** + * A commitment made by a checkpoint. + * + * # BCS + * + * The BCS serialized form for this type is defined by the following ABNF: + * + * ```text + * ; CheckpointCommitment is an enum and each variant is prefixed with its index + * checkpoint-commitment = ecmh-live-object-set + * ecmh-live-object-set = %x00 digest + * ``` + */ +open class CheckpointCommitment: Disposable, AutoCloseable, CheckpointCommitmentInterface +{ + + constructor(pointer: Pointer) { + this.pointer = pointer + this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) + } + + /** + * This constructor can be used to instantiate a fake object. Only used for tests. Any + * attempt to actually use an object constructed this way will fail as there is no + * connected Rust object. + */ + @Suppress("UNUSED_PARAMETER") + constructor(noPointer: NoPointer) { + this.pointer = null + this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) + } + + protected val pointer: Pointer? + protected val cleanable: UniffiCleaner.Cleanable + + private val wasDestroyed = AtomicBoolean(false) + private val callCounter = AtomicLong(1) + + override fun destroy() { + // Only allow a single call to this method. + // TODO: maybe we should log a warning if called more than once? + if (this.wasDestroyed.compareAndSet(false, true)) { + // This decrement always matches the initial count of 1 given at creation time. + if (this.callCounter.decrementAndGet() == 0L) { + cleanable.clean() + } + } + } + + @Synchronized + override fun close() { + this.destroy() + } + + internal inline fun callWithPointer(block: (ptr: Pointer) -> R): R { + // Check and increment the call counter, to keep the object alive. + // This needs a compare-and-set retry loop in case of concurrent updates. + do { + val c = this.callCounter.get() + if (c == 0L) { + throw IllegalStateException("${this.javaClass.simpleName} object has already been destroyed") + } + if (c == Long.MAX_VALUE) { + throw IllegalStateException("${this.javaClass.simpleName} call counter would overflow") + } + } while (! this.callCounter.compareAndSet(c, c + 1L)) + // Now we can safely do the method call without the pointer being freed concurrently. + try { + return block(this.uniffiClonePointer()) + } finally { + // This decrement always matches the increment we performed above. + if (this.callCounter.decrementAndGet() == 0L) { + cleanable.clean() + } + } + } + + // Use a static inner class instead of a closure so as not to accidentally + // capture `this` as part of the cleanable's action. + private class UniffiCleanAction(private val pointer: Pointer?) : Runnable { + override fun run() { + pointer?.let { ptr -> + uniffiRustCall { status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_checkpointcommitment(ptr, status) + } + } + } + } + + fun uniffiClonePointer(): Pointer { + return uniffiRustCall() { status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_checkpointcommitment(pointer!!, status) + } + } + + override fun `asEcmhLiveObjectSetDigest`(): Digest { return FfiConverterTypeDigest.lift( callWithPointer { uniffiRustCall() { _status -> @@ -36701,67 +37548,1224 @@ open class UnresolvedInput: Disposable, AutoCloseable, UnresolvedInputInterface UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_unresolvedinput_new_owned( FfiConverterTypeObjectId.lower(`objectId`),FfiConverterULong.lower(`version`),FfiConverterTypeDigest.lower(`digest`),_status) } - ) + ) + } + + + + /** + * Return a receiving kind of object with all required fields. + */ fun `newReceiving`(`objectId`: ObjectId, `version`: kotlin.ULong, `digest`: Digest): UnresolvedInput { + return FfiConverterTypeUnresolvedInput.lift( + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_unresolvedinput_new_receiving( + FfiConverterTypeObjectId.lower(`objectId`),FfiConverterULong.lower(`version`),FfiConverterTypeDigest.lower(`digest`),_status) +} + ) + } + + + + /** + * Return a shared object. + * - `mutable` controls whether a command can accept the object by value or + * mutable reference. + * - `initial_shared_version` is the first version the object was shared + * at. + */ fun `newShared`(`objectId`: ObjectId, `initialSharedVersion`: kotlin.ULong, `mutable`: kotlin.Boolean): UnresolvedInput { + return FfiConverterTypeUnresolvedInput.lift( + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_unresolvedinput_new_shared( + FfiConverterTypeObjectId.lower(`objectId`),FfiConverterULong.lower(`initialSharedVersion`),FfiConverterBoolean.lower(`mutable`),_status) +} + ) + } + + + + } + +} + +/** + * @suppress + */ +public object FfiConverterTypeUnresolvedInput: FfiConverter { + + override fun lower(value: UnresolvedInput): Pointer { + return value.uniffiClonePointer() + } + + override fun lift(value: Pointer): UnresolvedInput { + return UnresolvedInput(value) + } + + override fun read(buf: ByteBuffer): UnresolvedInput { + // The Rust code always writes pointers as 8 bytes, and will + // fail to compile if they don't fit. + return lift(Pointer(buf.getLong())) + } + + override fun allocationSize(value: UnresolvedInput) = 8UL + + override fun write(value: UnresolvedInput, buf: ByteBuffer) { + // The Rust code always expects pointers written as 8 bytes, + // and will fail to compile if they don't fit. + buf.putLong(Pointer.nativeValue(lower(value))) + } +} + + +// This template implements a class for working with a Rust struct via a Pointer/Arc +// to the live Rust struct on the other side of the FFI. +// +// Each instance implements core operations for working with the Rust `Arc` and the +// Kotlin Pointer to work with the live Rust struct on the other side of the FFI. +// +// There's some subtlety here, because we have to be careful not to operate on a Rust +// struct after it has been dropped, and because we must expose a public API for freeing +// theq Kotlin wrapper object in lieu of reliable finalizers. The core requirements are: +// +// * Each instance holds an opaque pointer to the underlying Rust struct. +// Method calls need to read this pointer from the object's state and pass it in to +// the Rust FFI. +// +// * When an instance is no longer needed, its pointer should be passed to a +// special destructor function provided by the Rust FFI, which will drop the +// underlying Rust struct. +// +// * Given an instance, calling code is expected to call the special +// `destroy` method in order to free it after use, either by calling it explicitly +// or by using a higher-level helper like the `use` method. Failing to do so risks +// leaking the underlying Rust struct. +// +// * We can't assume that calling code will do the right thing, and must be prepared +// to handle Kotlin method calls executing concurrently with or even after a call to +// `destroy`, and to handle multiple (possibly concurrent!) calls to `destroy`. +// +// * We must never allow Rust code to operate on the underlying Rust struct after +// the destructor has been called, and must never call the destructor more than once. +// Doing so may trigger memory unsafety. +// +// * To mitigate many of the risks of leaking memory and use-after-free unsafety, a `Cleaner` +// is implemented to call the destructor when the Kotlin object becomes unreachable. +// This is done in a background thread. This is not a panacea, and client code should be aware that +// 1. the thread may starve if some there are objects that have poorly performing +// `drop` methods or do significant work in their `drop` methods. +// 2. the thread is shared across the whole library. This can be tuned by using `android_cleaner = true`, +// or `android = true` in the [`kotlin` section of the `uniffi.toml` file](https://mozilla.github.io/uniffi-rs/kotlin/configuration.html). +// +// If we try to implement this with mutual exclusion on access to the pointer, there is the +// possibility of a race between a method call and a concurrent call to `destroy`: +// +// * Thread A starts a method call, reads the value of the pointer, but is interrupted +// before it can pass the pointer over the FFI to Rust. +// * Thread B calls `destroy` and frees the underlying Rust struct. +// * Thread A resumes, passing the already-read pointer value to Rust and triggering +// a use-after-free. +// +// One possible solution would be to use a `ReadWriteLock`, with each method call taking +// a read lock (and thus allowed to run concurrently) and the special `destroy` method +// taking a write lock (and thus blocking on live method calls). However, we aim not to +// generate methods with any hidden blocking semantics, and a `destroy` method that might +// block if called incorrectly seems to meet that bar. +// +// So, we achieve our goals by giving each instance an associated `AtomicLong` counter to track +// the number of in-flight method calls, and an `AtomicBoolean` flag to indicate whether `destroy` +// has been called. These are updated according to the following rules: +// +// * The initial value of the counter is 1, indicating a live object with no in-flight calls. +// The initial value for the flag is false. +// +// * At the start of each method call, we atomically check the counter. +// If it is 0 then the underlying Rust struct has already been destroyed and the call is aborted. +// If it is nonzero them we atomically increment it by 1 and proceed with the method call. +// +// * At the end of each method call, we atomically decrement and check the counter. +// If it has reached zero then we destroy the underlying Rust struct. +// +// * When `destroy` is called, we atomically flip the flag from false to true. +// If the flag was already true we silently fail. +// Otherwise we atomically decrement and check the counter. +// If it has reached zero then we destroy the underlying Rust struct. +// +// Astute readers may observe that this all sounds very similar to the way that Rust's `Arc` works, +// and indeed it is, with the addition of a flag to guard against multiple calls to `destroy`. +// +// The overall effect is that the underlying Rust struct is destroyed only when `destroy` has been +// called *and* all in-flight method calls have completed, avoiding violating any of the expectations +// of the underlying Rust code. +// +// This makes a cleaner a better alternative to _not_ calling `destroy()` as +// and when the object is finished with, but the abstraction is not perfect: if the Rust object's `drop` +// method is slow, and/or there are many objects to cleanup, and it's on a low end Android device, then the cleaner +// thread may be starved, and the app will leak memory. +// +// In this case, `destroy`ing manually may be a better solution. +// +// The cleaner can live side by side with the manual calling of `destroy`. In the order of responsiveness, uniffi objects +// with Rust peers are reclaimed: +// +// 1. By calling the `destroy` method of the object, which calls `rustObject.free()`. If that doesn't happen: +// 2. When the object becomes unreachable, AND the Cleaner thread gets to call `rustObject.free()`. If the thread is starved then: +// 3. The memory is reclaimed when the process terminates. +// +// [1] https://stackoverflow.com/questions/24376768/can-java-finalize-an-object-when-it-is-still-in-scope/24380219 +// + + +/** + * Command to upgrade an already published package + * + * # BCS + * + * The BCS serialized form for this type is defined by the following ABNF: + * + * ```text + * upgrade = (vector bytes) ; move modules + * (vector object-id) ; dependencies + * object-id ; package-id of the package + * argument ; upgrade ticket + * ``` + */ +public interface UpgradeInterface { + + /** + * Set of packages that the to-be published package depends on + */ + fun `dependencies`(): List + + /** + * The serialized move modules + */ + fun `modules`(): List + + /** + * Package id of the package to upgrade + */ + fun `package`(): ObjectId + + /** + * Ticket authorizing the upgrade + */ + fun `ticket`(): Argument + + companion object +} + +/** + * Command to upgrade an already published package + * + * # BCS + * + * The BCS serialized form for this type is defined by the following ABNF: + * + * ```text + * upgrade = (vector bytes) ; move modules + * (vector object-id) ; dependencies + * object-id ; package-id of the package + * argument ; upgrade ticket + * ``` + */ +open class Upgrade: Disposable, AutoCloseable, UpgradeInterface +{ + + constructor(pointer: Pointer) { + this.pointer = pointer + this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) + } + + /** + * This constructor can be used to instantiate a fake object. Only used for tests. Any + * attempt to actually use an object constructed this way will fail as there is no + * connected Rust object. + */ + @Suppress("UNUSED_PARAMETER") + constructor(noPointer: NoPointer) { + this.pointer = null + this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) + } + constructor(`modules`: List, `dependencies`: List, `package`: ObjectId, `ticket`: Argument) : + this( + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_upgrade_new( + FfiConverterSequenceByteArray.lower(`modules`),FfiConverterSequenceTypeObjectId.lower(`dependencies`),FfiConverterTypeObjectId.lower(`package`),FfiConverterTypeArgument.lower(`ticket`),_status) +} + ) + + protected val pointer: Pointer? + protected val cleanable: UniffiCleaner.Cleanable + + private val wasDestroyed = AtomicBoolean(false) + private val callCounter = AtomicLong(1) + + override fun destroy() { + // Only allow a single call to this method. + // TODO: maybe we should log a warning if called more than once? + if (this.wasDestroyed.compareAndSet(false, true)) { + // This decrement always matches the initial count of 1 given at creation time. + if (this.callCounter.decrementAndGet() == 0L) { + cleanable.clean() + } + } + } + + @Synchronized + override fun close() { + this.destroy() + } + + internal inline fun callWithPointer(block: (ptr: Pointer) -> R): R { + // Check and increment the call counter, to keep the object alive. + // This needs a compare-and-set retry loop in case of concurrent updates. + do { + val c = this.callCounter.get() + if (c == 0L) { + throw IllegalStateException("${this.javaClass.simpleName} object has already been destroyed") + } + if (c == Long.MAX_VALUE) { + throw IllegalStateException("${this.javaClass.simpleName} call counter would overflow") + } + } while (! this.callCounter.compareAndSet(c, c + 1L)) + // Now we can safely do the method call without the pointer being freed concurrently. + try { + return block(this.uniffiClonePointer()) + } finally { + // This decrement always matches the increment we performed above. + if (this.callCounter.decrementAndGet() == 0L) { + cleanable.clean() + } + } + } + + // Use a static inner class instead of a closure so as not to accidentally + // capture `this` as part of the cleanable's action. + private class UniffiCleanAction(private val pointer: Pointer?) : Runnable { + override fun run() { + pointer?.let { ptr -> + uniffiRustCall { status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_upgrade(ptr, status) + } + } + } + } + + fun uniffiClonePointer(): Pointer { + return uniffiRustCall() { status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_upgrade(pointer!!, status) + } + } + + + /** + * Set of packages that the to-be published package depends on + */override fun `dependencies`(): List { + return FfiConverterSequenceTypeObjectId.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_upgrade_dependencies( + it, _status) +} + } + ) + } + + + + /** + * The serialized move modules + */override fun `modules`(): List { + return FfiConverterSequenceByteArray.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_upgrade_modules( + it, _status) +} + } + ) + } + + + + /** + * Package id of the package to upgrade + */override fun `package`(): ObjectId { + return FfiConverterTypeObjectId.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_upgrade_package( + it, _status) +} + } + ) + } + + + + /** + * Ticket authorizing the upgrade + */override fun `ticket`(): Argument { + return FfiConverterTypeArgument.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_upgrade_ticket( + it, _status) +} + } + ) + } + + + + + + + companion object + +} + +/** + * @suppress + */ +public object FfiConverterTypeUpgrade: FfiConverter { + + override fun lower(value: Upgrade): Pointer { + return value.uniffiClonePointer() + } + + override fun lift(value: Pointer): Upgrade { + return Upgrade(value) + } + + override fun read(buf: ByteBuffer): Upgrade { + // The Rust code always writes pointers as 8 bytes, and will + // fail to compile if they don't fit. + return lift(Pointer(buf.getLong())) + } + + override fun allocationSize(value: Upgrade) = 8UL + + override fun write(value: Upgrade, buf: ByteBuffer) { + // The Rust code always expects pointers written as 8 bytes, + // and will fail to compile if they don't fit. + buf.putLong(Pointer.nativeValue(lower(value))) + } +} + + +// This template implements a class for working with a Rust struct via a Pointer/Arc +// to the live Rust struct on the other side of the FFI. +// +// Each instance implements core operations for working with the Rust `Arc` and the +// Kotlin Pointer to work with the live Rust struct on the other side of the FFI. +// +// There's some subtlety here, because we have to be careful not to operate on a Rust +// struct after it has been dropped, and because we must expose a public API for freeing +// theq Kotlin wrapper object in lieu of reliable finalizers. The core requirements are: +// +// * Each instance holds an opaque pointer to the underlying Rust struct. +// Method calls need to read this pointer from the object's state and pass it in to +// the Rust FFI. +// +// * When an instance is no longer needed, its pointer should be passed to a +// special destructor function provided by the Rust FFI, which will drop the +// underlying Rust struct. +// +// * Given an instance, calling code is expected to call the special +// `destroy` method in order to free it after use, either by calling it explicitly +// or by using a higher-level helper like the `use` method. Failing to do so risks +// leaking the underlying Rust struct. +// +// * We can't assume that calling code will do the right thing, and must be prepared +// to handle Kotlin method calls executing concurrently with or even after a call to +// `destroy`, and to handle multiple (possibly concurrent!) calls to `destroy`. +// +// * We must never allow Rust code to operate on the underlying Rust struct after +// the destructor has been called, and must never call the destructor more than once. +// Doing so may trigger memory unsafety. +// +// * To mitigate many of the risks of leaking memory and use-after-free unsafety, a `Cleaner` +// is implemented to call the destructor when the Kotlin object becomes unreachable. +// This is done in a background thread. This is not a panacea, and client code should be aware that +// 1. the thread may starve if some there are objects that have poorly performing +// `drop` methods or do significant work in their `drop` methods. +// 2. the thread is shared across the whole library. This can be tuned by using `android_cleaner = true`, +// or `android = true` in the [`kotlin` section of the `uniffi.toml` file](https://mozilla.github.io/uniffi-rs/kotlin/configuration.html). +// +// If we try to implement this with mutual exclusion on access to the pointer, there is the +// possibility of a race between a method call and a concurrent call to `destroy`: +// +// * Thread A starts a method call, reads the value of the pointer, but is interrupted +// before it can pass the pointer over the FFI to Rust. +// * Thread B calls `destroy` and frees the underlying Rust struct. +// * Thread A resumes, passing the already-read pointer value to Rust and triggering +// a use-after-free. +// +// One possible solution would be to use a `ReadWriteLock`, with each method call taking +// a read lock (and thus allowed to run concurrently) and the special `destroy` method +// taking a write lock (and thus blocking on live method calls). However, we aim not to +// generate methods with any hidden blocking semantics, and a `destroy` method that might +// block if called incorrectly seems to meet that bar. +// +// So, we achieve our goals by giving each instance an associated `AtomicLong` counter to track +// the number of in-flight method calls, and an `AtomicBoolean` flag to indicate whether `destroy` +// has been called. These are updated according to the following rules: +// +// * The initial value of the counter is 1, indicating a live object with no in-flight calls. +// The initial value for the flag is false. +// +// * At the start of each method call, we atomically check the counter. +// If it is 0 then the underlying Rust struct has already been destroyed and the call is aborted. +// If it is nonzero them we atomically increment it by 1 and proceed with the method call. +// +// * At the end of each method call, we atomically decrement and check the counter. +// If it has reached zero then we destroy the underlying Rust struct. +// +// * When `destroy` is called, we atomically flip the flag from false to true. +// If the flag was already true we silently fail. +// Otherwise we atomically decrement and check the counter. +// If it has reached zero then we destroy the underlying Rust struct. +// +// Astute readers may observe that this all sounds very similar to the way that Rust's `Arc` works, +// and indeed it is, with the addition of a flag to guard against multiple calls to `destroy`. +// +// The overall effect is that the underlying Rust struct is destroyed only when `destroy` has been +// called *and* all in-flight method calls have completed, avoiding violating any of the expectations +// of the underlying Rust code. +// +// This makes a cleaner a better alternative to _not_ calling `destroy()` as +// and when the object is finished with, but the abstraction is not perfect: if the Rust object's `drop` +// method is slow, and/or there are many objects to cleanup, and it's on a low end Android device, then the cleaner +// thread may be starved, and the app will leak memory. +// +// In this case, `destroy`ing manually may be a better solution. +// +// The cleaner can live side by side with the manual calling of `destroy`. In the order of responsiveness, uniffi objects +// with Rust peers are reclaimed: +// +// 1. By calling the `destroy` method of the object, which calls `rustObject.free()`. If that doesn't happen: +// 2. When the object becomes unreachable, AND the Cleaner thread gets to call `rustObject.free()`. If the thread is starved then: +// 3. The memory is reclaimed when the process terminates. +// +// [1] https://stackoverflow.com/questions/24376768/can-java-finalize-an-object-when-it-is-still-in-scope/24380219 +// + + +/** + * A signature from a user + * + * A `UserSignature` is most commonly used to authorize the execution and + * inclusion of a transaction to the blockchain. + * + * # BCS + * + * The BCS serialized form for this type is defined by the following ABNF: + * + * ```text + * user-signature-bcs = bytes ; where the contents of the bytes are defined by + * user-signature = simple-signature / multisig / multisig-legacy / zklogin / passkey + * ``` + * + * Note: Due to historical reasons, signatures are serialized slightly + * different from the majority of the types in IOTA. In particular if a + * signature is ever embedded in another structure it generally is serialized + * as `bytes` meaning it has a length prefix that defines the length of + * the completely serialized signature. + */ +public interface UserSignatureInterface { + + fun `asMultisig`(): MultisigAggregatedSignature + + fun `asMultisigOpt`(): MultisigAggregatedSignature? + + fun `asPasskey`(): PasskeyAuthenticator + + fun `asPasskeyOpt`(): PasskeyAuthenticator? + + fun `asSimple`(): SimpleSignature + + fun `asSimpleOpt`(): SimpleSignature? + + fun `asZklogin`(): ZkLoginAuthenticator + + fun `asZkloginOpt`(): ZkLoginAuthenticator? + + fun `isMultisig`(): kotlin.Boolean + + fun `isPasskey`(): kotlin.Boolean + + fun `isSimple`(): kotlin.Boolean + + fun `isZklogin`(): kotlin.Boolean + + /** + * Return the flag for this signature scheme + */ + fun `scheme`(): SignatureScheme + + fun `toBase64`(): kotlin.String + + fun `toBytes`(): kotlin.ByteArray + + companion object +} + +/** + * A signature from a user + * + * A `UserSignature` is most commonly used to authorize the execution and + * inclusion of a transaction to the blockchain. + * + * # BCS + * + * The BCS serialized form for this type is defined by the following ABNF: + * + * ```text + * user-signature-bcs = bytes ; where the contents of the bytes are defined by + * user-signature = simple-signature / multisig / multisig-legacy / zklogin / passkey + * ``` + * + * Note: Due to historical reasons, signatures are serialized slightly + * different from the majority of the types in IOTA. In particular if a + * signature is ever embedded in another structure it generally is serialized + * as `bytes` meaning it has a length prefix that defines the length of + * the completely serialized signature. + */ +open class UserSignature: Disposable, AutoCloseable, UserSignatureInterface +{ + + constructor(pointer: Pointer) { + this.pointer = pointer + this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) + } + + /** + * This constructor can be used to instantiate a fake object. Only used for tests. Any + * attempt to actually use an object constructed this way will fail as there is no + * connected Rust object. + */ + @Suppress("UNUSED_PARAMETER") + constructor(noPointer: NoPointer) { + this.pointer = null + this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) + } + + protected val pointer: Pointer? + protected val cleanable: UniffiCleaner.Cleanable + + private val wasDestroyed = AtomicBoolean(false) + private val callCounter = AtomicLong(1) + + override fun destroy() { + // Only allow a single call to this method. + // TODO: maybe we should log a warning if called more than once? + if (this.wasDestroyed.compareAndSet(false, true)) { + // This decrement always matches the initial count of 1 given at creation time. + if (this.callCounter.decrementAndGet() == 0L) { + cleanable.clean() + } + } + } + + @Synchronized + override fun close() { + this.destroy() + } + + internal inline fun callWithPointer(block: (ptr: Pointer) -> R): R { + // Check and increment the call counter, to keep the object alive. + // This needs a compare-and-set retry loop in case of concurrent updates. + do { + val c = this.callCounter.get() + if (c == 0L) { + throw IllegalStateException("${this.javaClass.simpleName} object has already been destroyed") + } + if (c == Long.MAX_VALUE) { + throw IllegalStateException("${this.javaClass.simpleName} call counter would overflow") + } + } while (! this.callCounter.compareAndSet(c, c + 1L)) + // Now we can safely do the method call without the pointer being freed concurrently. + try { + return block(this.uniffiClonePointer()) + } finally { + // This decrement always matches the increment we performed above. + if (this.callCounter.decrementAndGet() == 0L) { + cleanable.clean() + } + } + } + + // Use a static inner class instead of a closure so as not to accidentally + // capture `this` as part of the cleanable's action. + private class UniffiCleanAction(private val pointer: Pointer?) : Runnable { + override fun run() { + pointer?.let { ptr -> + uniffiRustCall { status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_usersignature(ptr, status) + } + } + } + } + + fun uniffiClonePointer(): Pointer { + return uniffiRustCall() { status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_usersignature(pointer!!, status) + } + } + + override fun `asMultisig`(): MultisigAggregatedSignature { + return FfiConverterTypeMultisigAggregatedSignature.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_as_multisig( + it, _status) +} + } + ) + } + + + override fun `asMultisigOpt`(): MultisigAggregatedSignature? { + return FfiConverterOptionalTypeMultisigAggregatedSignature.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_as_multisig_opt( + it, _status) +} + } + ) + } + + + override fun `asPasskey`(): PasskeyAuthenticator { + return FfiConverterTypePasskeyAuthenticator.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_as_passkey( + it, _status) +} + } + ) + } + + + override fun `asPasskeyOpt`(): PasskeyAuthenticator? { + return FfiConverterOptionalTypePasskeyAuthenticator.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_as_passkey_opt( + it, _status) +} + } + ) + } + + + override fun `asSimple`(): SimpleSignature { + return FfiConverterTypeSimpleSignature.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_as_simple( + it, _status) +} + } + ) + } + + + override fun `asSimpleOpt`(): SimpleSignature? { + return FfiConverterOptionalTypeSimpleSignature.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_as_simple_opt( + it, _status) +} + } + ) + } + + + override fun `asZklogin`(): ZkLoginAuthenticator { + return FfiConverterTypeZkLoginAuthenticator.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_as_zklogin( + it, _status) +} + } + ) + } + + + override fun `asZkloginOpt`(): ZkLoginAuthenticator? { + return FfiConverterOptionalTypeZkLoginAuthenticator.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_as_zklogin_opt( + it, _status) +} + } + ) + } + + + override fun `isMultisig`(): kotlin.Boolean { + return FfiConverterBoolean.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_is_multisig( + it, _status) +} + } + ) + } + + + override fun `isPasskey`(): kotlin.Boolean { + return FfiConverterBoolean.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_is_passkey( + it, _status) +} + } + ) + } + + + override fun `isSimple`(): kotlin.Boolean { + return FfiConverterBoolean.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_is_simple( + it, _status) +} + } + ) + } + + + override fun `isZklogin`(): kotlin.Boolean { + return FfiConverterBoolean.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_is_zklogin( + it, _status) +} + } + ) + } + + + + /** + * Return the flag for this signature scheme + */override fun `scheme`(): SignatureScheme { + return FfiConverterTypeSignatureScheme.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_scheme( + it, _status) +} + } + ) + } + + + override fun `toBase64`(): kotlin.String { + return FfiConverterString.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_to_base64( + it, _status) +} + } + ) + } + + + override fun `toBytes`(): kotlin.ByteArray { + return FfiConverterByteArray.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_to_bytes( + it, _status) +} + } + ) + } + + + + + + companion object { + + @Throws(SdkFfiException::class) fun `fromBase64`(`base64`: kotlin.String): UserSignature { + return FfiConverterTypeUserSignature.lift( + uniffiRustCallWithError(SdkFfiException) { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_usersignature_from_base64( + FfiConverterString.lower(`base64`),_status) +} + ) + } + + + + @Throws(SdkFfiException::class) fun `fromBytes`(`bytes`: kotlin.ByteArray): UserSignature { + return FfiConverterTypeUserSignature.lift( + uniffiRustCallWithError(SdkFfiException) { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_usersignature_from_bytes( + FfiConverterByteArray.lower(`bytes`),_status) +} + ) + } + + + fun `newMultisig`(`signature`: MultisigAggregatedSignature): UserSignature { + return FfiConverterTypeUserSignature.lift( + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_usersignature_new_multisig( + FfiConverterTypeMultisigAggregatedSignature.lower(`signature`),_status) +} + ) + } + + + fun `newPasskey`(`authenticator`: PasskeyAuthenticator): UserSignature { + return FfiConverterTypeUserSignature.lift( + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_usersignature_new_passkey( + FfiConverterTypePasskeyAuthenticator.lower(`authenticator`),_status) +} + ) + } + + + fun `newSimple`(`signature`: SimpleSignature): UserSignature { + return FfiConverterTypeUserSignature.lift( + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_usersignature_new_simple( + FfiConverterTypeSimpleSignature.lower(`signature`),_status) +} + ) + } + + + fun `newZklogin`(`authenticator`: ZkLoginAuthenticator): UserSignature { + return FfiConverterTypeUserSignature.lift( + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_usersignature_new_zklogin( + FfiConverterTypeZkLoginAuthenticator.lower(`authenticator`),_status) +} + ) + } + + + + } + +} + +/** + * @suppress + */ +public object FfiConverterTypeUserSignature: FfiConverter { + + override fun lower(value: UserSignature): Pointer { + return value.uniffiClonePointer() + } + + override fun lift(value: Pointer): UserSignature { + return UserSignature(value) + } + + override fun read(buf: ByteBuffer): UserSignature { + // The Rust code always writes pointers as 8 bytes, and will + // fail to compile if they don't fit. + return lift(Pointer(buf.getLong())) + } + + override fun allocationSize(value: UserSignature) = 8UL + + override fun write(value: UserSignature, buf: ByteBuffer) { + // The Rust code always expects pointers written as 8 bytes, + // and will fail to compile if they don't fit. + buf.putLong(Pointer.nativeValue(lower(value))) + } +} + + +// This template implements a class for working with a Rust struct via a Pointer/Arc +// to the live Rust struct on the other side of the FFI. +// +// Each instance implements core operations for working with the Rust `Arc` and the +// Kotlin Pointer to work with the live Rust struct on the other side of the FFI. +// +// There's some subtlety here, because we have to be careful not to operate on a Rust +// struct after it has been dropped, and because we must expose a public API for freeing +// theq Kotlin wrapper object in lieu of reliable finalizers. The core requirements are: +// +// * Each instance holds an opaque pointer to the underlying Rust struct. +// Method calls need to read this pointer from the object's state and pass it in to +// the Rust FFI. +// +// * When an instance is no longer needed, its pointer should be passed to a +// special destructor function provided by the Rust FFI, which will drop the +// underlying Rust struct. +// +// * Given an instance, calling code is expected to call the special +// `destroy` method in order to free it after use, either by calling it explicitly +// or by using a higher-level helper like the `use` method. Failing to do so risks +// leaking the underlying Rust struct. +// +// * We can't assume that calling code will do the right thing, and must be prepared +// to handle Kotlin method calls executing concurrently with or even after a call to +// `destroy`, and to handle multiple (possibly concurrent!) calls to `destroy`. +// +// * We must never allow Rust code to operate on the underlying Rust struct after +// the destructor has been called, and must never call the destructor more than once. +// Doing so may trigger memory unsafety. +// +// * To mitigate many of the risks of leaking memory and use-after-free unsafety, a `Cleaner` +// is implemented to call the destructor when the Kotlin object becomes unreachable. +// This is done in a background thread. This is not a panacea, and client code should be aware that +// 1. the thread may starve if some there are objects that have poorly performing +// `drop` methods or do significant work in their `drop` methods. +// 2. the thread is shared across the whole library. This can be tuned by using `android_cleaner = true`, +// or `android = true` in the [`kotlin` section of the `uniffi.toml` file](https://mozilla.github.io/uniffi-rs/kotlin/configuration.html). +// +// If we try to implement this with mutual exclusion on access to the pointer, there is the +// possibility of a race between a method call and a concurrent call to `destroy`: +// +// * Thread A starts a method call, reads the value of the pointer, but is interrupted +// before it can pass the pointer over the FFI to Rust. +// * Thread B calls `destroy` and frees the underlying Rust struct. +// * Thread A resumes, passing the already-read pointer value to Rust and triggering +// a use-after-free. +// +// One possible solution would be to use a `ReadWriteLock`, with each method call taking +// a read lock (and thus allowed to run concurrently) and the special `destroy` method +// taking a write lock (and thus blocking on live method calls). However, we aim not to +// generate methods with any hidden blocking semantics, and a `destroy` method that might +// block if called incorrectly seems to meet that bar. +// +// So, we achieve our goals by giving each instance an associated `AtomicLong` counter to track +// the number of in-flight method calls, and an `AtomicBoolean` flag to indicate whether `destroy` +// has been called. These are updated according to the following rules: +// +// * The initial value of the counter is 1, indicating a live object with no in-flight calls. +// The initial value for the flag is false. +// +// * At the start of each method call, we atomically check the counter. +// If it is 0 then the underlying Rust struct has already been destroyed and the call is aborted. +// If it is nonzero them we atomically increment it by 1 and proceed with the method call. +// +// * At the end of each method call, we atomically decrement and check the counter. +// If it has reached zero then we destroy the underlying Rust struct. +// +// * When `destroy` is called, we atomically flip the flag from false to true. +// If the flag was already true we silently fail. +// Otherwise we atomically decrement and check the counter. +// If it has reached zero then we destroy the underlying Rust struct. +// +// Astute readers may observe that this all sounds very similar to the way that Rust's `Arc` works, +// and indeed it is, with the addition of a flag to guard against multiple calls to `destroy`. +// +// The overall effect is that the underlying Rust struct is destroyed only when `destroy` has been +// called *and* all in-flight method calls have completed, avoiding violating any of the expectations +// of the underlying Rust code. +// +// This makes a cleaner a better alternative to _not_ calling `destroy()` as +// and when the object is finished with, but the abstraction is not perfect: if the Rust object's `drop` +// method is slow, and/or there are many objects to cleanup, and it's on a low end Android device, then the cleaner +// thread may be starved, and the app will leak memory. +// +// In this case, `destroy`ing manually may be a better solution. +// +// The cleaner can live side by side with the manual calling of `destroy`. In the order of responsiveness, uniffi objects +// with Rust peers are reclaimed: +// +// 1. By calling the `destroy` method of the object, which calls `rustObject.free()`. If that doesn't happen: +// 2. When the object becomes unreachable, AND the Cleaner thread gets to call `rustObject.free()`. If the thread is starved then: +// 3. The memory is reclaimed when the process terminates. +// +// [1] https://stackoverflow.com/questions/24376768/can-java-finalize-an-object-when-it-is-still-in-scope/24380219 +// + + +/** + * Verifier that will verify all UserSignature variants + */ +public interface UserSignatureVerifierInterface { + + fun `verify`(`message`: kotlin.ByteArray, `signature`: UserSignature) + + fun `withZkloginVerifier`(`zkloginVerifier`: ZkloginVerifier): UserSignatureVerifier + + fun `zkloginVerifier`(): ZkloginVerifier? + + companion object +} + +/** + * Verifier that will verify all UserSignature variants + */ +open class UserSignatureVerifier: Disposable, AutoCloseable, UserSignatureVerifierInterface +{ + + constructor(pointer: Pointer) { + this.pointer = pointer + this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) + } + + /** + * This constructor can be used to instantiate a fake object. Only used for tests. Any + * attempt to actually use an object constructed this way will fail as there is no + * connected Rust object. + */ + @Suppress("UNUSED_PARAMETER") + constructor(noPointer: NoPointer) { + this.pointer = null + this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) + } + constructor() : + this( + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_usersignatureverifier_new( + _status) +} + ) + + protected val pointer: Pointer? + protected val cleanable: UniffiCleaner.Cleanable + + private val wasDestroyed = AtomicBoolean(false) + private val callCounter = AtomicLong(1) + + override fun destroy() { + // Only allow a single call to this method. + // TODO: maybe we should log a warning if called more than once? + if (this.wasDestroyed.compareAndSet(false, true)) { + // This decrement always matches the initial count of 1 given at creation time. + if (this.callCounter.decrementAndGet() == 0L) { + cleanable.clean() + } + } + } + + @Synchronized + override fun close() { + this.destroy() + } + + internal inline fun callWithPointer(block: (ptr: Pointer) -> R): R { + // Check and increment the call counter, to keep the object alive. + // This needs a compare-and-set retry loop in case of concurrent updates. + do { + val c = this.callCounter.get() + if (c == 0L) { + throw IllegalStateException("${this.javaClass.simpleName} object has already been destroyed") + } + if (c == Long.MAX_VALUE) { + throw IllegalStateException("${this.javaClass.simpleName} call counter would overflow") + } + } while (! this.callCounter.compareAndSet(c, c + 1L)) + // Now we can safely do the method call without the pointer being freed concurrently. + try { + return block(this.uniffiClonePointer()) + } finally { + // This decrement always matches the increment we performed above. + if (this.callCounter.decrementAndGet() == 0L) { + cleanable.clean() + } + } + } + + // Use a static inner class instead of a closure so as not to accidentally + // capture `this` as part of the cleanable's action. + private class UniffiCleanAction(private val pointer: Pointer?) : Runnable { + override fun run() { + pointer?.let { ptr -> + uniffiRustCall { status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_usersignatureverifier(ptr, status) + } + } + } + } + + fun uniffiClonePointer(): Pointer { + return uniffiRustCall() { status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_usersignatureverifier(pointer!!, status) + } + } + + + @Throws(SdkFfiException::class)override fun `verify`(`message`: kotlin.ByteArray, `signature`: UserSignature) + = + callWithPointer { + uniffiRustCallWithError(SdkFfiException) { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignatureverifier_verify( + it, FfiConverterByteArray.lower(`message`),FfiConverterTypeUserSignature.lower(`signature`),_status) +} } + - - /** - * Return a receiving kind of object with all required fields. - */ fun `newReceiving`(`objectId`: ObjectId, `version`: kotlin.ULong, `digest`: Digest): UnresolvedInput { - return FfiConverterTypeUnresolvedInput.lift( + override fun `withZkloginVerifier`(`zkloginVerifier`: ZkloginVerifier): UserSignatureVerifier { + return FfiConverterTypeUserSignatureVerifier.lift( + callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_unresolvedinput_new_receiving( - FfiConverterTypeObjectId.lower(`objectId`),FfiConverterULong.lower(`version`),FfiConverterTypeDigest.lower(`digest`),_status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignatureverifier_with_zklogin_verifier( + it, FfiConverterTypeZkloginVerifier.lower(`zkloginVerifier`),_status) } + } ) } - - /** - * Return a shared object. - * - `mutable` controls whether a command can accept the object by value or - * mutable reference. - * - `initial_shared_version` is the first version the object was shared - * at. - */ fun `newShared`(`objectId`: ObjectId, `initialSharedVersion`: kotlin.ULong, `mutable`: kotlin.Boolean): UnresolvedInput { - return FfiConverterTypeUnresolvedInput.lift( + override fun `zkloginVerifier`(): ZkloginVerifier? { + return FfiConverterOptionalTypeZkloginVerifier.lift( + callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_unresolvedinput_new_shared( - FfiConverterTypeObjectId.lower(`objectId`),FfiConverterULong.lower(`initialSharedVersion`),FfiConverterBoolean.lower(`mutable`),_status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignatureverifier_zklogin_verifier( + it, _status) } + } ) } - - } + + + + + companion object } /** * @suppress */ -public object FfiConverterTypeUnresolvedInput: FfiConverter { +public object FfiConverterTypeUserSignatureVerifier: FfiConverter { - override fun lower(value: UnresolvedInput): Pointer { + override fun lower(value: UserSignatureVerifier): Pointer { return value.uniffiClonePointer() } - override fun lift(value: Pointer): UnresolvedInput { - return UnresolvedInput(value) + override fun lift(value: Pointer): UserSignatureVerifier { + return UserSignatureVerifier(value) } - override fun read(buf: ByteBuffer): UnresolvedInput { + override fun read(buf: ByteBuffer): UserSignatureVerifier { // The Rust code always writes pointers as 8 bytes, and will // fail to compile if they don't fit. return lift(Pointer(buf.getLong())) } - override fun allocationSize(value: UnresolvedInput) = 8UL + override fun allocationSize(value: UserSignatureVerifier) = 8UL - override fun write(value: UnresolvedInput, buf: ByteBuffer) { + override fun write(value: UserSignatureVerifier, buf: ByteBuffer) { // The Rust code always expects pointers written as 8 bytes, // and will fail to compile if they don't fit. buf.putLong(Pointer.nativeValue(lower(value))) @@ -36868,59 +38872,55 @@ public object FfiConverterTypeUnresolvedInput: FfiConverter - - /** - * The serialized move modules - */ - fun `modules`(): List + fun `bitmapBytes`(): kotlin.ByteArray - /** - * Package id of the package to upgrade - */ - fun `package`(): ObjectId + fun `epoch`(): kotlin.ULong - /** - * Ticket authorizing the upgrade - */ - fun `ticket`(): Argument + fun `signature`(): Bls12381Signature companion object } /** - * Command to upgrade an already published package + * An aggregated signature from multiple Validators. * * # BCS * * The BCS serialized form for this type is defined by the following ABNF: * * ```text - * upgrade = (vector bytes) ; move modules - * (vector object-id) ; dependencies - * object-id ; package-id of the package - * argument ; upgrade ticket + * validator-aggregated-signature = u64 ; epoch + * bls-signature + * roaring-bitmap + * roaring-bitmap = bytes ; where the contents of the bytes are valid + * ; according to the serialized spec for + * ; roaring bitmaps * ``` + * + * See [here](https://github.com/RoaringBitmap/RoaringFormatSpec) for the specification for the + * serialized format of RoaringBitmaps. */ -open class Upgrade: Disposable, AutoCloseable, UpgradeInterface +open class ValidatorAggregatedSignature: Disposable, AutoCloseable, ValidatorAggregatedSignatureInterface { constructor(pointer: Pointer) { @@ -36938,11 +38938,11 @@ open class Upgrade: Disposable, AutoCloseable, UpgradeInterface this.pointer = null this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) } - constructor(`modules`: List, `dependencies`: List, `package`: ObjectId, `ticket`: Argument) : + constructor(`epoch`: kotlin.ULong, `signature`: Bls12381Signature, `bitmapBytes`: kotlin.ByteArray) : this( - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_upgrade_new( - FfiConverterSequenceByteArray.lower(`modules`),FfiConverterSequenceTypeObjectId.lower(`dependencies`),FfiConverterTypeObjectId.lower(`package`),FfiConverterTypeArgument.lower(`ticket`),_status) + uniffiRustCallWithError(SdkFfiException) { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_validatoraggregatedsignature_new( + FfiConverterULong.lower(`epoch`),FfiConverterTypeBls12381Signature.lower(`signature`),FfiConverterByteArray.lower(`bitmapBytes`),_status) } ) @@ -36997,7 +38997,7 @@ open class Upgrade: Disposable, AutoCloseable, UpgradeInterface override fun run() { pointer?.let { ptr -> uniffiRustCall { status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_upgrade(ptr, status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_validatoraggregatedsignature(ptr, status) } } } @@ -37005,33 +39005,16 @@ open class Upgrade: Disposable, AutoCloseable, UpgradeInterface fun uniffiClonePointer(): Pointer { return uniffiRustCall() { status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_upgrade(pointer!!, status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_validatoraggregatedsignature(pointer!!, status) } } - /** - * Set of packages that the to-be published package depends on - */override fun `dependencies`(): List { - return FfiConverterSequenceTypeObjectId.lift( - callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_upgrade_dependencies( - it, _status) -} - } - ) - } - - - - /** - * The serialized move modules - */override fun `modules`(): List { - return FfiConverterSequenceByteArray.lift( + @Throws(SdkFfiException::class)override fun `bitmapBytes`(): kotlin.ByteArray { + return FfiConverterByteArray.lift( callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_upgrade_modules( + uniffiRustCallWithError(SdkFfiException) { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_validatoraggregatedsignature_bitmap_bytes( it, _status) } } @@ -37039,14 +39022,11 @@ open class Upgrade: Disposable, AutoCloseable, UpgradeInterface } - - /** - * Package id of the package to upgrade - */override fun `package`(): ObjectId { - return FfiConverterTypeObjectId.lift( + override fun `epoch`(): kotlin.ULong { + return FfiConverterULong.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_upgrade_package( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_validatoraggregatedsignature_epoch( it, _status) } } @@ -37054,14 +39034,11 @@ open class Upgrade: Disposable, AutoCloseable, UpgradeInterface } - - /** - * Ticket authorizing the upgrade - */override fun `ticket`(): Argument { - return FfiConverterTypeArgument.lift( + override fun `signature`(): Bls12381Signature { + return FfiConverterTypeBls12381Signature.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_upgrade_ticket( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_validatoraggregatedsignature_signature( it, _status) } } @@ -37080,25 +39057,25 @@ open class Upgrade: Disposable, AutoCloseable, UpgradeInterface /** * @suppress */ -public object FfiConverterTypeUpgrade: FfiConverter { +public object FfiConverterTypeValidatorAggregatedSignature: FfiConverter { - override fun lower(value: Upgrade): Pointer { + override fun lower(value: ValidatorAggregatedSignature): Pointer { return value.uniffiClonePointer() } - override fun lift(value: Pointer): Upgrade { - return Upgrade(value) + override fun lift(value: Pointer): ValidatorAggregatedSignature { + return ValidatorAggregatedSignature(value) } - override fun read(buf: ByteBuffer): Upgrade { + override fun read(buf: ByteBuffer): ValidatorAggregatedSignature { // The Rust code always writes pointers as 8 bytes, and will // fail to compile if they don't fit. return lift(Pointer(buf.getLong())) } - override fun allocationSize(value: Upgrade) = 8UL + override fun allocationSize(value: ValidatorAggregatedSignature) = 8UL - override fun write(value: Upgrade, buf: ByteBuffer) { + override fun write(value: ValidatorAggregatedSignature, buf: ByteBuffer) { // The Rust code always expects pointers written as 8 bytes, // and will fail to compile if they don't fit. buf.putLong(Pointer.nativeValue(lower(value))) @@ -37204,87 +39181,18 @@ public object FfiConverterTypeUpgrade: FfiConverter { // -/** - * A signature from a user - * - * A `UserSignature` is most commonly used to authorize the execution and - * inclusion of a transaction to the blockchain. - * - * # BCS - * - * The BCS serialized form for this type is defined by the following ABNF: - * - * ```text - * user-signature-bcs = bytes ; where the contents of the bytes are defined by - * user-signature = simple-signature / multisig / multisig-legacy / zklogin / passkey - * ``` - * - * Note: Due to historical reasons, signatures are serialized slightly - * different from the majority of the types in IOTA. In particular if a - * signature is ever embedded in another structure it generally is serialized - * as `bytes` meaning it has a length prefix that defines the length of - * the completely serialized signature. - */ -public interface UserSignatureInterface { - - fun `asMultisig`(): MultisigAggregatedSignature - - fun `asMultisigOpt`(): MultisigAggregatedSignature? - - fun `asPasskey`(): PasskeyAuthenticator - - fun `asPasskeyOpt`(): PasskeyAuthenticator? - - fun `asSimple`(): SimpleSignature - - fun `asSimpleOpt`(): SimpleSignature? - - fun `asZklogin`(): ZkLoginAuthenticator - - fun `asZkloginOpt`(): ZkLoginAuthenticator? - - fun `isMultisig`(): kotlin.Boolean - - fun `isPasskey`(): kotlin.Boolean - - fun `isSimple`(): kotlin.Boolean - - fun `isZklogin`(): kotlin.Boolean +public interface ValidatorCommitteeSignatureAggregatorInterface { - /** - * Return the flag for this signature scheme - */ - fun `scheme`(): SignatureScheme + fun `addSignature`(`signature`: ValidatorSignature) - fun `toBase64`(): kotlin.String + fun `committee`(): ValidatorCommittee - fun `toBytes`(): kotlin.ByteArray + fun `finish`(): ValidatorAggregatedSignature companion object } -/** - * A signature from a user - * - * A `UserSignature` is most commonly used to authorize the execution and - * inclusion of a transaction to the blockchain. - * - * # BCS - * - * The BCS serialized form for this type is defined by the following ABNF: - * - * ```text - * user-signature-bcs = bytes ; where the contents of the bytes are defined by - * user-signature = simple-signature / multisig / multisig-legacy / zklogin / passkey - * ``` - * - * Note: Due to historical reasons, signatures are serialized slightly - * different from the majority of the types in IOTA. In particular if a - * signature is ever embedded in another structure it generally is serialized - * as `bytes` meaning it has a length prefix that defines the length of - * the completely serialized signature. - */ -open class UserSignature: Disposable, AutoCloseable, UserSignatureInterface +open class ValidatorCommitteeSignatureAggregator: Disposable, AutoCloseable, ValidatorCommitteeSignatureAggregatorInterface { constructor(pointer: Pointer) { @@ -37354,7 +39262,7 @@ open class UserSignature: Disposable, AutoCloseable, UserSignatureInterface override fun run() { pointer?.let { ptr -> uniffiRustCall { status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_usersignature(ptr, status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_validatorcommitteesignatureaggregator(ptr, status) } } } @@ -37362,162 +39270,27 @@ open class UserSignature: Disposable, AutoCloseable, UserSignatureInterface fun uniffiClonePointer(): Pointer { return uniffiRustCall() { status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_usersignature(pointer!!, status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_validatorcommitteesignatureaggregator(pointer!!, status) } } - override fun `asMultisig`(): MultisigAggregatedSignature { - return FfiConverterTypeMultisigAggregatedSignature.lift( - callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_as_multisig( - it, _status) -} - } - ) - } - - - override fun `asMultisigOpt`(): MultisigAggregatedSignature? { - return FfiConverterOptionalTypeMultisigAggregatedSignature.lift( - callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_as_multisig_opt( - it, _status) -} - } - ) - } - - - override fun `asPasskey`(): PasskeyAuthenticator { - return FfiConverterTypePasskeyAuthenticator.lift( - callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_as_passkey( - it, _status) -} - } - ) - } - - - override fun `asPasskeyOpt`(): PasskeyAuthenticator? { - return FfiConverterOptionalTypePasskeyAuthenticator.lift( - callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_as_passkey_opt( - it, _status) -} - } - ) - } - - - override fun `asSimple`(): SimpleSignature { - return FfiConverterTypeSimpleSignature.lift( - callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_as_simple( - it, _status) -} - } - ) - } - - - override fun `asSimpleOpt`(): SimpleSignature? { - return FfiConverterOptionalTypeSimpleSignature.lift( - callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_as_simple_opt( - it, _status) -} - } - ) - } - - - override fun `asZklogin`(): ZkLoginAuthenticator { - return FfiConverterTypeZkLoginAuthenticator.lift( - callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_as_zklogin( - it, _status) -} - } - ) - } - - - override fun `asZkloginOpt`(): ZkLoginAuthenticator? { - return FfiConverterOptionalTypeZkLoginAuthenticator.lift( - callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_as_zklogin_opt( - it, _status) -} - } - ) - } - - - override fun `isMultisig`(): kotlin.Boolean { - return FfiConverterBoolean.lift( - callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_is_multisig( - it, _status) -} - } - ) - } - - - override fun `isPasskey`(): kotlin.Boolean { - return FfiConverterBoolean.lift( - callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_is_passkey( - it, _status) -} - } - ) - } - - override fun `isSimple`(): kotlin.Boolean { - return FfiConverterBoolean.lift( + @Throws(SdkFfiException::class)override fun `addSignature`(`signature`: ValidatorSignature) + = callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_is_simple( - it, _status) + uniffiRustCallWithError(SdkFfiException) { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureaggregator_add_signature( + it, FfiConverterTypeValidatorSignature.lower(`signature`),_status) } } - ) - } - - override fun `isZklogin`(): kotlin.Boolean { - return FfiConverterBoolean.lift( - callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_is_zklogin( - it, _status) -} - } - ) - } - - /** - * Return the flag for this signature scheme - */override fun `scheme`(): SignatureScheme { - return FfiConverterTypeSignatureScheme.lift( + override fun `committee`(): ValidatorCommittee { + return FfiConverterTypeValidatorCommittee.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_scheme( + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureaggregator_committee( it, _status) } } @@ -37525,23 +39298,12 @@ open class UserSignature: Disposable, AutoCloseable, UserSignatureInterface } - override fun `toBase64`(): kotlin.String { - return FfiConverterString.lift( - callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_to_base64( - it, _status) -} - } - ) - } - - override fun `toBytes`(): kotlin.ByteArray { - return FfiConverterByteArray.lift( + @Throws(SdkFfiException::class)override fun `finish`(): ValidatorAggregatedSignature { + return FfiConverterTypeValidatorAggregatedSignature.lift( callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignature_to_bytes( + uniffiRustCallWithError(SdkFfiException) { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureaggregator_finish( it, _status) } } @@ -37554,62 +39316,11 @@ open class UserSignature: Disposable, AutoCloseable, UserSignatureInterface companion object { - @Throws(SdkFfiException::class) fun `fromBase64`(`base64`: kotlin.String): UserSignature { - return FfiConverterTypeUserSignature.lift( - uniffiRustCallWithError(SdkFfiException) { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_usersignature_from_base64( - FfiConverterString.lower(`base64`),_status) -} - ) - } - - - - @Throws(SdkFfiException::class) fun `fromBytes`(`bytes`: kotlin.ByteArray): UserSignature { - return FfiConverterTypeUserSignature.lift( + @Throws(SdkFfiException::class) fun `newCheckpointSummary`(`committee`: ValidatorCommittee, `summary`: CheckpointSummary): ValidatorCommitteeSignatureAggregator { + return FfiConverterTypeValidatorCommitteeSignatureAggregator.lift( uniffiRustCallWithError(SdkFfiException) { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_usersignature_from_bytes( - FfiConverterByteArray.lower(`bytes`),_status) -} - ) - } - - - fun `newMultisig`(`signature`: MultisigAggregatedSignature): UserSignature { - return FfiConverterTypeUserSignature.lift( - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_usersignature_new_multisig( - FfiConverterTypeMultisigAggregatedSignature.lower(`signature`),_status) -} - ) - } - - - fun `newPasskey`(`authenticator`: PasskeyAuthenticator): UserSignature { - return FfiConverterTypeUserSignature.lift( - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_usersignature_new_passkey( - FfiConverterTypePasskeyAuthenticator.lower(`authenticator`),_status) -} - ) - } - - - fun `newSimple`(`signature`: SimpleSignature): UserSignature { - return FfiConverterTypeUserSignature.lift( - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_usersignature_new_simple( - FfiConverterTypeSimpleSignature.lower(`signature`),_status) -} - ) - } - - - fun `newZklogin`(`authenticator`: ZkLoginAuthenticator): UserSignature { - return FfiConverterTypeUserSignature.lift( - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_usersignature_new_zklogin( - FfiConverterTypeZkLoginAuthenticator.lower(`authenticator`),_status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_validatorcommitteesignatureaggregator_new_checkpoint_summary( + FfiConverterTypeValidatorCommittee.lower(`committee`),FfiConverterTypeCheckpointSummary.lower(`summary`),_status) } ) } @@ -37623,25 +39334,25 @@ open class UserSignature: Disposable, AutoCloseable, UserSignatureInterface /** * @suppress */ -public object FfiConverterTypeUserSignature: FfiConverter { +public object FfiConverterTypeValidatorCommitteeSignatureAggregator: FfiConverter { - override fun lower(value: UserSignature): Pointer { + override fun lower(value: ValidatorCommitteeSignatureAggregator): Pointer { return value.uniffiClonePointer() } - override fun lift(value: Pointer): UserSignature { - return UserSignature(value) + override fun lift(value: Pointer): ValidatorCommitteeSignatureAggregator { + return ValidatorCommitteeSignatureAggregator(value) } - override fun read(buf: ByteBuffer): UserSignature { + override fun read(buf: ByteBuffer): ValidatorCommitteeSignatureAggregator { // The Rust code always writes pointers as 8 bytes, and will // fail to compile if they don't fit. return lift(Pointer(buf.getLong())) } - override fun allocationSize(value: UserSignature) = 8UL + override fun allocationSize(value: ValidatorCommitteeSignatureAggregator) = 8UL - override fun write(value: UserSignature, buf: ByteBuffer) { + override fun write(value: ValidatorCommitteeSignatureAggregator, buf: ByteBuffer) { // The Rust code always expects pointers written as 8 bytes, // and will fail to compile if they don't fit. buf.putLong(Pointer.nativeValue(lower(value))) @@ -37747,24 +39458,20 @@ public object FfiConverterTypeUserSignature: FfiConverter - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_usersignatureverifier_new( - _status) + uniffiRustCallWithError(SdkFfiException) { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_validatorcommitteesignatureverifier_new( + FfiConverterTypeValidatorCommittee.lower(`committee`),_status) } ) @@ -37841,7 +39548,7 @@ open class UserSignatureVerifier: Disposable, AutoCloseable, UserSignatureVerifi override fun run() { pointer?.let { ptr -> uniffiRustCall { status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_usersignatureverifier(ptr, status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_validatorcommitteesignatureverifier(ptr, status) } } } @@ -37849,44 +39556,56 @@ open class UserSignatureVerifier: Disposable, AutoCloseable, UserSignatureVerifi fun uniffiClonePointer(): Pointer { return uniffiRustCall() { status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_usersignatureverifier(pointer!!, status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_validatorcommitteesignatureverifier(pointer!!, status) } } + override fun `committee`(): ValidatorCommittee { + return FfiConverterTypeValidatorCommittee.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_committee( + it, _status) +} + } + ) + } - @Throws(SdkFfiException::class)override fun `verify`(`message`: kotlin.ByteArray, `signature`: UserSignature) + + + @Throws(SdkFfiException::class)override fun `verify`(`message`: kotlin.ByteArray, `signature`: ValidatorSignature) = callWithPointer { uniffiRustCallWithError(SdkFfiException) { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignatureverifier_verify( - it, FfiConverterByteArray.lower(`message`),FfiConverterTypeUserSignature.lower(`signature`),_status) + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_verify( + it, FfiConverterByteArray.lower(`message`),FfiConverterTypeValidatorSignature.lower(`signature`),_status) } } - override fun `withZkloginVerifier`(`zkloginVerifier`: ZkloginVerifier): UserSignatureVerifier { - return FfiConverterTypeUserSignatureVerifier.lift( + + @Throws(SdkFfiException::class)override fun `verifyAggregated`(`message`: kotlin.ByteArray, `signature`: ValidatorAggregatedSignature) + = callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignatureverifier_with_zklogin_verifier( - it, FfiConverterTypeZkloginVerifier.lower(`zkloginVerifier`),_status) + uniffiRustCallWithError(SdkFfiException) { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_verify_aggregated( + it, FfiConverterByteArray.lower(`message`),FfiConverterTypeValidatorAggregatedSignature.lower(`signature`),_status) } } - ) - } + - override fun `zkloginVerifier`(): ZkloginVerifier? { - return FfiConverterOptionalTypeZkloginVerifier.lift( + + @Throws(SdkFfiException::class)override fun `verifyCheckpointSummary`(`summary`: CheckpointSummary, `signature`: ValidatorAggregatedSignature) + = callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_usersignatureverifier_zklogin_verifier( - it, _status) + uniffiRustCallWithError(SdkFfiException) { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_verify_checkpoint_summary( + it, FfiConverterTypeCheckpointSummary.lower(`summary`),FfiConverterTypeValidatorAggregatedSignature.lower(`signature`),_status) } } - ) - } + @@ -37900,25 +39619,25 @@ open class UserSignatureVerifier: Disposable, AutoCloseable, UserSignatureVerifi /** * @suppress */ -public object FfiConverterTypeUserSignatureVerifier: FfiConverter { +public object FfiConverterTypeValidatorCommitteeSignatureVerifier: FfiConverter { - override fun lower(value: UserSignatureVerifier): Pointer { + override fun lower(value: ValidatorCommitteeSignatureVerifier): Pointer { return value.uniffiClonePointer() } - override fun lift(value: Pointer): UserSignatureVerifier { - return UserSignatureVerifier(value) + override fun lift(value: Pointer): ValidatorCommitteeSignatureVerifier { + return ValidatorCommitteeSignatureVerifier(value) } - override fun read(buf: ByteBuffer): UserSignatureVerifier { + override fun read(buf: ByteBuffer): ValidatorCommitteeSignatureVerifier { // The Rust code always writes pointers as 8 bytes, and will // fail to compile if they don't fit. return lift(Pointer(buf.getLong())) } - override fun allocationSize(value: UserSignatureVerifier) = 8UL + override fun allocationSize(value: ValidatorCommitteeSignatureVerifier) = 8UL - override fun write(value: UserSignatureVerifier, buf: ByteBuffer) { + override fun write(value: ValidatorCommitteeSignatureVerifier, buf: ByteBuffer) { // The Rust code always expects pointers written as 8 bytes, // and will fail to compile if they don't fit. buf.putLong(Pointer.nativeValue(lower(value))) @@ -38307,6 +40026,303 @@ public object FfiConverterTypeValidatorExecutionTimeObservation: FfiConverter + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_constructor_validatorsignature_new( + FfiConverterULong.lower(`epoch`),FfiConverterTypeBls12381PublicKey.lower(`publicKey`),FfiConverterTypeBls12381Signature.lower(`signature`),_status) +} + ) + + protected val pointer: Pointer? + protected val cleanable: UniffiCleaner.Cleanable + + private val wasDestroyed = AtomicBoolean(false) + private val callCounter = AtomicLong(1) + + override fun destroy() { + // Only allow a single call to this method. + // TODO: maybe we should log a warning if called more than once? + if (this.wasDestroyed.compareAndSet(false, true)) { + // This decrement always matches the initial count of 1 given at creation time. + if (this.callCounter.decrementAndGet() == 0L) { + cleanable.clean() + } + } + } + + @Synchronized + override fun close() { + this.destroy() + } + + internal inline fun callWithPointer(block: (ptr: Pointer) -> R): R { + // Check and increment the call counter, to keep the object alive. + // This needs a compare-and-set retry loop in case of concurrent updates. + do { + val c = this.callCounter.get() + if (c == 0L) { + throw IllegalStateException("${this.javaClass.simpleName} object has already been destroyed") + } + if (c == Long.MAX_VALUE) { + throw IllegalStateException("${this.javaClass.simpleName} call counter would overflow") + } + } while (! this.callCounter.compareAndSet(c, c + 1L)) + // Now we can safely do the method call without the pointer being freed concurrently. + try { + return block(this.uniffiClonePointer()) + } finally { + // This decrement always matches the increment we performed above. + if (this.callCounter.decrementAndGet() == 0L) { + cleanable.clean() + } + } + } + + // Use a static inner class instead of a closure so as not to accidentally + // capture `this` as part of the cleanable's action. + private class UniffiCleanAction(private val pointer: Pointer?) : Runnable { + override fun run() { + pointer?.let { ptr -> + uniffiRustCall { status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_free_validatorsignature(ptr, status) + } + } + } + } + + fun uniffiClonePointer(): Pointer { + return uniffiRustCall() { status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_clone_validatorsignature(pointer!!, status) + } + } + + override fun `epoch`(): kotlin.ULong { + return FfiConverterULong.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_validatorsignature_epoch( + it, _status) +} + } + ) + } + + + override fun `publicKey`(): Bls12381PublicKey { + return FfiConverterTypeBls12381PublicKey.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_validatorsignature_public_key( + it, _status) +} + } + ) + } + + + override fun `signature`(): Bls12381Signature { + return FfiConverterTypeBls12381Signature.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_iota_sdk_ffi_fn_method_validatorsignature_signature( + it, _status) +} + } + ) + } + + + + + + + companion object + +} + +/** + * @suppress + */ +public object FfiConverterTypeValidatorSignature: FfiConverter { + + override fun lower(value: ValidatorSignature): Pointer { + return value.uniffiClonePointer() + } + + override fun lift(value: Pointer): ValidatorSignature { + return ValidatorSignature(value) + } + + override fun read(buf: ByteBuffer): ValidatorSignature { + // The Rust code always writes pointers as 8 bytes, and will + // fail to compile if they don't fit. + return lift(Pointer(buf.getLong())) + } + + override fun allocationSize(value: ValidatorSignature) = 8UL + + override fun write(value: ValidatorSignature, buf: ByteBuffer) { + // The Rust code always expects pointers written as 8 bytes, + // and will fail to compile if they don't fit. + buf.putLong(Pointer.nativeValue(lower(value))) + } +} + + +// This template implements a class for working with a Rust struct via a Pointer/Arc +// to the live Rust struct on the other side of the FFI. +// +// Each instance implements core operations for working with the Rust `Arc` and the +// Kotlin Pointer to work with the live Rust struct on the other side of the FFI. +// +// There's some subtlety here, because we have to be careful not to operate on a Rust +// struct after it has been dropped, and because we must expose a public API for freeing +// theq Kotlin wrapper object in lieu of reliable finalizers. The core requirements are: +// +// * Each instance holds an opaque pointer to the underlying Rust struct. +// Method calls need to read this pointer from the object's state and pass it in to +// the Rust FFI. +// +// * When an instance is no longer needed, its pointer should be passed to a +// special destructor function provided by the Rust FFI, which will drop the +// underlying Rust struct. +// +// * Given an instance, calling code is expected to call the special +// `destroy` method in order to free it after use, either by calling it explicitly +// or by using a higher-level helper like the `use` method. Failing to do so risks +// leaking the underlying Rust struct. +// +// * We can't assume that calling code will do the right thing, and must be prepared +// to handle Kotlin method calls executing concurrently with or even after a call to +// `destroy`, and to handle multiple (possibly concurrent!) calls to `destroy`. +// +// * We must never allow Rust code to operate on the underlying Rust struct after +// the destructor has been called, and must never call the destructor more than once. +// Doing so may trigger memory unsafety. +// +// * To mitigate many of the risks of leaking memory and use-after-free unsafety, a `Cleaner` +// is implemented to call the destructor when the Kotlin object becomes unreachable. +// This is done in a background thread. This is not a panacea, and client code should be aware that +// 1. the thread may starve if some there are objects that have poorly performing +// `drop` methods or do significant work in their `drop` methods. +// 2. the thread is shared across the whole library. This can be tuned by using `android_cleaner = true`, +// or `android = true` in the [`kotlin` section of the `uniffi.toml` file](https://mozilla.github.io/uniffi-rs/kotlin/configuration.html). +// +// If we try to implement this with mutual exclusion on access to the pointer, there is the +// possibility of a race between a method call and a concurrent call to `destroy`: +// +// * Thread A starts a method call, reads the value of the pointer, but is interrupted +// before it can pass the pointer over the FFI to Rust. +// * Thread B calls `destroy` and frees the underlying Rust struct. +// * Thread A resumes, passing the already-read pointer value to Rust and triggering +// a use-after-free. +// +// One possible solution would be to use a `ReadWriteLock`, with each method call taking +// a read lock (and thus allowed to run concurrently) and the special `destroy` method +// taking a write lock (and thus blocking on live method calls). However, we aim not to +// generate methods with any hidden blocking semantics, and a `destroy` method that might +// block if called incorrectly seems to meet that bar. +// +// So, we achieve our goals by giving each instance an associated `AtomicLong` counter to track +// the number of in-flight method calls, and an `AtomicBoolean` flag to indicate whether `destroy` +// has been called. These are updated according to the following rules: +// +// * The initial value of the counter is 1, indicating a live object with no in-flight calls. +// The initial value for the flag is false. +// +// * At the start of each method call, we atomically check the counter. +// If it is 0 then the underlying Rust struct has already been destroyed and the call is aborted. +// If it is nonzero them we atomically increment it by 1 and proceed with the method call. +// +// * At the end of each method call, we atomically decrement and check the counter. +// If it has reached zero then we destroy the underlying Rust struct. +// +// * When `destroy` is called, we atomically flip the flag from false to true. +// If the flag was already true we silently fail. +// Otherwise we atomically decrement and check the counter. +// If it has reached zero then we destroy the underlying Rust struct. +// +// Astute readers may observe that this all sounds very similar to the way that Rust's `Arc` works, +// and indeed it is, with the addition of a flag to guard against multiple calls to `destroy`. +// +// The overall effect is that the underlying Rust struct is destroyed only when `destroy` has been +// called *and* all in-flight method calls have completed, avoiding violating any of the expectations +// of the underlying Rust code. +// +// This makes a cleaner a better alternative to _not_ calling `destroy()` as +// and when the object is finished with, but the abstraction is not perfect: if the Rust object's `drop` +// method is slow, and/or there are many objects to cleanup, and it's on a low end Android device, then the cleaner +// thread may be starved, and the app will leak memory. +// +// In this case, `destroy`ing manually may be a better solution. +// +// The cleaner can live side by side with the manual calling of `destroy`. In the order of responsiveness, uniffi objects +// with Rust peers are reclaimed: +// +// 1. By calling the `destroy` method of the object, which calls `rustObject.free()`. If that doesn't happen: +// 2. When the object becomes unreachable, AND the Cleaner thread gets to call `rustObject.free()`. If the thread is starved then: +// 3. The memory is reclaimed when the process terminates. +// +// [1] https://stackoverflow.com/questions/24376768/can-java-finalize-an-object-when-it-is-still-in-scope/24380219 +// + + /** * Object version assignment from consensus * @@ -43904,6 +45920,59 @@ public object FfiConverterTypeValidator: FfiConverterRustBuffer { +/** + * The Validator Set for a particular epoch. + * + * # BCS + * + * The BCS serialized form for this type is defined by the following ABNF: + * + * ```text + * validator-committee = u64 ; epoch + * (vector validator-committee-member) + * ``` + */ +data class ValidatorCommittee ( + var `epoch`: kotlin.ULong, + var `members`: List +) : Disposable { + + @Suppress("UNNECESSARY_SAFE_CALL") // codegen is much simpler if we unconditionally emit safe calls here + override fun destroy() { + + Disposable.destroy( + this.`epoch`, + this.`members` + ) + } + + companion object +} + +/** + * @suppress + */ +public object FfiConverterTypeValidatorCommittee: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): ValidatorCommittee { + return ValidatorCommittee( + FfiConverterULong.read(buf), + FfiConverterSequenceTypeValidatorCommitteeMember.read(buf), + ) + } + + override fun allocationSize(value: ValidatorCommittee) = ( + FfiConverterULong.allocationSize(value.`epoch`) + + FfiConverterSequenceTypeValidatorCommitteeMember.allocationSize(value.`members`) + ) + + override fun write(value: ValidatorCommittee, buf: ByteBuffer) { + FfiConverterULong.write(value.`epoch`, buf) + FfiConverterSequenceTypeValidatorCommitteeMember.write(value.`members`, buf) + } +} + + + /** * A member of a Validator Committee * diff --git a/bindings/python/lib/iota_sdk_ffi.py b/bindings/python/lib/iota_sdk_ffi.py index 928d40c8a..577391d5c 100644 --- a/bindings/python/lib/iota_sdk_ffi.py +++ b/bindings/python/lib/iota_sdk_ffi.py @@ -467,10 +467,24 @@ def _uniffi_check_api_checksums(lib): raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_iota_sdk_ffi_checksum_method_argument_get_nested_result() != 53358: raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_public_key() != 53765: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_scheme() != 8293: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_sign_checkpoint_summary() != 1487: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_try_sign() != 59341: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_verifying_key() != 36438: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_iota_sdk_ffi_checksum_method_bls12381publickey_to_bytes() != 9890: raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_iota_sdk_ffi_checksum_method_bls12381signature_to_bytes() != 56969: raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_bls12381verifyingkey_public_key() != 59353: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_bls12381verifyingkey_verify() != 54718: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_iota_sdk_ffi_checksum_method_bn254fieldelement_padded() != 44301: raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_iota_sdk_ffi_checksum_method_bn254fieldelement_unpadded() != 33350: @@ -1203,10 +1217,36 @@ def _uniffi_check_api_checksums(lib): raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_iota_sdk_ffi_checksum_method_usersignatureverifier_zklogin_verifier() != 9821: raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_validatoraggregatedsignature_bitmap_bytes() != 59039: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_validatoraggregatedsignature_epoch() != 54283: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_validatoraggregatedsignature_signature() != 39125: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureaggregator_add_signature() != 13923: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureaggregator_committee() != 36159: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureaggregator_finish() != 7324: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_committee() != 5093: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_verify() != 29238: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_verify_aggregated() != 46271: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_verify_checkpoint_summary() != 36331: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_iota_sdk_ffi_checksum_method_validatorexecutiontimeobservation_duration() != 59803: raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_iota_sdk_ffi_checksum_method_validatorexecutiontimeobservation_validator() != 10003: raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_validatorsignature_epoch() != 15301: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_validatorsignature_public_key() != 16384: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_validatorsignature_signature() != 58273: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_iota_sdk_ffi_checksum_method_versionassignment_object_id() != 50440: raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_iota_sdk_ffi_checksum_method_versionassignment_version() != 51219: @@ -1261,6 +1301,10 @@ def _uniffi_check_api_checksums(lib): raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_iota_sdk_ffi_checksum_constructor_argument_new_result() != 44025: raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381privatekey_generate() != 14780: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381privatekey_new() != 52467: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381publickey_from_bytes() != 6069: raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381publickey_from_str() != 26128: @@ -1273,6 +1317,8 @@ def _uniffi_check_api_checksums(lib): raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381signature_generate() != 58435: raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381verifyingkey_new() != 22402: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_iota_sdk_ffi_checksum_constructor_bn254fieldelement_from_bytes() != 3672: raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_iota_sdk_ffi_checksum_constructor_bn254fieldelement_from_str() != 21214: @@ -1617,8 +1663,16 @@ def _uniffi_check_api_checksums(lib): raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_iota_sdk_ffi_checksum_constructor_usersignatureverifier_new() != 32322: raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_validatoraggregatedsignature_new() != 15846: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_validatorcommitteesignatureaggregator_new_checkpoint_summary() != 25823: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_validatorcommitteesignatureverifier_new() != 17424: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_iota_sdk_ffi_checksum_constructor_validatorexecutiontimeobservation_new() != 47546: raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_validatorsignature_new() != 2599: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_iota_sdk_ffi_checksum_constructor_versionassignment_new() != 14186: raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") if lib.uniffi_iota_sdk_ffi_checksum_constructor_zkloginauthenticator_new() != 32812: @@ -1819,6 +1873,52 @@ class _UniffiForeignFutureStructVoid(ctypes.Structure): ctypes.POINTER(_UniffiRustCallStatus), ) _UniffiLib.uniffi_iota_sdk_ffi_fn_free_batchsendstatus.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_bls12381privatekey.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_bls12381privatekey.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_bls12381privatekey.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_bls12381privatekey.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_bls12381privatekey_generate.argtypes = ( + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_bls12381privatekey_generate.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_bls12381privatekey_new.argtypes = ( + _UniffiRustBuffer, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_bls12381privatekey_new.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_public_key.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_public_key.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_scheme.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_scheme.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_sign_checkpoint_summary.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_sign_checkpoint_summary.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_try_sign.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_try_sign.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_verifying_key.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_verifying_key.restype = ctypes.c_void_p _UniffiLib.uniffi_iota_sdk_ffi_fn_clone_bls12381publickey.argtypes = ( ctypes.c_void_p, ctypes.POINTER(_UniffiRustCallStatus), @@ -1877,6 +1977,33 @@ class _UniffiForeignFutureStructVoid(ctypes.Structure): ctypes.POINTER(_UniffiRustCallStatus), ) _UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381signature_to_bytes.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_bls12381verifyingkey.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_bls12381verifyingkey.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_bls12381verifyingkey.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_bls12381verifyingkey.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_bls12381verifyingkey_new.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_bls12381verifyingkey_new.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381verifyingkey_public_key.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381verifyingkey_public_key.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381verifyingkey_verify.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381verifyingkey_verify.restype = None _UniffiLib.uniffi_iota_sdk_ffi_fn_clone_bn254fieldelement.argtypes = ( ctypes.c_void_p, ctypes.POINTER(_UniffiRustCallStatus), @@ -5556,6 +5683,111 @@ class _UniffiForeignFutureStructVoid(ctypes.Structure): ctypes.POINTER(_UniffiRustCallStatus), ) _UniffiLib.uniffi_iota_sdk_ffi_fn_method_usersignatureverifier_zklogin_verifier.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_validatoraggregatedsignature.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_validatoraggregatedsignature.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_validatoraggregatedsignature.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_validatoraggregatedsignature.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_validatoraggregatedsignature_new.argtypes = ( + ctypes.c_uint64, + ctypes.c_void_p, + _UniffiRustBuffer, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_validatoraggregatedsignature_new.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatoraggregatedsignature_bitmap_bytes.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatoraggregatedsignature_bitmap_bytes.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatoraggregatedsignature_epoch.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatoraggregatedsignature_epoch.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatoraggregatedsignature_signature.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatoraggregatedsignature_signature.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_validatorcommitteesignatureaggregator.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_validatorcommitteesignatureaggregator.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_validatorcommitteesignatureaggregator.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_validatorcommitteesignatureaggregator.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_validatorcommitteesignatureaggregator_new_checkpoint_summary.argtypes = ( + _UniffiRustBuffer, + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_validatorcommitteesignatureaggregator_new_checkpoint_summary.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureaggregator_add_signature.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureaggregator_add_signature.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureaggregator_committee.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureaggregator_committee.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureaggregator_finish.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureaggregator_finish.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_validatorcommitteesignatureverifier.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_validatorcommitteesignatureverifier.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_validatorcommitteesignatureverifier.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_validatorcommitteesignatureverifier.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_validatorcommitteesignatureverifier_new.argtypes = ( + _UniffiRustBuffer, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_validatorcommitteesignatureverifier_new.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_committee.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_committee.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_verify.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_verify.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_verify_aggregated.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_verify_aggregated.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_verify_checkpoint_summary.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_verify_checkpoint_summary.restype = None _UniffiLib.uniffi_iota_sdk_ffi_fn_clone_validatorexecutiontimeobservation.argtypes = ( ctypes.c_void_p, ctypes.POINTER(_UniffiRustCallStatus), @@ -5582,6 +5814,38 @@ class _UniffiForeignFutureStructVoid(ctypes.Structure): ctypes.POINTER(_UniffiRustCallStatus), ) _UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorexecutiontimeobservation_validator.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_validatorsignature.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_validatorsignature.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_validatorsignature.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_validatorsignature.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_validatorsignature_new.argtypes = ( + ctypes.c_uint64, + ctypes.c_void_p, + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_validatorsignature_new.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorsignature_epoch.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorsignature_epoch.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorsignature_public_key.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorsignature_public_key.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorsignature_signature.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorsignature_signature.restype = ctypes.c_void_p _UniffiLib.uniffi_iota_sdk_ffi_fn_clone_versionassignment.argtypes = ( ctypes.c_void_p, ctypes.POINTER(_UniffiRustCallStatus), @@ -6064,12 +6328,33 @@ class _UniffiForeignFutureStructVoid(ctypes.Structure): _UniffiLib.uniffi_iota_sdk_ffi_checksum_method_argument_get_nested_result.argtypes = ( ) _UniffiLib.uniffi_iota_sdk_ffi_checksum_method_argument_get_nested_result.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_public_key.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_public_key.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_scheme.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_scheme.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_sign_checkpoint_summary.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_sign_checkpoint_summary.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_try_sign.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_try_sign.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_verifying_key.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_bls12381privatekey_verifying_key.restype = ctypes.c_uint16 _UniffiLib.uniffi_iota_sdk_ffi_checksum_method_bls12381publickey_to_bytes.argtypes = ( ) _UniffiLib.uniffi_iota_sdk_ffi_checksum_method_bls12381publickey_to_bytes.restype = ctypes.c_uint16 _UniffiLib.uniffi_iota_sdk_ffi_checksum_method_bls12381signature_to_bytes.argtypes = ( ) _UniffiLib.uniffi_iota_sdk_ffi_checksum_method_bls12381signature_to_bytes.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_bls12381verifyingkey_public_key.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_bls12381verifyingkey_public_key.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_bls12381verifyingkey_verify.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_bls12381verifyingkey_verify.restype = ctypes.c_uint16 _UniffiLib.uniffi_iota_sdk_ffi_checksum_method_bn254fieldelement_padded.argtypes = ( ) _UniffiLib.uniffi_iota_sdk_ffi_checksum_method_bn254fieldelement_padded.restype = ctypes.c_uint16 @@ -7168,12 +7453,51 @@ class _UniffiForeignFutureStructVoid(ctypes.Structure): _UniffiLib.uniffi_iota_sdk_ffi_checksum_method_usersignatureverifier_zklogin_verifier.argtypes = ( ) _UniffiLib.uniffi_iota_sdk_ffi_checksum_method_usersignatureverifier_zklogin_verifier.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatoraggregatedsignature_bitmap_bytes.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatoraggregatedsignature_bitmap_bytes.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatoraggregatedsignature_epoch.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatoraggregatedsignature_epoch.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatoraggregatedsignature_signature.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatoraggregatedsignature_signature.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureaggregator_add_signature.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureaggregator_add_signature.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureaggregator_committee.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureaggregator_committee.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureaggregator_finish.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureaggregator_finish.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_committee.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_committee.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_verify.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_verify.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_verify_aggregated.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_verify_aggregated.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_verify_checkpoint_summary.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorcommitteesignatureverifier_verify_checkpoint_summary.restype = ctypes.c_uint16 _UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorexecutiontimeobservation_duration.argtypes = ( ) _UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorexecutiontimeobservation_duration.restype = ctypes.c_uint16 _UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorexecutiontimeobservation_validator.argtypes = ( ) _UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorexecutiontimeobservation_validator.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorsignature_epoch.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorsignature_epoch.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorsignature_public_key.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorsignature_public_key.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorsignature_signature.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorsignature_signature.restype = ctypes.c_uint16 _UniffiLib.uniffi_iota_sdk_ffi_checksum_method_versionassignment_object_id.argtypes = ( ) _UniffiLib.uniffi_iota_sdk_ffi_checksum_method_versionassignment_object_id.restype = ctypes.c_uint16 @@ -7255,6 +7579,12 @@ class _UniffiForeignFutureStructVoid(ctypes.Structure): _UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_argument_new_result.argtypes = ( ) _UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_argument_new_result.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381privatekey_generate.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381privatekey_generate.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381privatekey_new.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381privatekey_new.restype = ctypes.c_uint16 _UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381publickey_from_bytes.argtypes = ( ) _UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381publickey_from_bytes.restype = ctypes.c_uint16 @@ -7273,6 +7603,9 @@ class _UniffiForeignFutureStructVoid(ctypes.Structure): _UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381signature_generate.argtypes = ( ) _UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381signature_generate.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381verifyingkey_new.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381verifyingkey_new.restype = ctypes.c_uint16 _UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_bn254fieldelement_from_bytes.argtypes = ( ) _UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_bn254fieldelement_from_bytes.restype = ctypes.c_uint16 @@ -7789,9 +8122,21 @@ class _UniffiForeignFutureStructVoid(ctypes.Structure): _UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_usersignatureverifier_new.argtypes = ( ) _UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_usersignatureverifier_new.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_validatoraggregatedsignature_new.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_validatoraggregatedsignature_new.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_validatorcommitteesignatureaggregator_new_checkpoint_summary.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_validatorcommitteesignatureaggregator_new_checkpoint_summary.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_validatorcommitteesignatureverifier_new.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_validatorcommitteesignatureverifier_new.restype = ctypes.c_uint16 _UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_validatorexecutiontimeobservation_new.argtypes = ( ) _UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_validatorexecutiontimeobservation_new.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_validatorsignature_new.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_validatorsignature_new.restype = ctypes.c_uint16 _UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_versionassignment_new.argtypes = ( ) _UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_versionassignment_new.restype = ctypes.c_uint16 @@ -8176,6 +8521,18 @@ def write(value, buf): + + + + + + + + + + + + @@ -12379,6 +12736,55 @@ def write(value, buf): _UniffiConverterOptionalInt32.write(value.voting_power, buf) +class ValidatorCommittee: + """ + The Validator Set for a particular epoch. + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + validator-committee = u64 ; epoch + (vector validator-committee-member) + ``` + """ + + epoch: "int" + members: "typing.List[ValidatorCommitteeMember]" + def __init__(self, *, epoch: "int", members: "typing.List[ValidatorCommitteeMember]"): + self.epoch = epoch + self.members = members + + def __str__(self): + return "ValidatorCommittee(epoch={}, members={})".format(self.epoch, self.members) + + def __eq__(self, other): + if self.epoch != other.epoch: + return False + if self.members != other.members: + return False + return True + +class _UniffiConverterTypeValidatorCommittee(_UniffiConverterRustBuffer): + @staticmethod + def read(buf): + return ValidatorCommittee( + epoch=_UniffiConverterUInt64.read(buf), + members=_UniffiConverterSequenceTypeValidatorCommitteeMember.read(buf), + ) + + @staticmethod + def check_lower(value): + _UniffiConverterUInt64.check_lower(value.epoch) + _UniffiConverterSequenceTypeValidatorCommitteeMember.check_lower(value.members) + + @staticmethod + def write(value, buf): + _UniffiConverterUInt64.write(value.epoch, buf) + _UniffiConverterSequenceTypeValidatorCommitteeMember.write(value.members, buf) + + class ValidatorCommitteeMember: """ A member of a Validator Committee @@ -19823,6 +20229,130 @@ def read(cls, buf: _UniffiRustBuffer): @classmethod def write(cls, value: BatchSendStatusProtocol, buf: _UniffiRustBuffer): buf.write_u64(cls.lower(value)) +class Bls12381PrivateKeyProtocol(typing.Protocol): + def public_key(self, ): + raise NotImplementedError + def scheme(self, ): + raise NotImplementedError + def sign_checkpoint_summary(self, summary: "CheckpointSummary"): + raise NotImplementedError + def try_sign(self, message: "bytes"): + raise NotImplementedError + def verifying_key(self, ): + raise NotImplementedError +# Bls12381PrivateKey is a Rust-only trait - it's a wrapper around a Rust implementation. +class Bls12381PrivateKey(): + _pointer: ctypes.c_void_p + def __init__(self, bytes: "bytes"): + _UniffiConverterBytes.check_lower(bytes) + + self._pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeSdkFfiError,_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_bls12381privatekey_new, + _UniffiConverterBytes.lower(bytes)) + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_bls12381privatekey, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_bls12381privatekey, self._pointer) + + # Used by alternative constructors or any methods which return this type. + @classmethod + def _make_instance_(cls, pointer): + # Lightly yucky way to bypass the usual __init__ logic + # and just create a new instance with the required pointer. + inst = cls.__new__(cls) + inst._pointer = pointer + return inst + @classmethod + def generate(cls, ): + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_bls12381privatekey_generate,) + return cls._make_instance_(pointer) + + + + def public_key(self, ) -> "Bls12381PublicKey": + return _UniffiConverterTypeBls12381PublicKey.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_public_key,self._uniffi_clone_pointer(),) + ) + + + + + + def scheme(self, ) -> "SignatureScheme": + return _UniffiConverterTypeSignatureScheme.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_scheme,self._uniffi_clone_pointer(),) + ) + + + + + + def sign_checkpoint_summary(self, summary: "CheckpointSummary") -> "ValidatorSignature": + _UniffiConverterTypeCheckpointSummary.check_lower(summary) + + return _UniffiConverterTypeValidatorSignature.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_sign_checkpoint_summary,self._uniffi_clone_pointer(), + _UniffiConverterTypeCheckpointSummary.lower(summary)) + ) + + + + + + def try_sign(self, message: "bytes") -> "Bls12381Signature": + _UniffiConverterBytes.check_lower(message) + + return _UniffiConverterTypeBls12381Signature.lift( + _uniffi_rust_call_with_error(_UniffiConverterTypeSdkFfiError,_UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_try_sign,self._uniffi_clone_pointer(), + _UniffiConverterBytes.lower(message)) + ) + + + + + + def verifying_key(self, ) -> "Bls12381VerifyingKey": + return _UniffiConverterTypeBls12381VerifyingKey.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381privatekey_verifying_key,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeBls12381PrivateKey: + + @staticmethod + def lift(value: int): + return Bls12381PrivateKey._make_instance_(value) + + @staticmethod + def check_lower(value: Bls12381PrivateKey): + if not isinstance(value, Bls12381PrivateKey): + raise TypeError("Expected Bls12381PrivateKey instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: Bls12381PrivateKeyProtocol): + if not isinstance(value, Bls12381PrivateKey): + raise TypeError("Expected Bls12381PrivateKey instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: Bls12381PrivateKeyProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) class Bls12381PublicKeyProtocol(typing.Protocol): """ A bls12381 min-sig public key. @@ -20071,6 +20601,90 @@ def read(cls, buf: _UniffiRustBuffer): @classmethod def write(cls, value: Bls12381SignatureProtocol, buf: _UniffiRustBuffer): buf.write_u64(cls.lower(value)) +class Bls12381VerifyingKeyProtocol(typing.Protocol): + def public_key(self, ): + raise NotImplementedError + def verify(self, message: "bytes",signature: "Bls12381Signature"): + raise NotImplementedError +# Bls12381VerifyingKey is a Rust-only trait - it's a wrapper around a Rust implementation. +class Bls12381VerifyingKey(): + _pointer: ctypes.c_void_p + def __init__(self, public_key: "Bls12381PublicKey"): + _UniffiConverterTypeBls12381PublicKey.check_lower(public_key) + + self._pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeSdkFfiError,_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_bls12381verifyingkey_new, + _UniffiConverterTypeBls12381PublicKey.lower(public_key)) + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_bls12381verifyingkey, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_bls12381verifyingkey, self._pointer) + + # Used by alternative constructors or any methods which return this type. + @classmethod + def _make_instance_(cls, pointer): + # Lightly yucky way to bypass the usual __init__ logic + # and just create a new instance with the required pointer. + inst = cls.__new__(cls) + inst._pointer = pointer + return inst + + + def public_key(self, ) -> "Bls12381PublicKey": + return _UniffiConverterTypeBls12381PublicKey.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381verifyingkey_public_key,self._uniffi_clone_pointer(),) + ) + + + + + + def verify(self, message: "bytes",signature: "Bls12381Signature") -> None: + _UniffiConverterBytes.check_lower(message) + + _UniffiConverterTypeBls12381Signature.check_lower(signature) + + _uniffi_rust_call_with_error(_UniffiConverterTypeSdkFfiError,_UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381verifyingkey_verify,self._uniffi_clone_pointer(), + _UniffiConverterBytes.lower(message), + _UniffiConverterTypeBls12381Signature.lower(signature)) + + + + + + + +class _UniffiConverterTypeBls12381VerifyingKey: + + @staticmethod + def lift(value: int): + return Bls12381VerifyingKey._make_instance_(value) + + @staticmethod + def check_lower(value: Bls12381VerifyingKey): + if not isinstance(value, Bls12381VerifyingKey): + raise TypeError("Expected Bls12381VerifyingKey instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: Bls12381VerifyingKeyProtocol): + if not isinstance(value, Bls12381VerifyingKey): + raise TypeError("Expected Bls12381VerifyingKey instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: Bls12381VerifyingKeyProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) class Bn254FieldElementProtocol(typing.Protocol): """ A point on the BN254 elliptic curve. @@ -35161,6 +35775,360 @@ def read(cls, buf: _UniffiRustBuffer): @classmethod def write(cls, value: UserSignatureVerifierProtocol, buf: _UniffiRustBuffer): buf.write_u64(cls.lower(value)) +class ValidatorAggregatedSignatureProtocol(typing.Protocol): + """ + An aggregated signature from multiple Validators. + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + validator-aggregated-signature = u64 ; epoch + bls-signature + roaring-bitmap + roaring-bitmap = bytes ; where the contents of the bytes are valid + ; according to the serialized spec for + ; roaring bitmaps + ``` + + See [here](https://github.com/RoaringBitmap/RoaringFormatSpec) for the specification for the + serialized format of RoaringBitmaps. + """ + + def bitmap_bytes(self, ): + raise NotImplementedError + def epoch(self, ): + raise NotImplementedError + def signature(self, ): + raise NotImplementedError +# ValidatorAggregatedSignature is a Rust-only trait - it's a wrapper around a Rust implementation. +class ValidatorAggregatedSignature(): + """ + An aggregated signature from multiple Validators. + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + validator-aggregated-signature = u64 ; epoch + bls-signature + roaring-bitmap + roaring-bitmap = bytes ; where the contents of the bytes are valid + ; according to the serialized spec for + ; roaring bitmaps + ``` + + See [here](https://github.com/RoaringBitmap/RoaringFormatSpec) for the specification for the + serialized format of RoaringBitmaps. + """ + + _pointer: ctypes.c_void_p + def __init__(self, epoch: "int",signature: "Bls12381Signature",bitmap_bytes: "bytes"): + _UniffiConverterUInt64.check_lower(epoch) + + _UniffiConverterTypeBls12381Signature.check_lower(signature) + + _UniffiConverterBytes.check_lower(bitmap_bytes) + + self._pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeSdkFfiError,_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_validatoraggregatedsignature_new, + _UniffiConverterUInt64.lower(epoch), + _UniffiConverterTypeBls12381Signature.lower(signature), + _UniffiConverterBytes.lower(bitmap_bytes)) + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_validatoraggregatedsignature, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_validatoraggregatedsignature, self._pointer) + + # Used by alternative constructors or any methods which return this type. + @classmethod + def _make_instance_(cls, pointer): + # Lightly yucky way to bypass the usual __init__ logic + # and just create a new instance with the required pointer. + inst = cls.__new__(cls) + inst._pointer = pointer + return inst + + + def bitmap_bytes(self, ) -> "bytes": + return _UniffiConverterBytes.lift( + _uniffi_rust_call_with_error(_UniffiConverterTypeSdkFfiError,_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatoraggregatedsignature_bitmap_bytes,self._uniffi_clone_pointer(),) + ) + + + + + + def epoch(self, ) -> "int": + return _UniffiConverterUInt64.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatoraggregatedsignature_epoch,self._uniffi_clone_pointer(),) + ) + + + + + + def signature(self, ) -> "Bls12381Signature": + return _UniffiConverterTypeBls12381Signature.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatoraggregatedsignature_signature,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeValidatorAggregatedSignature: + + @staticmethod + def lift(value: int): + return ValidatorAggregatedSignature._make_instance_(value) + + @staticmethod + def check_lower(value: ValidatorAggregatedSignature): + if not isinstance(value, ValidatorAggregatedSignature): + raise TypeError("Expected ValidatorAggregatedSignature instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: ValidatorAggregatedSignatureProtocol): + if not isinstance(value, ValidatorAggregatedSignature): + raise TypeError("Expected ValidatorAggregatedSignature instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: ValidatorAggregatedSignatureProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class ValidatorCommitteeSignatureAggregatorProtocol(typing.Protocol): + def add_signature(self, signature: "ValidatorSignature"): + raise NotImplementedError + def committee(self, ): + raise NotImplementedError + def finish(self, ): + raise NotImplementedError +# ValidatorCommitteeSignatureAggregator is a Rust-only trait - it's a wrapper around a Rust implementation. +class ValidatorCommitteeSignatureAggregator(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_validatorcommitteesignatureaggregator, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_validatorcommitteesignatureaggregator, self._pointer) + + # Used by alternative constructors or any methods which return this type. + @classmethod + def _make_instance_(cls, pointer): + # Lightly yucky way to bypass the usual __init__ logic + # and just create a new instance with the required pointer. + inst = cls.__new__(cls) + inst._pointer = pointer + return inst + @classmethod + def new_checkpoint_summary(cls, committee: "ValidatorCommittee",summary: "CheckpointSummary"): + _UniffiConverterTypeValidatorCommittee.check_lower(committee) + + _UniffiConverterTypeCheckpointSummary.check_lower(summary) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeSdkFfiError,_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_validatorcommitteesignatureaggregator_new_checkpoint_summary, + _UniffiConverterTypeValidatorCommittee.lower(committee), + _UniffiConverterTypeCheckpointSummary.lower(summary)) + return cls._make_instance_(pointer) + + + + def add_signature(self, signature: "ValidatorSignature") -> None: + _UniffiConverterTypeValidatorSignature.check_lower(signature) + + _uniffi_rust_call_with_error(_UniffiConverterTypeSdkFfiError,_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureaggregator_add_signature,self._uniffi_clone_pointer(), + _UniffiConverterTypeValidatorSignature.lower(signature)) + + + + + + + def committee(self, ) -> "ValidatorCommittee": + return _UniffiConverterTypeValidatorCommittee.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureaggregator_committee,self._uniffi_clone_pointer(),) + ) + + + + + + def finish(self, ) -> "ValidatorAggregatedSignature": + return _UniffiConverterTypeValidatorAggregatedSignature.lift( + _uniffi_rust_call_with_error(_UniffiConverterTypeSdkFfiError,_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureaggregator_finish,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeValidatorCommitteeSignatureAggregator: + + @staticmethod + def lift(value: int): + return ValidatorCommitteeSignatureAggregator._make_instance_(value) + + @staticmethod + def check_lower(value: ValidatorCommitteeSignatureAggregator): + if not isinstance(value, ValidatorCommitteeSignatureAggregator): + raise TypeError("Expected ValidatorCommitteeSignatureAggregator instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: ValidatorCommitteeSignatureAggregatorProtocol): + if not isinstance(value, ValidatorCommitteeSignatureAggregator): + raise TypeError("Expected ValidatorCommitteeSignatureAggregator instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: ValidatorCommitteeSignatureAggregatorProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class ValidatorCommitteeSignatureVerifierProtocol(typing.Protocol): + def committee(self, ): + raise NotImplementedError + def verify(self, message: "bytes",signature: "ValidatorSignature"): + raise NotImplementedError + def verify_aggregated(self, message: "bytes",signature: "ValidatorAggregatedSignature"): + raise NotImplementedError + def verify_checkpoint_summary(self, summary: "CheckpointSummary",signature: "ValidatorAggregatedSignature"): + raise NotImplementedError +# ValidatorCommitteeSignatureVerifier is a Rust-only trait - it's a wrapper around a Rust implementation. +class ValidatorCommitteeSignatureVerifier(): + _pointer: ctypes.c_void_p + def __init__(self, committee: "ValidatorCommittee"): + _UniffiConverterTypeValidatorCommittee.check_lower(committee) + + self._pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeSdkFfiError,_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_validatorcommitteesignatureverifier_new, + _UniffiConverterTypeValidatorCommittee.lower(committee)) + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_validatorcommitteesignatureverifier, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_validatorcommitteesignatureverifier, self._pointer) + + # Used by alternative constructors or any methods which return this type. + @classmethod + def _make_instance_(cls, pointer): + # Lightly yucky way to bypass the usual __init__ logic + # and just create a new instance with the required pointer. + inst = cls.__new__(cls) + inst._pointer = pointer + return inst + + + def committee(self, ) -> "ValidatorCommittee": + return _UniffiConverterTypeValidatorCommittee.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_committee,self._uniffi_clone_pointer(),) + ) + + + + + + def verify(self, message: "bytes",signature: "ValidatorSignature") -> None: + _UniffiConverterBytes.check_lower(message) + + _UniffiConverterTypeValidatorSignature.check_lower(signature) + + _uniffi_rust_call_with_error(_UniffiConverterTypeSdkFfiError,_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_verify,self._uniffi_clone_pointer(), + _UniffiConverterBytes.lower(message), + _UniffiConverterTypeValidatorSignature.lower(signature)) + + + + + + + def verify_aggregated(self, message: "bytes",signature: "ValidatorAggregatedSignature") -> None: + _UniffiConverterBytes.check_lower(message) + + _UniffiConverterTypeValidatorAggregatedSignature.check_lower(signature) + + _uniffi_rust_call_with_error(_UniffiConverterTypeSdkFfiError,_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_verify_aggregated,self._uniffi_clone_pointer(), + _UniffiConverterBytes.lower(message), + _UniffiConverterTypeValidatorAggregatedSignature.lower(signature)) + + + + + + + def verify_checkpoint_summary(self, summary: "CheckpointSummary",signature: "ValidatorAggregatedSignature") -> None: + _UniffiConverterTypeCheckpointSummary.check_lower(summary) + + _UniffiConverterTypeValidatorAggregatedSignature.check_lower(signature) + + _uniffi_rust_call_with_error(_UniffiConverterTypeSdkFfiError,_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorcommitteesignatureverifier_verify_checkpoint_summary,self._uniffi_clone_pointer(), + _UniffiConverterTypeCheckpointSummary.lower(summary), + _UniffiConverterTypeValidatorAggregatedSignature.lower(signature)) + + + + + + + +class _UniffiConverterTypeValidatorCommitteeSignatureVerifier: + + @staticmethod + def lift(value: int): + return ValidatorCommitteeSignatureVerifier._make_instance_(value) + + @staticmethod + def check_lower(value: ValidatorCommitteeSignatureVerifier): + if not isinstance(value, ValidatorCommitteeSignatureVerifier): + raise TypeError("Expected ValidatorCommitteeSignatureVerifier instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: ValidatorCommitteeSignatureVerifierProtocol): + if not isinstance(value, ValidatorCommitteeSignatureVerifier): + raise TypeError("Expected ValidatorCommitteeSignatureVerifier instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: ValidatorCommitteeSignatureVerifierProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) class ValidatorExecutionTimeObservationProtocol(typing.Protocol): """ An execution time observation from a particular validator @@ -35271,6 +36239,130 @@ def read(cls, buf: _UniffiRustBuffer): @classmethod def write(cls, value: ValidatorExecutionTimeObservationProtocol, buf: _UniffiRustBuffer): buf.write_u64(cls.lower(value)) +class ValidatorSignatureProtocol(typing.Protocol): + """ + A signature from a Validator + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + validator-signature = u64 ; epoch + bls-public-key + bls-signature + ``` + """ + + def epoch(self, ): + raise NotImplementedError + def public_key(self, ): + raise NotImplementedError + def signature(self, ): + raise NotImplementedError +# ValidatorSignature is a Rust-only trait - it's a wrapper around a Rust implementation. +class ValidatorSignature(): + """ + A signature from a Validator + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + validator-signature = u64 ; epoch + bls-public-key + bls-signature + ``` + """ + + _pointer: ctypes.c_void_p + def __init__(self, epoch: "int",public_key: "Bls12381PublicKey",signature: "Bls12381Signature"): + _UniffiConverterUInt64.check_lower(epoch) + + _UniffiConverterTypeBls12381PublicKey.check_lower(public_key) + + _UniffiConverterTypeBls12381Signature.check_lower(signature) + + self._pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_validatorsignature_new, + _UniffiConverterUInt64.lower(epoch), + _UniffiConverterTypeBls12381PublicKey.lower(public_key), + _UniffiConverterTypeBls12381Signature.lower(signature)) + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_validatorsignature, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_validatorsignature, self._pointer) + + # Used by alternative constructors or any methods which return this type. + @classmethod + def _make_instance_(cls, pointer): + # Lightly yucky way to bypass the usual __init__ logic + # and just create a new instance with the required pointer. + inst = cls.__new__(cls) + inst._pointer = pointer + return inst + + + def epoch(self, ) -> "int": + return _UniffiConverterUInt64.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorsignature_epoch,self._uniffi_clone_pointer(),) + ) + + + + + + def public_key(self, ) -> "Bls12381PublicKey": + return _UniffiConverterTypeBls12381PublicKey.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorsignature_public_key,self._uniffi_clone_pointer(),) + ) + + + + + + def signature(self, ) -> "Bls12381Signature": + return _UniffiConverterTypeBls12381Signature.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorsignature_signature,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeValidatorSignature: + + @staticmethod + def lift(value: int): + return ValidatorSignature._make_instance_(value) + + @staticmethod + def check_lower(value: ValidatorSignature): + if not isinstance(value, ValidatorSignature): + raise TypeError("Expected ValidatorSignature instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: ValidatorSignatureProtocol): + if not isinstance(value, ValidatorSignature): + raise TypeError("Expected ValidatorSignature instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: ValidatorSignatureProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) class VersionAssignmentProtocol(typing.Protocol): """ Object version assignment from consensus @@ -36327,6 +37419,7 @@ async def _uniffi_rust_call_async(rust_future, ffi_poll, ffi_complete, ffi_free, "UnchangedSharedObject", "UpgradeInfo", "Validator", + "ValidatorCommittee", "ValidatorCommitteeMember", "ValidatorConnection", "ValidatorCredentials", @@ -36336,8 +37429,10 @@ async def _uniffi_rust_call_async(rust_future, ffi_poll, ffi_complete, ffi_free, "Address", "Argument", "BatchSendStatus", + "Bls12381PrivateKey", "Bls12381PublicKey", "Bls12381Signature", + "Bls12381VerifyingKey", "Bn254FieldElement", "CancelledTransaction", "ChangeEpoch", @@ -36420,7 +37515,11 @@ async def _uniffi_rust_call_async(rust_future, ffi_poll, ffi_complete, ffi_free, "Upgrade", "UserSignature", "UserSignatureVerifier", + "ValidatorAggregatedSignature", + "ValidatorCommitteeSignatureAggregator", + "ValidatorCommitteeSignatureVerifier", "ValidatorExecutionTimeObservation", + "ValidatorSignature", "VersionAssignment", "ZkLoginAuthenticator", "ZkLoginInputs", diff --git a/crates/iota-sdk-ffi/Cargo.toml b/crates/iota-sdk-ffi/Cargo.toml index 09cf1b3f6..0688c3940 100644 --- a/crates/iota-sdk-ffi/Cargo.toml +++ b/crates/iota-sdk-ffi/Cargo.toml @@ -15,11 +15,12 @@ crate-type = ["lib", "cdylib"] base64ct = { version = "1.6.0", features = ["alloc", "std"] } derive_more = { version = "2.0", features = ["from", "deref"] } rand = "0.8" +roaring = { version = "0.11.2", default-features = false } serde_json = "1.0.95" tokio = { version = "1.36.0", features = ["time"] } uniffi = { version = "0.29", features = ["cli", "tokio"] } -iota-crypto = { path = "../iota-crypto", features = ["ed25519", "secp256r1", "passkey", "secp256k1", "zklogin", "pem"] } +iota-crypto = { path = "../iota-crypto", features = ["bls12381", "ed25519", "secp256r1", "passkey", "secp256k1", "zklogin", "pem"] } iota-graphql-client = { path = "../iota-graphql-client" } iota-transaction-builder = { path = "../iota-transaction-builder" } iota-types = { package = "iota-sdk-types", path = "../iota-sdk-types", features = ["hash", "rand"] } diff --git a/crates/iota-sdk-ffi/src/crypto/bls12381.rs b/crates/iota-sdk-ffi/src/crypto/bls12381.rs new file mode 100644 index 000000000..aa93267d7 --- /dev/null +++ b/crates/iota-sdk-ffi/src/crypto/bls12381.rs @@ -0,0 +1,181 @@ +// Copyright (c) 2025 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +use std::sync::RwLock; + +use iota_types::SignatureScheme; +use rand::rngs::OsRng; + +use crate::{ + error::{Result, SdkFfiError}, + types::{ + checkpoint::CheckpointSummary, + crypto::{ + Bls12381PublicKey, Bls12381Signature, + validator::{ValidatorAggregatedSignature, ValidatorCommittee, ValidatorSignature}, + }, + }, +}; + +#[derive(derive_more::From, uniffi::Object)] +pub struct Bls12381PrivateKey(pub iota_crypto::bls12381::Bls12381PrivateKey); + +#[uniffi::export] +impl Bls12381PrivateKey { + #[uniffi::constructor] + pub fn new(bytes: Vec) -> Result { + Ok(Self(iota_crypto::bls12381::Bls12381PrivateKey::new( + bytes.try_into().map_err(|v: Vec| { + SdkFfiError::custom(format!("expected bytes of length 32, found {}", v.len())) + })?, + )?)) + } + + pub fn scheme(&self) -> SignatureScheme { + self.0.scheme() + } + + pub fn verifying_key(&self) -> Bls12381VerifyingKey { + self.0.verifying_key().into() + } + + pub fn public_key(&self) -> Bls12381PublicKey { + self.0.public_key().into() + } + + #[uniffi::constructor] + pub fn generate() -> Self { + Self(iota_crypto::bls12381::Bls12381PrivateKey::generate(OsRng)) + } + + pub fn sign_checkpoint_summary(&self, summary: &CheckpointSummary) -> ValidatorSignature { + self.0.sign_checkpoint_summary(&summary.0).into() + } + + pub fn try_sign(&self, message: &[u8]) -> Result { + Ok( + iota_crypto::Signer::::try_sign(&self.0, message)? + .into(), + ) + } +} + +#[derive(derive_more::From, uniffi::Object)] +pub struct Bls12381VerifyingKey(pub iota_crypto::bls12381::Bls12381VerifyingKey); + +#[uniffi::export] +impl Bls12381VerifyingKey { + #[uniffi::constructor] + pub fn new(public_key: &Bls12381PublicKey) -> Result { + Ok(iota_crypto::bls12381::Bls12381VerifyingKey::new(&public_key.0).map(Self)?) + } + + pub fn public_key(&self) -> Bls12381PublicKey { + self.0.public_key().into() + } + + pub fn verify(&self, message: &[u8], signature: &Bls12381Signature) -> Result<()> { + Ok( + iota_crypto::Verifier::::verify( + &self.0, + message, + &signature.0, + )?, + ) + } +} + +#[derive(derive_more::From, uniffi::Object)] +pub struct ValidatorCommitteeSignatureVerifier( + pub iota_crypto::bls12381::ValidatorCommitteeSignatureVerifier, +); + +#[uniffi::export] +impl ValidatorCommitteeSignatureVerifier { + #[uniffi::constructor] + pub fn new(committee: ValidatorCommittee) -> Result { + Ok(Self( + iota_crypto::bls12381::ValidatorCommitteeSignatureVerifier::new(committee.into())?, + )) + } + + pub fn committee(&self) -> ValidatorCommittee { + self.0.committee().clone().into() + } + + pub fn verify_checkpoint_summary( + &self, + summary: &CheckpointSummary, + signature: &ValidatorAggregatedSignature, + ) -> Result<()> { + Ok(self.0.verify_checkpoint_summary(&summary.0, &signature.0)?) + } + + pub fn verify(&self, message: &[u8], signature: &ValidatorSignature) -> Result<()> { + Ok( + iota_crypto::Verifier::::verify( + &self.0, + message, + &signature.0, + )?, + ) + } + + pub fn verify_aggregated( + &self, + message: &[u8], + signature: &ValidatorAggregatedSignature, + ) -> Result<()> { + Ok(iota_crypto::Verifier::< + iota_types::ValidatorAggregatedSignature, + >::verify(&self.0, message, &signature.0)?) + } +} + +#[derive(derive_more::From, uniffi::Object)] +pub struct ValidatorCommitteeSignatureAggregator( + pub RwLock, +); + +#[uniffi::export] +impl ValidatorCommitteeSignatureAggregator { + #[uniffi::constructor] + pub fn new_checkpoint_summary( + committee: ValidatorCommittee, + summary: &CheckpointSummary, + ) -> Result { + Ok(Self( + iota_crypto::bls12381::ValidatorCommitteeSignatureAggregator::new_checkpoint_summary( + committee.into(), + &summary.0, + )? + .into(), + )) + } + + pub fn committee(&self) -> ValidatorCommittee { + self.0 + .read() + .expect("failed to read validator committee signature aggregator") + .committee() + .clone() + .into() + } + + pub fn add_signature(&self, signature: &ValidatorSignature) -> Result<()> { + Ok(self + .0 + .write() + .expect("failed to read validator committee signature aggregator") + .add_signature(signature.0.clone())?) + } + + pub fn finish(&self) -> Result { + Ok(self + .0 + .read() + .expect("failed to read validator committee signature aggregator") + .finish()? + .into()) + } +} diff --git a/crates/iota-sdk-ffi/src/crypto/mod.rs b/crates/iota-sdk-ffi/src/crypto/mod.rs index 9296b56f5..1a01e8723 100644 --- a/crates/iota-sdk-ffi/src/crypto/mod.rs +++ b/crates/iota-sdk-ffi/src/crypto/mod.rs @@ -1,6 +1,7 @@ // Copyright (c) 2025 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 +pub mod bls12381; pub mod ed25519; pub mod multisig; pub mod passkey; diff --git a/crates/iota-sdk-ffi/src/types/crypto/validator.rs b/crates/iota-sdk-ffi/src/types/crypto/validator.rs index 83871d64f..14909c487 100644 --- a/crates/iota-sdk-ffi/src/types/crypto/validator.rs +++ b/crates/iota-sdk-ffi/src/types/crypto/validator.rs @@ -3,7 +3,48 @@ use std::sync::Arc; -use crate::types::crypto::Bls12381PublicKey; +use crate::{ + error::Result, + types::{ + checkpoint::EpochId, + crypto::{Bls12381PublicKey, Bls12381Signature}, + signature, + }, +}; + +/// The Validator Set for a particular epoch. +/// +/// # BCS +/// +/// The BCS serialized form for this type is defined by the following ABNF: +/// +/// ```text +/// validator-committee = u64 ; epoch +/// (vector validator-committee-member) +/// ``` +#[derive(uniffi::Record)] +pub struct ValidatorCommittee { + pub epoch: EpochId, + pub members: Vec, +} + +impl From for ValidatorCommittee { + fn from(value: iota_types::ValidatorCommittee) -> Self { + Self { + epoch: value.epoch, + members: value.members.into_iter().map(Into::into).collect(), + } + } +} + +impl From for iota_types::ValidatorCommittee { + fn from(value: ValidatorCommittee) -> Self { + Self { + epoch: value.epoch, + members: value.members.into_iter().map(Into::into).collect(), + } + } +} /// A member of a Validator Committee /// @@ -15,7 +56,7 @@ use crate::types::crypto::Bls12381PublicKey; /// validator-committee-member = bls-public-key /// u64 ; stake /// ``` -#[derive(uniffi::Record)] +#[derive(Clone, uniffi::Record)] pub struct ValidatorCommitteeMember { pub public_key: Arc, pub stake: u64, @@ -38,3 +79,91 @@ impl From for iota_types::ValidatorCommitteeMember { } } } + +/// A signature from a Validator +/// +/// # BCS +/// +/// The BCS serialized form for this type is defined by the following ABNF: +/// +/// ```text +/// validator-signature = u64 ; epoch +/// bls-public-key +/// bls-signature +/// ``` +#[derive(derive_more::From, uniffi::Object)] +pub struct ValidatorSignature(pub iota_types::ValidatorSignature); + +#[uniffi::export] +impl ValidatorSignature { + #[uniffi::constructor] + pub fn new( + epoch: EpochId, + public_key: &Bls12381PublicKey, + signature: &Bls12381Signature, + ) -> Self { + Self(iota_types::ValidatorSignature { + epoch, + public_key: **public_key, + signature: **signature, + }) + } + + pub fn epoch(&self) -> EpochId { + self.0.epoch + } + + pub fn public_key(&self) -> Bls12381PublicKey { + self.0.public_key.into() + } + + pub fn signature(&self) -> Bls12381Signature { + self.0.signature.into() + } +} + +/// An aggregated signature from multiple Validators. +/// +/// # BCS +/// +/// The BCS serialized form for this type is defined by the following ABNF: +/// +/// ```text +/// validator-aggregated-signature = u64 ; epoch +/// bls-signature +/// roaring-bitmap +/// roaring-bitmap = bytes ; where the contents of the bytes are valid +/// ; according to the serialized spec for +/// ; roaring bitmaps +/// ``` +/// +/// See [here](https://github.com/RoaringBitmap/RoaringFormatSpec) for the specification for the +/// serialized format of RoaringBitmaps. +#[derive(derive_more::From, uniffi::Object)] +pub struct ValidatorAggregatedSignature(pub iota_types::ValidatorAggregatedSignature); + +#[uniffi::export] +impl ValidatorAggregatedSignature { + #[uniffi::constructor] + pub fn new(epoch: EpochId, signature: &Bls12381Signature, bitmap_bytes: &[u8]) -> Result { + Ok(Self(iota_types::ValidatorAggregatedSignature { + epoch, + signature: **signature, + bitmap: roaring::RoaringBitmap::deserialize_from(bitmap_bytes)?, + })) + } + + pub fn epoch(&self) -> EpochId { + self.0.epoch + } + + pub fn signature(&self) -> Bls12381Signature { + self.0.signature.into() + } + + pub fn bitmap_bytes(&self) -> Result> { + let mut bytes = Vec::new(); + self.0.bitmap.serialize_into(&mut bytes)?; + Ok(bytes) + } +}