Skip to content

Commit 90eef65

Browse files
committed
start adding native classes for ERC20, ERC721 and private key controlled wallet
1 parent 72ae905 commit 90eef65

File tree

8 files changed

+252
-11
lines changed

8 files changed

+252
-11
lines changed

web3swift.xcodeproj/project.pbxproj

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@
7878
815630002007B48800A0EC2F /* BIP32KeystoreJSONStructure.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81562FFF2007B48800A0EC2F /* BIP32KeystoreJSONStructure.swift */; };
7979
815630022007B53C00A0EC2F /* BIP32Keystore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 815630012007B53C00A0EC2F /* BIP32Keystore.swift */; };
8080
815630042007BC8F00A0EC2F /* BIP39+WordLists.swift in Sources */ = {isa = PBXBuildFile; fileRef = 815630032007BC8F00A0EC2F /* BIP39+WordLists.swift */; };
81+
8159C50B21352CB700197B91 /* Web3+ERC20.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8159C50A21352CB700197B91 /* Web3+ERC20.swift */; };
82+
8159C50C21352CB700197B91 /* Web3+ERC20.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8159C50A21352CB700197B91 /* Web3+ERC20.swift */; };
83+
8159C50E2135901700197B91 /* web3swift_ERC20_Class_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8159C50D2135901700197B91 /* web3swift_ERC20_Class_Tests.swift */; };
84+
8159C5102135929700197B91 /* key.json in Resources */ = {isa = PBXBuildFile; fileRef = 8159C50F2135929700197B91 /* key.json */; };
85+
8159C5112135929700197B91 /* key.json in Resources */ = {isa = PBXBuildFile; fileRef = 8159C50F2135929700197B91 /* key.json */; };
8186
815C74C820ECBF3E00DE2AC4 /* web3swift_User_cases.swift in Sources */ = {isa = PBXBuildFile; fileRef = 815C74C720ECBF3E00DE2AC4 /* web3swift_User_cases.swift */; };
8287
8160E5CE20B8245A0070070B /* IBAN.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8160E5CD20B8245A0070070B /* IBAN.swift */; };
8388
8160E5CF20B8245A0070070B /* IBAN.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8160E5CD20B8245A0070070B /* IBAN.swift */; };
@@ -168,7 +173,6 @@
168173
81DDECCF1FDF004E0063684A /* Web3.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81DDECCE1FDF004E0063684A /* Web3.swift */; };
169174
81DFB3FF210775320011DC85 /* Web3+Infura.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81DFB3FE210775320011DC85 /* Web3+Infura.swift */; };
170175
81DFB400210775320011DC85 /* Web3+Infura.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81DFB3FE210775320011DC85 /* Web3+Infura.swift */; };
171-
81DFCC4C20F7546300603123 /* key.json in Resources */ = {isa = PBXBuildFile; fileRef = 81DFCC4B20F7546300603123 /* key.json */; };
172176
81EB1E4B208173D7003BD47F /* Web3+Personal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81EB1E4A208173D7003BD47F /* Web3+Personal.swift */; };
173177
81EB1E4C208173D7003BD47F /* Web3+Personal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81EB1E4A208173D7003BD47F /* Web3+Personal.swift */; };
174178
81FA43F62044097100EE14D5 /* web3swift_macOS_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FA43F52044097100EE14D5 /* web3swift_macOS_Tests.swift */; };
@@ -177,8 +181,6 @@
177181
81FB21FF207BB297007F9A83 /* EIP67Code.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FB21F8207BA78B007F9A83 /* EIP67Code.swift */; };
178182
81FB2201207BC58C007F9A83 /* CoreImage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 81FB2200207BC58B007F9A83 /* CoreImage.framework */; };
179183
81FB2203207BC6DB007F9A83 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 81FB2202207BC6DB007F9A83 /* ImageIO.framework */; };
180-
81FB2207207BCFF9007F9A83 /* bankex-foundation-logo-coin.png in Resources */ = {isa = PBXBuildFile; fileRef = 81FB2206207BCFF9007F9A83 /* bankex-foundation-logo-coin.png */; };
181-
81FB2208207BCFF9007F9A83 /* bankex-foundation-logo-coin.png in Resources */ = {isa = PBXBuildFile; fileRef = 81FB2206207BCFF9007F9A83 /* bankex-foundation-logo-coin.png */; };
182184
81FECD45211ADE51006DA367 /* Web3+ObjC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD44211ADE51006DA367 /* Web3+ObjC.swift */; };
183185
81FECD46211ADE51006DA367 /* Web3+ObjC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD44211ADE51006DA367 /* Web3+ObjC.swift */; };
184186
81FECD49211ADEB1006DA367 /* Web3+Instance+ObjC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD48211ADEB1006DA367 /* Web3+Instance+ObjC.swift */; };
@@ -276,6 +278,9 @@
276278
815630012007B53C00A0EC2F /* BIP32Keystore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BIP32Keystore.swift; sourceTree = "<group>"; };
277279
815630032007BC8F00A0EC2F /* BIP39+WordLists.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BIP39+WordLists.swift"; sourceTree = "<group>"; };
278280
815630052008A64C00A0EC2F /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
281+
8159C50A21352CB700197B91 /* Web3+ERC20.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Web3+ERC20.swift"; sourceTree = "<group>"; };
282+
8159C50D2135901700197B91 /* web3swift_ERC20_Class_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = web3swift_ERC20_Class_Tests.swift; sourceTree = "<group>"; };
283+
8159C50F2135929700197B91 /* key.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = key.json; sourceTree = "<group>"; };
279284
815C74C720ECBF3E00DE2AC4 /* web3swift_User_cases.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = web3swift_User_cases.swift; sourceTree = "<group>"; };
280285
8160E5CD20B8245A0070070B /* IBAN.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IBAN.swift; sourceTree = "<group>"; };
281286
817EBB0F2004FE2800E02EAA /* EthereumAddress.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EthereumAddress.swift; sourceTree = "<group>"; };
@@ -331,15 +336,13 @@
331336
81D7D97720A61E3800A193EC /* EventFiltering.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventFiltering.swift; sourceTree = "<group>"; };
332337
81DDECCE1FDF004E0063684A /* Web3.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Web3.swift; sourceTree = "<group>"; };
333338
81DFB3FE210775320011DC85 /* Web3+Infura.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Web3+Infura.swift"; sourceTree = "<group>"; };
334-
81DFCC4B20F7546300603123 /* key.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = key.json; path = ../../../../Desktop/key.json; sourceTree = "<group>"; };
335339
81EB1E4A208173D7003BD47F /* Web3+Personal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Web3+Personal.swift"; sourceTree = "<group>"; };
336340
81FA43F32044097000EE14D5 /* web3swift-macOS_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "web3swift-macOS_Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
337341
81FA43F52044097100EE14D5 /* web3swift_macOS_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = web3swift_macOS_Tests.swift; sourceTree = "<group>"; };
338342
81FA43F72044097100EE14D5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
339343
81FB21F8207BA78B007F9A83 /* EIP67Code.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EIP67Code.swift; sourceTree = "<group>"; };
340344
81FB2200207BC58B007F9A83 /* CoreImage.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreImage.framework; path = System/Library/Frameworks/CoreImage.framework; sourceTree = SDKROOT; };
341345
81FB2202207BC6DB007F9A83 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; };
342-
81FB2206207BCFF9007F9A83 /* bankex-foundation-logo-coin.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "bankex-foundation-logo-coin.png"; sourceTree = "<group>"; };
343346
81FECD44211ADE51006DA367 /* Web3+ObjC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Web3+ObjC.swift"; sourceTree = "<group>"; };
344347
81FECD48211ADEB1006DA367 /* Web3+Instance+ObjC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Web3+Instance+ObjC.swift"; sourceTree = "<group>"; };
345348
81FECD4B211ADF70006DA367 /* Web3+HttpProvider+ObjC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Web3+HttpProvider+ObjC.swift"; sourceTree = "<group>"; };
@@ -451,6 +454,7 @@
451454
1CD91AFE1FD76910007BFB45 /* web3swift */ = {
452455
isa = PBXGroup;
453456
children = (
457+
8159C50921343EF900197B91 /* PrecompiledContracts */,
454458
81FECD43211ADE20006DA367 /* ObjectiveCbridge */,
455459
0073F22320D949D7000791F1 /* BlockExplorer */,
456460
81A1821220D5A2430016741F /* Promises */,
@@ -473,9 +477,10 @@
473477
1CD91B301FD769A6007BFB45 /* web3swiftTests */ = {
474478
isa = PBXGroup;
475479
children = (
480+
8159C50F2135929700197B91 /* key.json */,
481+
8159C50D2135901700197B91 /* web3swift_ERC20_Class_Tests.swift */,
476482
8102F5C2211E00820032DF60 /* scrypt_Tests.swift */,
477483
81FECD5D211AEFCE006DA367 /* web3swift_ObjC_Tests.swift */,
478-
81DFCC4B20F7546300603123 /* key.json */,
479484
815C74C720ECBF3E00DE2AC4 /* web3swift_User_cases.swift */,
480485
00E5FE8120EA3FF40030E0D6 /* web3swift_infura_Tests.swift */,
481486
00E5FE7F20EA3CEA0030E0D6 /* web3swift_RLP_Tests.swift */,
@@ -586,6 +591,38 @@
586591
path = Classes;
587592
sourceTree = "<group>";
588593
};
594+
8159C50621343ED300197B91 /* ERC20 */ = {
595+
isa = PBXGroup;
596+
children = (
597+
8159C50A21352CB700197B91 /* Web3+ERC20.swift */,
598+
);
599+
path = ERC20;
600+
sourceTree = "<group>";
601+
};
602+
8159C50721343EDD00197B91 /* ERC721 */ = {
603+
isa = PBXGroup;
604+
children = (
605+
);
606+
path = ERC721;
607+
sourceTree = "<group>";
608+
};
609+
8159C50821343EED00197B91 /* PrivateKeyControlledAccount */ = {
610+
isa = PBXGroup;
611+
children = (
612+
);
613+
path = PrivateKeyControlledAccount;
614+
sourceTree = "<group>";
615+
};
616+
8159C50921343EF900197B91 /* PrecompiledContracts */ = {
617+
isa = PBXGroup;
618+
children = (
619+
8159C50821343EED00197B91 /* PrivateKeyControlledAccount */,
620+
8159C50721343EDD00197B91 /* ERC721 */,
621+
8159C50621343ED300197B91 /* ERC20 */,
622+
);
623+
path = PrecompiledContracts;
624+
sourceTree = "<group>";
625+
};
589626
818EABD71FDC9A3800E013FC /* Contract */ = {
590627
isa = PBXGroup;
591628
children = (
@@ -754,7 +791,6 @@
754791
81FB2205207BCFE4007F9A83 /* Classes */ = {
755792
isa = PBXGroup;
756793
children = (
757-
81FB2206207BCFF9007F9A83 /* bankex-foundation-logo-coin.png */,
758794
);
759795
path = Classes;
760796
sourceTree = "<group>";
@@ -949,23 +985,22 @@
949985
isa = PBXResourcesBuildPhase;
950986
buildActionMask = 2147483647;
951987
files = (
952-
81FB2207207BCFF9007F9A83 /* bankex-foundation-logo-coin.png in Resources */,
988+
8159C5102135929700197B91 /* key.json in Resources */,
953989
);
954990
runOnlyForDeploymentPostprocessing = 0;
955991
};
956992
1CD91B2D1FD769A6007BFB45 /* Resources */ = {
957993
isa = PBXResourcesBuildPhase;
958994
buildActionMask = 2147483647;
959995
files = (
960-
81DFCC4C20F7546300603123 /* key.json in Resources */,
961996
);
962997
runOnlyForDeploymentPostprocessing = 0;
963998
};
964999
417715D220362916005C3E16 /* Resources */ = {
9651000
isa = PBXResourcesBuildPhase;
9661001
buildActionMask = 2147483647;
9671002
files = (
968-
81FB2208207BCFF9007F9A83 /* bankex-foundation-logo-coin.png in Resources */,
1003+
8159C5112135929700197B91 /* key.json in Resources */,
9691004
);
9701005
runOnlyForDeploymentPostprocessing = 0;
9711006
};
@@ -1120,6 +1155,7 @@
11201155
81A1823420D6E1FD0016741F /* Promise+Web3+Eth+GetBlockByNumber.swift in Sources */,
11211156
81A1822820D678BF0016741F /* Promise+Web3+Eth+GetAccounts.swift in Sources */,
11221157
81C5DA312074EC1E00424CD6 /* ContractProtocol.swift in Sources */,
1158+
8159C50B21352CB700197B91 /* Web3+ERC20.swift in Sources */,
11231159
81C5DA222072DFE600424CD6 /* ABIv2TypeParser.swift in Sources */,
11241160
815630002007B48800A0EC2F /* BIP32KeystoreJSONStructure.swift in Sources */,
11251161
8123E1CB200CBB2200B6D3AB /* Array+Extension.swift in Sources */,
@@ -1151,6 +1187,7 @@
11511187
buildActionMask = 2147483647;
11521188
files = (
11531189
815C74C820ECBF3E00DE2AC4 /* web3swift_User_cases.swift in Sources */,
1190+
8159C50E2135901700197B91 /* web3swift_ERC20_Class_Tests.swift in Sources */,
11541191
E23B5AE520EA6A0A00DC7F32 /* web3swift_contractV2_Tests.swift in Sources */,
11551192
E23B5AE120EA695400DC7F32 /* web3swift_rinkeby_personalSignature_Tests.swift in Sources */,
11561193
E23B5ADB20EA67D800DC7F32 /* web3swift_AdvancedABIv2_Tests.swift in Sources */,
@@ -1175,6 +1212,7 @@
11751212
isa = PBXSourcesBuildPhase;
11761213
buildActionMask = 2147483647;
11771214
files = (
1215+
8159C50C21352CB700197B91 /* Web3+ERC20.swift in Sources */,
11781216
4194811B203630530065A83B /* Web3+HttpProvider.swift in Sources */,
11791217
4194811E203630530065A83B /* Web3.swift in Sources */,
11801218
4194811F203630530065A83B /* Web3+Instance.swift in Sources */,

web3swift/BlockExplorer/Classes/BlockExplorer+GetTransactionHistory.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Foundation
1010
import PromiseKit
1111
import BigInt
1212

13+
@available(*, deprecated)
1314
extension BlockExplorer {
1415
public func getTransactionHistory(address: EthereumAddress, tokenName name: String = "Ether", page: Int = 1, size: Int = 50) -> Promise<[TransactionHistoryRecord]> {
1516
let address = address.address

web3swift/BlockExplorer/Classes/BlockExplorer.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import Foundation
1010

11+
@available(*, deprecated)
1112
public class BlockExplorer {
1213
public var urlStringList: String
1314

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
//
2+
// Web3+ERC721.swift
3+
// web3swift
4+
//
5+
// Created by Alex Vlasov on 28.08.2018.
6+
// Copyright © 2018 Alex Vlasov. All rights reserved.
7+
//
8+
9+
import Foundation
10+
import BigInt
11+
import Result
12+
13+
// This namespace contains functions to work with ERC20 tokens.
14+
// variables are lazyly evaluated or global token information (name, ticker, total supply)
15+
// can be imperatively read and saved
16+
class ERC20 {
17+
private var _name: String? = nil
18+
private var _symbol: String? = nil
19+
private var _decimals: UInt8? = nil
20+
private var _hasReadProperties: Bool = false
21+
22+
public var options: Web3Options
23+
public var web3: web3
24+
public var provider: Web3Provider
25+
public var address: EthereumAddress
26+
27+
lazy var contract: web3.web3contract = {
28+
let contract = self.web3.contract(Web3.Utils.erc20ABI, at: self.address, abiVersion: 2)
29+
precondition(contract != nil)
30+
return contract!
31+
}()
32+
33+
public init(web3: web3, provider: Web3Provider, address: EthereumAddress) {
34+
self.web3 = web3
35+
self.provider = provider
36+
self.address = address
37+
var mergedOptions = web3.options
38+
mergedOptions.to = address
39+
self.options = mergedOptions
40+
}
41+
42+
public var name: String {
43+
self.readProperties()
44+
if self._name != nil {
45+
return self._name!
46+
}
47+
return ""
48+
}
49+
50+
public var symbol: String {
51+
self.readProperties()
52+
if self._symbol != nil {
53+
return self._symbol!
54+
}
55+
return ""
56+
}
57+
58+
public var decimals: UInt8 {
59+
self.readProperties()
60+
if self._decimals != nil {
61+
return self._decimals!
62+
}
63+
return 255
64+
}
65+
66+
public func readProperties() {
67+
if self._hasReadProperties {
68+
return
69+
}
70+
defer { self._hasReadProperties = true }
71+
let contract = self.contract
72+
guard contract.contract.address != nil else {return}
73+
guard let nameResult = contract.method("name", parameters: [] as [AnyObject], extraData: Data(), options: self.options)?.call(options: nil, onBlock: "latest") else {return}
74+
switch nameResult {
75+
case .success(let returned):
76+
guard let res = returned["0"] as? String else {break}
77+
self._name = res
78+
default:
79+
self._name = ""
80+
}
81+
82+
guard let symbol = contract.method("symbol", parameters: [] as [AnyObject], extraData: Data(), options: self.options)?.call(options: nil, onBlock: "latest") else {return}
83+
switch symbol {
84+
case .success(let returned):
85+
guard let res = returned["0"] as? String else {break}
86+
self._symbol = res
87+
default:
88+
self._symbol = ""
89+
}
90+
91+
guard let decimalsResult = contract.method("decimals", parameters: [] as [AnyObject], extraData: Data(), options: self.options)?.call(options: nil, onBlock: "latest") else {return}
92+
switch decimalsResult {
93+
case .success(let returned):
94+
guard let res = returned["0"] as? BigUInt else {return}
95+
self._decimals = UInt8(res)
96+
default:
97+
self._decimals = 255
98+
}
99+
}
100+
101+
func getBalance(account: EthereumAddress) -> Result<BigUInt, Web3Error> {
102+
let contract = self.contract
103+
let result = contract.method("balanceOf", parameters: [account] as [AnyObject], extraData: Data(), options: self.options)!.call(options: nil, onBlock: "latest")
104+
switch result {
105+
case .success(let returned):
106+
guard let res = returned["0"] as? BigUInt else {return Result.failure(Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node"))}
107+
return Result(res)
108+
case .failure(let error):
109+
return Result.failure(error)
110+
}
111+
}
112+
113+
func getAllowance(originalOwner: EthereumAddress, delegate: EthereumAddress) -> Result<BigUInt, Web3Error> {
114+
let contract = self.contract
115+
let result = contract.method("allowance", parameters: [originalOwner, delegate] as [AnyObject], extraData: Data(), options: self.options)!.call(options: nil, onBlock: "latest")
116+
switch result {
117+
case .success(let returned):
118+
guard let res = returned["0"] as? BigUInt else {return Result.failure(Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node"))}
119+
return Result(res)
120+
case .failure(let error):
121+
return Result.failure(error)
122+
}
123+
}
124+
125+
// func transfer(from: EthereumAddress, to: EthereumAddress, amount: String) -> TransactionIntermediate? {
126+
//
127+
// }
128+
//
129+
// func transferFrom(from: EthereumAddress, to: EthereumAddress, originalOwner: EthereumAddress, amount: String) -> TransactionIntermediate? {
130+
//
131+
// }
132+
//
133+
// func setAllowance(originalOwner: EthereumAddress, delegate: EthereumAddress, newAmount: String) -> TransactionIntermediate? {
134+
//
135+
// }
136+
137+
138+
}
Binary file not shown.

web3swift/Web3/Classes/Web3+Instance.swift

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import Foundation
1010
import BigInt
1111
import PromiseKit
1212

13-
1413
/// A web3 instance bound to provider. All further functionality is provided under web.*. namespaces.
1514
public class web3: Web3OptionsInheritable {
1615
public var provider : Web3Provider
@@ -132,4 +131,27 @@ public class web3: Web3OptionsInheritable {
132131
}
133132
}
134133

134+
var erc721Instance: web3.ERC721?
135+
136+
/// Public web3.browserFunctions.* namespace.
137+
public var erc721: web3.ERC721 {
138+
if (self.erc721Instance != nil) {
139+
return self.erc721Instance!
140+
}
141+
self.erc721Instance = web3.ERC721(provider : self.provider, web3: self)
142+
return self.erc721Instance!
143+
}
144+
145+
public class ERC721: Web3OptionsInheritable {
146+
var provider:Web3Provider
147+
// weak var web3: web3?
148+
var web3: web3
149+
public var options: Web3Options {
150+
return self.web3.options
151+
}
152+
public init(provider prov: Web3Provider, web3 web3instance: web3) {
153+
provider = prov
154+
web3 = web3instance
155+
}
156+
}
135157
}

0 commit comments

Comments
 (0)