diff --git a/CHANGELOG.md b/CHANGELOG.md index 2abf462ff..1f6a63888 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,24 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Added function `SKY_wallet_MetaWallet_Version` - Added function `SKY_wallet_MetaWallet_Type` - Added datatype `WalletSeedResponse__Handle` +- Added datatype `Distribution__Handle` +- Added datatype `SKY_params_Distribution_GetMaxCoinSupply` +- Added datatype `SKY_params_Distribution_SetMaxCoinSupply` +- Added datatype `SKY_params_Distribution_GetInitialUnlockedCount` +- Added datatype `SKY_params_Distribution_SetInitialUnlockedCount` +- Added datatype `SKY_params_Distribution_GetUnlockAddressRate` +- Added datatype `SKY_params_Distribution_SetUnlockAddressRate` +- Added datatype `SKY_params_Distribution_GetUnlockTimeInterval` +- Added datatype `SKY_params_Distribution_SetUnlockTimeInterval` +- Added datatype `SKY_params_Distribution_GetAddresses` +- Added datatype `SKY_params_Distribution_SetAddresses` +- Added datatype `SKY_params_Distribution_Validate` +- Added datatype `SKY_params_Distribution_AddressInitialBalance` +- Added datatype `SKY_params_Distribution_UnlockedAddresses` +- Added datatype `SKY_params_Distribution_LockedAddresses` +- Added datatype `SKY_params_Distribution_AddressesDecoded` +- Added datatype `SKY_params_Distribution_UnlockedAddressesDecoded` +- Added datatype `SKY_params_Distribution_LockedAddressesDecoded` ### Removed diff --git a/include/skytypes.h b/include/skytypes.h index d29f663cf..7fb95cfb6 100644 --- a/include/skytypes.h +++ b/include/skytypes.h @@ -212,6 +212,11 @@ typedef Handle MetaWallet__Handle; */ typedef Handle WalletSeedResponse__Handle; +/** + * Distribution__Handle Handle, struct param.distribution + */ +typedef Handle Distribution__Handle; + /** * Instances of Go interface types. */ diff --git a/lib/cgo/libsky_handle.go b/lib/cgo/libsky_handle.go index 8077d9d13..e0e9388a6 100644 --- a/lib/cgo/libsky_handle.go +++ b/lib/cgo/libsky_handle.go @@ -20,6 +20,7 @@ import ( "github.com/skycoin/skycoin/src/coin" "github.com/skycoin/skycoin/src/readable" "github.com/skycoin/skycoin/src/wallet" + "github.com/skycoin/skycoin/src/params" ) type Handle uint64 @@ -532,3 +533,17 @@ func lookupWalletSeedResponseHandle(handle C.WalletSeedResponse__Handle) (*api.W } return nil, false } + +func registerDistributionHandle(obj *params.Distribution) C.Distribution__Handle { + return (C.WalletResponse__Handle)(registerHandle(obj)) +} + +func lookupDistributionHandle(handle C.Distribution__Handle) (*params.Distribution, bool) { + obj, ok := lookupHandle(C.Handle(handle)) + if ok { + if obj, isOK := (obj).(*params.Distribution); isOK { + return obj, true + } + } + return nil, false +} diff --git a/lib/cgo/params.distribution.go b/lib/cgo/params.distribution.go index ff3967e25..298d4c10a 100644 --- a/lib/cgo/params.distribution.go +++ b/lib/cgo/params.distribution.go @@ -1,5 +1,10 @@ package main +import ( + "reflect" + "unsafe" +) + /* #include @@ -8,3 +13,203 @@ package main #include "skytypes.h" */ import "C" + +//export SKY_params_Distribution_GetMaxCoinSupply +func SKY_params_Distribution_GetMaxCoinSupply(_d C.Distribution__Handle, _arg0 *uint64) (____error_code uint32) { + d, ok := lookupDistributionHandle(_d) + if !ok { + ____error_code = SKY_BAD_HANDLE + return + } + *_arg0 = d.MaxCoinSupply + return +} + +//export SKY_params_Distribution_SetMaxCoinSupply +func SKY_params_Distribution_SetMaxCoinSupply(_d C.Distribution__Handle, _arg0 uint64) (____error_code uint32) { + d, ok := lookupDistributionHandle(_d) + if !ok { + ____error_code = SKY_BAD_HANDLE + return + } + d.MaxCoinSupply = _arg0 + _d = registerDistributionHandle(d) + return +} + +//export SKY_params_Distribution_GetInitialUnlockedCount +func SKY_params_Distribution_GetInitialUnlockedCount(_d C.Distribution__Handle, _arg0 *uint64) (____error_code uint32) { + d, ok := lookupDistributionHandle(_d) + if !ok { + ____error_code = SKY_BAD_HANDLE + return + } + *_arg0 = d.InitialUnlockedCount + return +} + +//export SKY_params_Distribution_SetInitialUnlockedCount +func SKY_params_Distribution_SetInitialUnlockedCount(_d C.Distribution__Handle, _arg0 uint64) (____error_code uint32) { + d, ok := lookupDistributionHandle(_d) + if !ok { + ____error_code = SKY_BAD_HANDLE + return + } + d.InitialUnlockedCount = _arg0 + _d = registerDistributionHandle(d) + return +} + +//export SKY_params_Distribution_GetUnlockAddressRate +func SKY_params_Distribution_GetUnlockAddressRate(_d C.Distribution__Handle, _arg0 *uint64) (____error_code uint32) { + d, ok := lookupDistributionHandle(_d) + if !ok { + ____error_code = SKY_BAD_HANDLE + return + } + *_arg0 = d.UnlockAddressRate + return +} + +//export SKY_params_Distribution_SetUnlockAddressRate +func SKY_params_Distribution_SetUnlockAddressRate(_d C.Distribution__Handle, _arg0 uint64) (____error_code uint32) { + d, ok := lookupDistributionHandle(_d) + if !ok { + ____error_code = SKY_BAD_HANDLE + return + } + d.UnlockAddressRate = _arg0 + _d = registerDistributionHandle(d) + return +} + +//export SKY_params_Distribution_GetUnlockTimeInterval +func SKY_params_Distribution_GetUnlockTimeInterval(_d C.Distribution__Handle, _arg0 *uint64) (____error_code uint32) { + d, ok := lookupDistributionHandle(_d) + if !ok { + ____error_code = SKY_BAD_HANDLE + return + } + *_arg0 = d.UnlockTimeInterval + return +} + +//export SKY_params_Distribution_SetUnlockTimeInterval +func SKY_params_Distribution_SetUnlockTimeInterval(_d C.Distribution__Handle, _arg0 uint64) (____error_code uint32) { + d, ok := lookupDistributionHandle(_d) + if !ok { + ____error_code = SKY_BAD_HANDLE + return + } + d.UnlockTimeInterval = _arg0 + _d = registerDistributionHandle(d) + return +} + +//export SKY_params_Distribution_GetAddresses +func SKY_params_Distribution_GetAddresses(_d C.Distribution__Handle, _arg0 *C.GoSlice_) (____error_code uint32) { + d, ok := lookupDistributionHandle(_d) + if !ok { + ____error_code = SKY_BAD_HANDLE + return + } + copyToGoSlice(reflect.ValueOf(d.Addresses), _arg0) + return +} + +//export SKY_params_Distribution_SetAddresses +func SKY_params_Distribution_SetAddresses(_d C.Distribution__Handle, _arg0 *C.GoSlice_) (____error_code uint32) { + d, ok := lookupDistributionHandle(_d) + if !ok { + ____error_code = SKY_BAD_HANDLE + return + } + d.Addresses = *(*[]string)(unsafe.Pointer(_arg0)) + _d = registerDistributionHandle(d) + return +} + +//export SKY_params_Distribution_Validate +func SKY_params_Distribution_Validate(_d C.Distribution__Handle) (____error_code uint32) { + + d, ok := lookupDistributionHandle(_d) + if !ok { + ____error_code = SKY_BAD_HANDLE + return + } + __return_err := d.Validate() + ____error_code = libErrorCode(__return_err) + return + +} + +//export SKY_params_Distribution_AddressInitialBalance +func SKY_params_Distribution_AddressInitialBalance(_d C.Distribution__Handle, _arg0 *uint64) (____error_code uint32) { + d, ok := lookupDistributionHandle(_d) + if !ok { + ____error_code = SKY_BAD_HANDLE + return + } + *_arg0 = d.AddressInitialBalance() + return +} + +//export SKY_params_Distribution_UnlockedAddresses +func SKY_params_Distribution_UnlockedAddresses(_d C.Distribution__Handle, _arg0 *C.GoSlice_) (____error_code uint32) { + d, ok := lookupDistributionHandle(_d) + if !ok { + ____error_code = SKY_BAD_HANDLE + return + } + arg0 := d.UnlockedAddresses() + copyToGoSlice(reflect.ValueOf(arg0), _arg0) + return +} + +//export SKY_params_Distribution_LockedAddresses +func SKY_params_Distribution_LockedAddresses(_d C.Distribution__Handle, _arg0 *C.GoSlice_) (____error_code uint32) { + d, ok := lookupDistributionHandle(_d) + if !ok { + ____error_code = SKY_BAD_HANDLE + return + } + arg0 := d.LockedAddresses() + copyToGoSlice(reflect.ValueOf(arg0), _arg0) + return +} + +//export SKY_params_Distribution_AddressesDecoded +func SKY_params_Distribution_AddressesDecoded(_d C.Distribution__Handle, _arg0 *C.GoSlice_) (____error_code uint32) { + d, ok := lookupDistributionHandle(_d) + if !ok { + ____error_code = SKY_BAD_HANDLE + return + } + arg0 := d.AddressesDecoded() + copyToGoSlice(reflect.ValueOf(arg0), _arg0) + return +} + +//export SKY_params_Distribution_UnlockedAddressesDecoded +func SKY_params_Distribution_UnlockedAddressesDecoded(_d C.Distribution__Handle, _arg0 *C.GoSlice_) (____error_code uint32) { + d, ok := lookupDistributionHandle(_d) + if !ok { + ____error_code = SKY_BAD_HANDLE + return + } + arg0 := d.UnlockedAddressesDecoded() + copyToGoSlice(reflect.ValueOf(arg0), _arg0) + return +} + +//export SKY_params_Distribution_LockedAddressesDecoded +func SKY_params_Distribution_LockedAddressesDecoded(_d C.Distribution__Handle, _arg0 *C.GoSlice_) (____error_code uint32) { + d, ok := lookupDistributionHandle(_d) + if !ok { + ____error_code = SKY_BAD_HANDLE + return + } + arg0 := d.LockedAddressesDecoded() + copyToGoSlice(reflect.ValueOf(arg0), _arg0) + return +}