diff --git a/README.md b/README.md index 2a6fd1d..787f0c3 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ The focus of the library is type safety and serialization. It does not support c - [x] TON mnemonic and key pairs - [x] Bitstrings - [x] Cells -- [x] Hashmap (aka “dictionary”) +- [x] Hashmaps (aka “dictionary”) - [x] Contract - [x] StateInit - [x] CommonMsgInfo diff --git a/Source/TonSwift/Wallets/WalletContract.swift b/Source/TonSwift/Wallets/WalletContract.swift index f32bc58..58370da 100644 --- a/Source/TonSwift/Wallets/WalletContract.swift +++ b/Source/TonSwift/Wallets/WalletContract.swift @@ -1,6 +1,11 @@ import BigInt import Foundation +/// All wallets implement a compatible interface for sending messages +public protocol WalletContract: Contract { + func createTransfer(args: WalletTransferData) throws -> Cell +} + public struct WalletTransferData { public let seqno: UInt64 public let secretKey: Data @@ -8,7 +13,3 @@ public struct WalletTransferData { public let sendMode: SendMode public let timeout: UInt64? } - -public protocol WalletContract: Contract { - func createTransfer(args: WalletTransferData) throws -> Cell -} diff --git a/Source/TonSwift/Wallets/WalletContractV4.swift b/Source/TonSwift/Wallets/WalletContractV4.swift deleted file mode 100644 index 3979744..0000000 --- a/Source/TonSwift/Wallets/WalletContractV4.swift +++ /dev/null @@ -1,97 +0,0 @@ -import Foundation -import BigInt -import TweetNacl - -public class WalletContractV4: WalletContract { - public let seqno: Int64 - public let workchain: Int8 - public let publicKey: Data - public let walletId: UInt32 - public let plugins: Set
- public let code: Cell - - public init(seqno: Int64 = 0, - workchain: Int8 = 0, - publicKey: Data, - walletId: UInt32? = nil, - code: WalletV4Code = .R2(), - plugins: Set
= [] - ) { - self.seqno = seqno - self.workchain = workchain - self.publicKey = publicKey - - if let walletId { - self.walletId = walletId - } else { - self.walletId = 698983191 + UInt32(workchain) - } - - self.code = code.cell - self.plugins = plugins - } - - public var stateInit: StateInit { - let data = try! Builder() - .store(uint: 0, bits: 32) // initial seqno = 0 - .store(uint: self.walletId, bits: 32) - .store(data: publicKey) - .store(dict: Set()) // initial plugins list = [] - .endCell() - - return StateInit(code: self.code, data: data) - } - - func pluginsCompact() -> Set { - Set(self.plugins.map{ a in CompactAddress(a) }) - } - - public func createTransfer(args: WalletTransferData) throws -> Cell { - guard args.messages.count <= 4 else { - throw TonError.custom("Maximum number of messages in a single transfer is 4") - } - - let signingMessage = try Builder().store(uint: walletId, bits: 32) - if args.seqno == 0 { - for _ in 0..<32 { - try signingMessage.store(bit: 1) - } - } else { - let defaultTimeout = UInt64(Date().timeIntervalSince1970) + 60 // Default timeout: 60 seconds - try signingMessage.store(uint: args.timeout ?? defaultTimeout, bits: 32) - } - - try signingMessage.store(uint: args.seqno, bits: 32) - try signingMessage.store(uint: 0, bits: 8) // Simple order - for message in args.messages { - try signingMessage.store(uint: UInt64(args.sendMode.rawValue), bits: 8) - try signingMessage.store(ref: try Builder().store(message)) - } - - let signature = try NaclSign.sign(message: signingMessage.endCell().hash(), secretKey: args.secretKey) - - let body = Builder() - try body.store(data: signature) - try body.store(signingMessage) - - return try body.endCell() - } -} - - -public struct WalletV4Code { - public let cell: Cell - - init(boc: String) { - cell = try! Cell.fromBoc(src: Data(base64Encoded: boc)!)[0] - } - - /// Version of the code - public static func R1() -> Self { - return Self(boc: "te6cckECFQEAAvUAART/APSkE/S88sgLAQIBIAIDAgFIBAUE+PKDCNcYINMf0x/THwL4I7vyY+1E0NMf0x/T//QE0VFDuvKhUVG68qIF+QFUEGT5EPKj+AAkpMjLH1JAyx9SMMv/UhD0AMntVPgPAdMHIcAAn2xRkyDXSpbTB9QC+wDoMOAhwAHjACHAAuMAAcADkTDjDQOkyMsfEssfy/8REhMUA+7QAdDTAwFxsJFb4CHXScEgkVvgAdMfIYIQcGx1Z70ighBibG5jvbAighBkc3RyvbCSXwPgAvpAMCD6RAHIygfL/8nQ7UTQgQFA1yH0BDBcgQEI9ApvoTGzkl8F4ATTP8glghBwbHVnupEx4w0kghBibG5juuMABAYHCAIBIAkKAFAB+gD0BDCCEHBsdWeDHrFwgBhQBcsFJ88WUAP6AvQAEstpyx9SEMs/AFL4J28ighBibG5jgx6xcIAYUAXLBSfPFiT6AhTLahPLH1Iwyz8B+gL0AACSghBkc3Ryuo41BIEBCPRZMO1E0IEBQNcgyAHPFvQAye1UghBkc3Rygx6xcIAYUATLBVjPFiL6AhLLassfyz+UEDRfBOLJgED7AAIBIAsMAFm9JCtvaiaECAoGuQ+gIYRw1AgIR6STfSmRDOaQPp/5g3gSgBt4EBSJhxWfMYQCAVgNDgARuMl+1E0NcLH4AD2ynftRNCBAUDXIfQEMALIygfL/8nQAYEBCPQKb6ExgAgEgDxAAGa3OdqJoQCBrkOuF/8AAGa8d9qJoQBBrkOuFj8AAbtIH+gDU1CL5AAXIygcVy//J0Hd0gBjIywXLAiLPFlAF+gIUy2sSzMzJcfsAyEAUgQEI9FHypwIAbIEBCNcYyFQgJYEBCPRR8qeCEG5vdGVwdIAYyMsFywJQBM8WghAF9eEA+gITy2oSyx/JcfsAAgBygQEI1xgwUgKBAQj0WfKn+CWCEGRzdHJwdIAYyMsFywJQBc8WghAF9eEA+gIUy2oTyx8Syz/Jc/sAAAr0AMntVEap808=") - } - - public static func R2() -> Self { - return Self(boc: "te6ccgECFAEAAtQAART/APSkE/S88sgLAQIBIAIDAgFIBAUE+PKDCNcYINMf0x/THwL4I7vyZO1E0NMf0x/T//QE0VFDuvKhUVG68qIF+QFUEGT5EPKj+AAkpMjLH1JAyx9SMMv/UhD0AMntVPgPAdMHIcAAn2xRkyDXSpbTB9QC+wDoMOAhwAHjACHAAuMAAcADkTDjDQOkyMsfEssfy/8QERITAubQAdDTAyFxsJJfBOAi10nBIJJfBOAC0x8hghBwbHVnvSKCEGRzdHK9sJJfBeAD+kAwIPpEAcjKB8v/ydDtRNCBAUDXIfQEMFyBAQj0Cm+hMbOSXwfgBdM/yCWCEHBsdWe6kjgw4w0DghBkc3RyupJfBuMNBgcCASAICQB4AfoA9AQw+CdvIjBQCqEhvvLgUIIQcGx1Z4MesXCAGFAEywUmzxZY+gIZ9ADLaRfLH1Jgyz8gyYBA+wAGAIpQBIEBCPRZMO1E0IEBQNcgyAHPFvQAye1UAXKwjiOCEGRzdHKDHrFwgBhQBcsFUAPPFiP6AhPLassfyz/JgED7AJJfA+ICASAKCwBZvSQrb2omhAgKBrkPoCGEcNQICEekk30pkQzmkD6f+YN4EoAbeBAUiYcVnzGEAgFYDA0AEbjJftRNDXCx+AA9sp37UTQgQFA1yH0BDACyMoHy//J0AGBAQj0Cm+hMYAIBIA4PABmtznaiaEAga5Drhf/AABmvHfaiaEAQa5DrhY/AAG7SB/oA1NQi+QAFyMoHFcv/ydB3dIAYyMsFywIizxZQBfoCFMtrEszMyXP7AMhAFIEBCPRR8qcCAHCBAQjXGPoA0z/IVCBHgQEI9FHyp4IQbm90ZXB0gBjIywXLAlAGzxZQBPoCFMtqEssfyz/Jc/sAAgBsgQEI1xj6ANM/MFIkgQEI9Fnyp4IQZHN0cnB0gBjIywXLAlAFzxZQA/oCE8tqyx8Syz/Jc/sAAAr0AMntVA==") - } -} diff --git a/Source/TonSwift/Wallets/WalletContractV1.swift b/Source/TonSwift/Wallets/WalletV1.swift similarity index 97% rename from Source/TonSwift/Wallets/WalletContractV1.swift rename to Source/TonSwift/Wallets/WalletV1.swift index 2a08854..68087d0 100644 --- a/Source/TonSwift/Wallets/WalletContractV1.swift +++ b/Source/TonSwift/Wallets/WalletV1.swift @@ -6,7 +6,7 @@ public enum WalletContractV1Revision { case r1, r2, r3 } -public final class WalletContractV1: WalletContract { +public final class WalletV1: WalletContract { public let workchain: Int8 public let stateInit: StateInit public let publicKey: Data diff --git a/Source/TonSwift/Wallets/WalletContractV2.swift b/Source/TonSwift/Wallets/WalletV2.swift similarity index 97% rename from Source/TonSwift/Wallets/WalletContractV2.swift rename to Source/TonSwift/Wallets/WalletV2.swift index 85ec832..4e48ced 100644 --- a/Source/TonSwift/Wallets/WalletContractV2.swift +++ b/Source/TonSwift/Wallets/WalletV2.swift @@ -6,7 +6,7 @@ public enum WalletContractV2Revision { case r1, r2 } -public final class WalletContractV2: WalletContract { +public final class WalletV2: WalletContract { public let workchain: Int8 public let stateInit: StateInit public let publicKey: Data diff --git a/Source/TonSwift/Wallets/WalletContractV3.swift b/Source/TonSwift/Wallets/WalletV3.swift similarity index 98% rename from Source/TonSwift/Wallets/WalletContractV3.swift rename to Source/TonSwift/Wallets/WalletV3.swift index 7d2a289..634c00c 100644 --- a/Source/TonSwift/Wallets/WalletContractV3.swift +++ b/Source/TonSwift/Wallets/WalletV3.swift @@ -6,7 +6,7 @@ public enum WalletContractV3Revision { case r1, r2 } -public final class WalletContractV3: WalletContract { +public final class WalletV3: WalletContract { public let workchain: Int8 public let stateInit: StateInit public let publicKey: Data diff --git a/Source/TonSwift/Wallets/WalletV4.swift b/Source/TonSwift/Wallets/WalletV4.swift new file mode 100644 index 0000000..432673a --- /dev/null +++ b/Source/TonSwift/Wallets/WalletV4.swift @@ -0,0 +1,103 @@ +import Foundation +import BigInt +import TweetNacl + +public class WalletV4R1: WalletV4 { + public init(seqno: Int64 = 0, + workchain: Int8 = 0, + publicKey: Data, + walletId: UInt32? = nil, + plugins: Set
= [] + ) { + let code = try! Cell.fromBoc(src: Data(base64Encoded: "te6cckECFQEAAvUAART/APSkE/S88sgLAQIBIAIDAgFIBAUE+PKDCNcYINMf0x/THwL4I7vyY+1E0NMf0x/T//QE0VFDuvKhUVG68qIF+QFUEGT5EPKj+AAkpMjLH1JAyx9SMMv/UhD0AMntVPgPAdMHIcAAn2xRkyDXSpbTB9QC+wDoMOAhwAHjACHAAuMAAcADkTDjDQOkyMsfEssfy/8REhMUA+7QAdDTAwFxsJFb4CHXScEgkVvgAdMfIYIQcGx1Z70ighBibG5jvbAighBkc3RyvbCSXwPgAvpAMCD6RAHIygfL/8nQ7UTQgQFA1yH0BDBcgQEI9ApvoTGzkl8F4ATTP8glghBwbHVnupEx4w0kghBibG5juuMABAYHCAIBIAkKAFAB+gD0BDCCEHBsdWeDHrFwgBhQBcsFJ88WUAP6AvQAEstpyx9SEMs/AFL4J28ighBibG5jgx6xcIAYUAXLBSfPFiT6AhTLahPLH1Iwyz8B+gL0AACSghBkc3Ryuo41BIEBCPRZMO1E0IEBQNcgyAHPFvQAye1UghBkc3Rygx6xcIAYUATLBVjPFiL6AhLLassfyz+UEDRfBOLJgED7AAIBIAsMAFm9JCtvaiaECAoGuQ+gIYRw1AgIR6STfSmRDOaQPp/5g3gSgBt4EBSJhxWfMYQCAVgNDgARuMl+1E0NcLH4AD2ynftRNCBAUDXIfQEMALIygfL/8nQAYEBCPQKb6ExgAgEgDxAAGa3OdqJoQCBrkOuF/8AAGa8d9qJoQBBrkOuFj8AAbtIH+gDU1CL5AAXIygcVy//J0Hd0gBjIywXLAiLPFlAF+gIUy2sSzMzJcfsAyEAUgQEI9FHypwIAbIEBCNcYyFQgJYEBCPRR8qeCEG5vdGVwdIAYyMsFywJQBM8WghAF9eEA+gITy2oSyx/JcfsAAgBygQEI1xgwUgKBAQj0WfKn+CWCEGRzdHJwdIAYyMsFywJQBc8WghAF9eEA+gIUy2oTyx8Syz/Jc/sAAAr0AMntVEap808=")!)[0] + super.init(code:code, seqno: seqno, workchain: workchain, publicKey: publicKey, walletId: walletId, plugins: plugins) + } +} + +public class WalletV4R2: WalletV4 { + public init(seqno: Int64 = 0, + workchain: Int8 = 0, + publicKey: Data, + walletId: UInt32? = nil, + plugins: Set
= [] + ) { + let code = try! Cell.fromBoc(src: Data(base64Encoded: "te6ccgECFAEAAtQAART/APSkE/S88sgLAQIBIAIDAgFIBAUE+PKDCNcYINMf0x/THwL4I7vyZO1E0NMf0x/T//QE0VFDuvKhUVG68qIF+QFUEGT5EPKj+AAkpMjLH1JAyx9SMMv/UhD0AMntVPgPAdMHIcAAn2xRkyDXSpbTB9QC+wDoMOAhwAHjACHAAuMAAcADkTDjDQOkyMsfEssfy/8QERITAubQAdDTAyFxsJJfBOAi10nBIJJfBOAC0x8hghBwbHVnvSKCEGRzdHK9sJJfBeAD+kAwIPpEAcjKB8v/ydDtRNCBAUDXIfQEMFyBAQj0Cm+hMbOSXwfgBdM/yCWCEHBsdWe6kjgw4w0DghBkc3RyupJfBuMNBgcCASAICQB4AfoA9AQw+CdvIjBQCqEhvvLgUIIQcGx1Z4MesXCAGFAEywUmzxZY+gIZ9ADLaRfLH1Jgyz8gyYBA+wAGAIpQBIEBCPRZMO1E0IEBQNcgyAHPFvQAye1UAXKwjiOCEGRzdHKDHrFwgBhQBcsFUAPPFiP6AhPLassfyz/JgED7AJJfA+ICASAKCwBZvSQrb2omhAgKBrkPoCGEcNQICEekk30pkQzmkD6f+YN4EoAbeBAUiYcVnzGEAgFYDA0AEbjJftRNDXCx+AA9sp37UTQgQFA1yH0BDACyMoHy//J0AGBAQj0Cm+hMYAIBIA4PABmtznaiaEAga5Drhf/AABmvHfaiaEAQa5DrhY/AAG7SB/oA1NQi+QAFyMoHFcv/ydB3dIAYyMsFywIizxZQBfoCFMtrEszMyXP7AMhAFIEBCPRR8qcCAHCBAQjXGPoA0z/IVCBHgQEI9FHyp4IQbm90ZXB0gBjIywXLAlAGzxZQBPoCFMtqEssfyz/Jc/sAAgBsgQEI1xj6ANM/MFIkgQEI9Fnyp4IQZHN0cnB0gBjIywXLAlAFzxZQA/oCE8tqyx8Syz/Jc/sAAAr0AMntVA==")!)[0] + super.init(code:code, seqno: seqno, workchain: workchain, publicKey: publicKey, walletId: walletId, plugins: plugins) + } +} + +/// Internal WalletV4 implementation. Use specific revision `WalletV4R1` instead. +public class WalletV4: WalletContract { + public let seqno: Int64 + public let workchain: Int8 + public let publicKey: Data + public let walletId: UInt32 + public let plugins: Set
+ public let code: Cell + + fileprivate init(code: Cell, + seqno: Int64 = 0, + workchain: Int8 = 0, + publicKey: Data, + walletId: UInt32? = nil, + plugins: Set
= [] + ) { + self.code = code + self.seqno = seqno + self.workchain = workchain + self.publicKey = publicKey + + if let walletId { + self.walletId = walletId + } else { + self.walletId = 698983191 + UInt32(workchain) + } + self.plugins = plugins + } + + public var stateInit: StateInit { + let data = try! Builder() + .store(uint: 0, bits: 32) // initial seqno = 0 + .store(uint: self.walletId, bits: 32) + .store(data: publicKey) + .store(dict: Set()) // initial plugins list = [] + .endCell() + + return StateInit(code: self.code, data: data) + } + + func pluginsCompact() -> Set { + Set(self.plugins.map{ a in CompactAddress(a) }) + } + + public func createTransfer(args: WalletTransferData) throws -> Cell { + guard args.messages.count <= 4 else { + throw TonError.custom("Maximum number of messages in a single transfer is 4") + } + + let signingMessage = try Builder().store(uint: walletId, bits: 32) + if args.seqno == 0 { + for _ in 0..<32 { + try signingMessage.store(bit: 1) + } + } else { + let defaultTimeout = UInt64(Date().timeIntervalSince1970) + 60 // Default timeout: 60 seconds + try signingMessage.store(uint: args.timeout ?? defaultTimeout, bits: 32) + } + + try signingMessage.store(uint: args.seqno, bits: 32) + try signingMessage.store(uint: 0, bits: 8) // Simple order + for message in args.messages { + try signingMessage.store(uint: UInt64(args.sendMode.rawValue), bits: 8) + try signingMessage.store(ref: try Builder().store(message)) + } + + let signature = try NaclSign.sign(message: signingMessage.endCell().hash(), secretKey: args.secretKey) + + let body = Builder() + try body.store(data: signature) + try body.store(signingMessage) + + return try body.endCell() + } +} diff --git a/Tests/TonSwiftTests/Wallets/WalletContractV1Test.swift b/Tests/TonSwiftTests/Wallets/WalletContractV1Test.swift index d716844..cec326b 100644 --- a/Tests/TonSwiftTests/Wallets/WalletContractV1Test.swift +++ b/Tests/TonSwiftTests/Wallets/WalletContractV1Test.swift @@ -15,7 +15,7 @@ final class WalletContractV1Test: XCTestCase { } private func testR1() throws { - let contractR1 = try WalletContractV1(workchain: 0, publicKey: publicKey, revision: .r1) + let contractR1 = try WalletV1(workchain: 0, publicKey: publicKey, revision: .r1) XCTAssertEqual(try contractR1.address(), try Address.parse("EQCtW_zzk6n82ebaVQFq8P_04wOemYhtwqMd3NuArmPODRvD")) XCTAssertEqual(try contractR1.stateInit.data?.toString(), "x{000000005754865E86D0ADE1199301BBB0319A25ED6B129C4B0A57F28F62449B3DF9C522}") @@ -26,7 +26,7 @@ final class WalletContractV1Test: XCTestCase { } private func testR2() throws { - let contractR2 = try WalletContractV1(workchain: 0, publicKey: publicKey, revision: .r2) + let contractR2 = try WalletV1(workchain: 0, publicKey: publicKey, revision: .r2) XCTAssertEqual(try contractR2.address(), try Address.parse("EQATDkvcCA2fFWbSTHMpGCrjkNGqgEywES15ZS11HHY3UuxK")) XCTAssertEqual(try contractR2.stateInit.data?.toString(), "x{000000005754865E86D0ADE1199301BBB0319A25ED6B129C4B0A57F28F62449B3DF9C522}") @@ -37,7 +37,7 @@ final class WalletContractV1Test: XCTestCase { } private func testR3() throws { - let contractR3 = try WalletContractV1(workchain: 0, publicKey: publicKey, revision: .r3) + let contractR3 = try WalletV1(workchain: 0, publicKey: publicKey, revision: .r3) XCTAssertEqual(try contractR3.address(), try Address.parse("EQBRRPBUtgzq5om6O4rtxwPW4hyDxiXYeIko27tvsm97kUw3")) XCTAssertEqual(try contractR3.stateInit.data?.toString(), "x{000000005754865E86D0ADE1199301BBB0319A25ED6B129C4B0A57F28F62449B3DF9C522}") diff --git a/Tests/TonSwiftTests/Wallets/WalletContractV2Test.swift b/Tests/TonSwiftTests/Wallets/WalletContractV2Test.swift index a488211..c22435f 100644 --- a/Tests/TonSwiftTests/Wallets/WalletContractV2Test.swift +++ b/Tests/TonSwiftTests/Wallets/WalletContractV2Test.swift @@ -14,7 +14,7 @@ final class WalletContractV2Test: XCTestCase { } private func testR1() throws { - let contractR1 = try WalletContractV2(workchain: 0, publicKey: publicKey, revision: .r1) + let contractR1 = try WalletV2(workchain: 0, publicKey: publicKey, revision: .r1) XCTAssertEqual(try contractR1.address(), try Address.parse("EQD3ES67JiTYq5y2eE1-fivl5kANn-gKDDjvpbxNCQWPzs4D")) XCTAssertEqual(try contractR1.stateInit.data?.toString(), "x{000000005754865E86D0ADE1199301BBB0319A25ED6B129C4B0A57F28F62449B3DF9C522}") @@ -28,7 +28,7 @@ final class WalletContractV2Test: XCTestCase { } private func testR2() throws { - let contractR2 = try WalletContractV2(workchain: 0, publicKey: publicKey, revision: .r2) + let contractR2 = try WalletV2(workchain: 0, publicKey: publicKey, revision: .r2) XCTAssertEqual(try contractR2.address(), try Address.parse("EQAkAcNLtzCHudScK9Hsk9I_7SrunBWf_9VrA2xJmGebwEsl")) XCTAssertEqual(try contractR2.stateInit.data?.toString(), "x{000000005754865E86D0ADE1199301BBB0319A25ED6B129C4B0A57F28F62449B3DF9C522}") diff --git a/Tests/TonSwiftTests/Wallets/WalletContractV3Test.swift b/Tests/TonSwiftTests/Wallets/WalletContractV3Test.swift index 5ba2af0..2735181 100644 --- a/Tests/TonSwiftTests/Wallets/WalletContractV3Test.swift +++ b/Tests/TonSwiftTests/Wallets/WalletContractV3Test.swift @@ -14,7 +14,7 @@ final class WalletContractV3Test: XCTestCase { } private func testR1() throws { - let contractR1 = try WalletContractV3(workchain: 0, publicKey: publicKey, revision: .r1) + let contractR1 = try WalletV3(workchain: 0, publicKey: publicKey, revision: .r1) XCTAssertEqual(try contractR1.address(), try Address.parse("EQBJp7j5N40GXJbAqFSnfTV1Af4ZTyHIMpRbKcudNhWJbbNO")) XCTAssertEqual(try contractR1.stateInit.data?.toString(), "x{0000000029A9A3175754865E86D0ADE1199301BBB0319A25ED6B129C4B0A57F28F62449B3DF9C522}") @@ -28,7 +28,7 @@ final class WalletContractV3Test: XCTestCase { } private func testR2() throws { - let contractR2 = try WalletContractV3(workchain: 0, publicKey: publicKey, revision: .r2) + let contractR2 = try WalletV3(workchain: 0, publicKey: publicKey, revision: .r2) XCTAssertEqual(try contractR2.address(), try Address.parse("EQA0D_5WdusaCB-SpnoE6l5TzdBmgOkzTcXrdh0px6g3zJSk")) XCTAssertEqual(try contractR2.stateInit.data?.toString(), "x{0000000029A9A3175754865E86D0ADE1199301BBB0319A25ED6B129C4B0A57F28F62449B3DF9C522}") diff --git a/Tests/TonSwiftTests/Wallets/WalletContractV4Test.swift b/Tests/TonSwiftTests/Wallets/WalletContractV4Test.swift index 1dbeec1..eda7d9e 100644 --- a/Tests/TonSwiftTests/Wallets/WalletContractV4Test.swift +++ b/Tests/TonSwiftTests/Wallets/WalletContractV4Test.swift @@ -14,7 +14,7 @@ final class WalletContractV4Test: XCTestCase { } func testR1() throws { - let contractR1 = WalletContractV4(workchain: 0, publicKey: publicKey, code: .R1()) + let contractR1 = WalletV4R1(workchain: 0, publicKey: publicKey) XCTAssertEqual(try contractR1.address(), try Address.parse("EQAimhPwOYc5Z1JP_pddxo82SHOl67T0Lklw91pKtSX2Q094")) XCTAssertEqual(try contractR1.stateInit.data?.toString(), "x{0000000029A9A3175754865E86D0ADE1199301BBB0319A25ED6B129C4B0A57F28F62449B3DF9C5224_}") @@ -29,7 +29,7 @@ final class WalletContractV4Test: XCTestCase { } func testR2() throws { - let contractR2 = WalletContractV4(workchain: 0, publicKey: publicKey, code: .R2()) + let contractR2 = WalletV4R2(workchain: 0, publicKey: publicKey) XCTAssertEqual(try contractR2.address(), try Address.parse("EQDnBF4JTFKHTYjulEJyNd4dstLGH1m51UrLdu01_tw4z2Au")) XCTAssertEqual(try contractR2.stateInit.data?.toString(), "x{0000000029A9A3175754865E86D0ADE1199301BBB0319A25ED6B129C4B0A57F28F62449B3DF9C5224_}")