From 1f610b700fdffe898d75e41a7d198b99c45a1a07 Mon Sep 17 00:00:00 2001 From: Jenea Vranceanu Date: Thu, 8 Dec 2022 18:40:05 +0200 Subject: [PATCH] fix: deprecated SecurityToken investors function actually expects a uint256 - an index argument --- .../web3swift/Tokens/ST20/Web3+SecurityToken.swift | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Sources/web3swift/Tokens/ST20/Web3+SecurityToken.swift b/Sources/web3swift/Tokens/ST20/Web3+SecurityToken.swift index e1ceffcd2..70d7fb598 100644 --- a/Sources/web3swift/Tokens/ST20/Web3+SecurityToken.swift +++ b/Sources/web3swift/Tokens/ST20/Web3+SecurityToken.swift @@ -28,8 +28,8 @@ protocol ISecurityToken: IST20, IOwnable { /// Total number of non-zero token holders func investorCount() async throws -> BigUInt - /// List of token holders - func investors() async throws -> [EthereumAddress] + /// List of token holders at specified index + func investors(index: UInt) async throws -> [EthereumAddress] /// Permissions this to a Permission module, which has a key of 1 /// If no Permission return false - note that IModule withPerm will allow ST owner all permissions anyway @@ -326,10 +326,9 @@ public class SecurityToken: ISecurityToken, ERC20BaseProperties { return res } - public func investors() async throws -> [EthereumAddress] { - let contract = self.contract - self.transaction.callOnBlock = .latest - let result = try await contract.createReadOperation("investors", parameters: [AnyObject](), extraData: Data() )!.callContractMethod() + public func investors(index: UInt) async throws -> [EthereumAddress] { + transaction.callOnBlock = .latest + let result = try await contract.createReadOperation("investors", parameters: [index] as [AnyObject])!.callContractMethod() guard let res = result["0"] as? [EthereumAddress] else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")} return res }