Update Pods

This commit is contained in:
Ivan Grachev 2022-06-09 15:18:07 +03:00
parent e34ab74de7
commit dbbfd416f8
22 changed files with 3090 additions and 2700 deletions

View File

@ -16,11 +16,11 @@ PODS:
- Starscream (3.1.1)
- SwiftProtobuf (1.19.0)
- SwiftyJSON (4.3.0)
- TrustWalletCore (2.9.0):
- TrustWalletCore/Core (= 2.9.0)
- TrustWalletCore/Core (2.9.0):
- TrustWalletCore (2.9.4):
- TrustWalletCore/Core (= 2.9.4)
- TrustWalletCore/Core (2.9.4):
- TrustWalletCore/Types
- TrustWalletCore/Types (2.9.0):
- TrustWalletCore/Types (2.9.4):
- SwiftProtobuf
- WalletConnect (0.1.0):
- CryptoSwift
@ -78,7 +78,7 @@ SPEC CHECKSUMS:
Starscream: 4bb2f9942274833f7b4d296a55504dcfc7edb7b0
SwiftProtobuf: 6ef3f0e422ef90d6605ca20b21a94f6c1324d6b3
SwiftyJSON: 6faa0040f8b59dead0ee07436cbf76b73c08fd08
TrustWalletCore: ab3c0ecc39d3c3509b7f0d70e37a85b5922b72b2
TrustWalletCore: d28fc62c6a81bf3c72d3045890cb240fa245b39c
WalletConnect: 1df75d4355b1cacfc27d7ef2416fae43862d0eb4
Web3Swift.io: 18fd06aed9d56df9c704f9c6f87b06675bb05b53

10
Pods/Manifest.lock generated
View File

@ -16,11 +16,11 @@ PODS:
- Starscream (3.1.1)
- SwiftProtobuf (1.19.0)
- SwiftyJSON (4.3.0)
- TrustWalletCore (2.9.0):
- TrustWalletCore/Core (= 2.9.0)
- TrustWalletCore/Core (2.9.0):
- TrustWalletCore (2.9.4):
- TrustWalletCore/Core (= 2.9.4)
- TrustWalletCore/Core (2.9.4):
- TrustWalletCore/Types
- TrustWalletCore/Types (2.9.0):
- TrustWalletCore/Types (2.9.4):
- SwiftProtobuf
- WalletConnect (0.1.0):
- CryptoSwift
@ -78,7 +78,7 @@ SPEC CHECKSUMS:
Starscream: 4bb2f9942274833f7b4d296a55504dcfc7edb7b0
SwiftProtobuf: 6ef3f0e422ef90d6605ca20b21a94f6c1324d6b3
SwiftyJSON: 6faa0040f8b59dead0ee07436cbf76b73c08fd08
TrustWalletCore: ab3c0ecc39d3c3509b7f0d70e37a85b5922b72b2
TrustWalletCore: d28fc62c6a81bf3c72d3045890cb240fa245b39c
WalletConnect: 1df75d4355b1cacfc27d7ef2416fae43862d0eb4
Web3Swift.io: 18fd06aed9d56df9c704f9c6f87b06675bb05b53

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.9.0</string>
<string>2.9.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@ -26,6 +26,7 @@
#import "TWBitcoinScript.h"
#import "TWBitcoinSigHashType.h"
#import "TWBlockchain.h"
#import "TWCardano.h"
#import "TWCardanoProto.h"
#import "TWCoinType.h"
#import "TWCoinTypeConfiguration.h"

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.9.0</string>
<string>2.9.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@ -26,6 +26,7 @@
#import "TWBitcoinScript.h"
#import "TWBitcoinSigHashType.h"
#import "TWBlockchain.h"
#import "TWCardano.h"
#import "TWCardanoProto.h"
#import "TWCoinType.h"
#import "TWCoinTypeConfiguration.h"

View File

@ -0,0 +1,27 @@
// Copyright © 2017-2022 Trust Wallet.
//
// This file is part of Trust. The full Trust copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
// file LICENSE at the root of the source code distribution tree.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.
//
import Foundation
public struct Cardano {
public static func minAdaAmount(tokenBundle: Data) -> UInt64 {
let tokenBundleData = TWDataCreateWithNSData(tokenBundle)
defer {
TWDataDelete(tokenBundleData)
}
return TWCardanoMinAdaAmount(tokenBundleData)
}
init() {
}
}

View File

@ -45,6 +45,10 @@ extension CoinType {
return TWCoinTypeStaticPrefix(TWCoinType(rawValue: rawValue))
}
public var chainId: String {
return TWStringNSString(TWCoinTypeChainId(TWCoinType(rawValue: rawValue)))
}
public var slip44Id: UInt32 {
return TWCoinTypeSlip44Id(TWCoinType(rawValue: rawValue))
}

View File

@ -44,8 +44,7 @@ public enum Blockchain: UInt32, CaseIterable {
case decred = 35
case zcash = 36
case groestlcoin = 37
case nativeEvmos = 38
case thorchain = 39
case ronin = 40
case kusama = 41
case thorchain = 38
case ronin = 39
case kusama = 40
}

View File

@ -92,4 +92,6 @@ public enum CoinType: UInt32, CaseIterable {
case aurora = 1323161554
case evmos = 10009001
case nativeEvmos = 20009001
case moonriver = 10001285
case moonbeam = 10001284
}

View File

@ -9,29 +9,31 @@
public enum EthereumChainID: UInt32, CaseIterable {
case ethereum = 1
case go = 60
case classic = 61
case poa = 99
case vechain = 74
case callisto = 820
case ethereumClassic = 61
case veChain = 74
case thunderToken = 108
case tomoChain = 88
case binanceSmartChain = 56
case tomochain = 88
case polygon = 137
case wanchain = 888
case optimism = 10
case arbitrum = 42161
case heco = 128
case avalanche = 43114
case xdai = 100
case fantom = 250
case thundertoken = 108
case gochain = 60
case celo = 42220
case ronin = 2020
case wanchain = 888
case cronos = 25
case smartBitcoinCash = 10000
case kuCoinCommunityChain = 321
case optimism = 10
case xdai = 100
case smartbch = 10000
case fantom = 250
case boba = 288
case kcc = 321
case heco = 128
case metis = 1088
case aurora = 1313161554
case moonbeam = 1284
case moonriver = 1285
case ronin = 2020
case avalanchec = 43114
case evmos = 9001
case arbitrum = 42161
case smartchain = 56
case aurora = 1313161554
}

View File

@ -8,6 +8,7 @@ public typealias CardanoOutPoint = TW_Cardano_Proto_OutPoint
public typealias CardanoTokenAmount = TW_Cardano_Proto_TokenAmount
public typealias CardanoTxInput = TW_Cardano_Proto_TxInput
public typealias CardanoTxOutput = TW_Cardano_Proto_TxOutput
public typealias CardanoTokenBundle = TW_Cardano_Proto_TokenBundle
public typealias CardanoTransfer = TW_Cardano_Proto_Transfer
public typealias CardanoTransactionPlan = TW_Cardano_Proto_TransactionPlan
public typealias CardanoSigningInput = TW_Cardano_Proto_SigningInput

View File

@ -39,6 +39,7 @@ public struct TW_Cardano_Proto_TokenAmount {
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
/// as hex string (28x2 digits)
public var policyID: String = String()
public var assetName: String = String()
@ -90,6 +91,22 @@ public struct TW_Cardano_Proto_TxOutput {
/// ADA amount
public var amount: UInt64 = 0
/// optional token amounts
public var tokenAmount: [TW_Cardano_Proto_TokenAmount] = []
public var unknownFields = SwiftProtobuf.UnknownStorage()
public init() {}
}
/// Collection of tokens with amount
public struct TW_Cardano_Proto_TokenBundle {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
public var token: [TW_Cardano_Proto_TokenAmount] = []
public var unknownFields = SwiftProtobuf.UnknownStorage()
public init() {}
@ -106,15 +123,33 @@ public struct TW_Cardano_Proto_Transfer {
/// Change address
public var changeAddress: String = String()
/// ADA amount to transfer
/// Requested ADA amount to be transferred. Output can be different only in use_max_amount case.
/// Note that Cardano has a minimum amount per UTXO, see TWCardanoMinAdaAmount.
public var amount: UInt64 = 0
/// Set if max amount is requested (max possible from UTXOs/fee; amount is disregarded in this case)
/// Optional token(s) to be transferred
/// Currently only one token type to be transferred per transaction is supported
public var tokenAmount: TW_Cardano_Proto_TokenBundle {
get {return _tokenAmount ?? TW_Cardano_Proto_TokenBundle()}
set {_tokenAmount = newValue}
}
/// Returns true if `tokenAmount` has been explicitly set.
public var hasTokenAmount: Bool {return self._tokenAmount != nil}
/// Clears the value of `tokenAmount`. Subsequent reads from it will return its default value.
public mutating func clearTokenAmount() {self._tokenAmount = nil}
/// Request max amount option. If set, tx will send all possible amounts from all inputs, including all tokens; there will be no change; requested amount and token_amount is disregarded in this case.
public var useMaxAmount: Bool = false
/// Optional fee overriding. If left to 0, optimal fee will be calculated. If set, exactly this value will be used as fee.
/// Use it with care, it may result in underfunded or wasteful fee.
public var forceFee: UInt64 = 0
public var unknownFields = SwiftProtobuf.UnknownStorage()
public init() {}
fileprivate var _tokenAmount: TW_Cardano_Proto_TokenBundle? = nil
}
public struct TW_Cardano_Proto_TransactionPlan {
@ -122,14 +157,27 @@ public struct TW_Cardano_Proto_TransactionPlan {
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
public var amount: UInt64 = 0
/// total coins in the utxos
public var availableAmount: UInt64 = 0
/// coins in the output UTXO
public var amount: UInt64 = 0
/// coin amount deducted as fee
public var fee: UInt64 = 0
/// coins in the change UTXO
public var change: UInt64 = 0
/// total tokens in the utxos (optional)
public var availableTokens: [TW_Cardano_Proto_TokenAmount] = []
/// tokens in the output (optional)
public var outputTokens: [TW_Cardano_Proto_TokenAmount] = []
/// tokens in the change (optional)
public var changeTokens: [TW_Cardano_Proto_TokenAmount] = []
public var utxos: [TW_Cardano_Proto_TxInput] = []
public var error: TW_Common_Proto_SigningError = .ok
@ -145,40 +193,48 @@ public struct TW_Cardano_Proto_SigningInput {
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
public var utxos: [TW_Cardano_Proto_TxInput] = []
public var utxos: [TW_Cardano_Proto_TxInput] {
get {return _storage._utxos}
set {_uniqueStorage()._utxos = newValue}
}
/// Available private keys (double extended keys); every input UTXO adress should be covered
/// In case of Plan only, keys should be present, in correct number
public var privateKey: [Data] = []
public var privateKey: [Data] {
get {return _storage._privateKey}
set {_uniqueStorage()._privateKey = newValue}
}
/// Later this can be made oneof if more message types are supported
public var transferMessage: TW_Cardano_Proto_Transfer {
get {return _transferMessage ?? TW_Cardano_Proto_Transfer()}
set {_transferMessage = newValue}
get {return _storage._transferMessage ?? TW_Cardano_Proto_Transfer()}
set {_uniqueStorage()._transferMessage = newValue}
}
/// Returns true if `transferMessage` has been explicitly set.
public var hasTransferMessage: Bool {return self._transferMessage != nil}
public var hasTransferMessage: Bool {return _storage._transferMessage != nil}
/// Clears the value of `transferMessage`. Subsequent reads from it will return its default value.
public mutating func clearTransferMessage() {self._transferMessage = nil}
public mutating func clearTransferMessage() {_uniqueStorage()._transferMessage = nil}
public var ttl: UInt64 = 0
public var ttl: UInt64 {
get {return _storage._ttl}
set {_uniqueStorage()._ttl = newValue}
}
/// Optional plan
public var plan: TW_Cardano_Proto_TransactionPlan {
get {return _plan ?? TW_Cardano_Proto_TransactionPlan()}
set {_plan = newValue}
get {return _storage._plan ?? TW_Cardano_Proto_TransactionPlan()}
set {_uniqueStorage()._plan = newValue}
}
/// Returns true if `plan` has been explicitly set.
public var hasPlan: Bool {return self._plan != nil}
public var hasPlan: Bool {return _storage._plan != nil}
/// Clears the value of `plan`. Subsequent reads from it will return its default value.
public mutating func clearPlan() {self._plan = nil}
public mutating func clearPlan() {_uniqueStorage()._plan = nil}
public var unknownFields = SwiftProtobuf.UnknownStorage()
public init() {}
fileprivate var _transferMessage: TW_Cardano_Proto_Transfer? = nil
fileprivate var _plan: TW_Cardano_Proto_TransactionPlan? = nil
fileprivate var _storage = _StorageClass.defaultInstance
}
/// Transaction signing output
@ -345,6 +401,7 @@ extension TW_Cardano_Proto_TxOutput: SwiftProtobuf.Message, SwiftProtobuf._Messa
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "address"),
2: .same(proto: "amount"),
3: .standard(proto: "token_amount"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
@ -355,6 +412,7 @@ extension TW_Cardano_Proto_TxOutput: SwiftProtobuf.Message, SwiftProtobuf._Messa
switch fieldNumber {
case 1: try { try decoder.decodeSingularStringField(value: &self.address) }()
case 2: try { try decoder.decodeSingularUInt64Field(value: &self.amount) }()
case 3: try { try decoder.decodeRepeatedMessageField(value: &self.tokenAmount) }()
default: break
}
}
@ -367,12 +425,48 @@ extension TW_Cardano_Proto_TxOutput: SwiftProtobuf.Message, SwiftProtobuf._Messa
if self.amount != 0 {
try visitor.visitSingularUInt64Field(value: self.amount, fieldNumber: 2)
}
if !self.tokenAmount.isEmpty {
try visitor.visitRepeatedMessageField(value: self.tokenAmount, fieldNumber: 3)
}
try unknownFields.traverse(visitor: &visitor)
}
public static func ==(lhs: TW_Cardano_Proto_TxOutput, rhs: TW_Cardano_Proto_TxOutput) -> Bool {
if lhs.address != rhs.address {return false}
if lhs.amount != rhs.amount {return false}
if lhs.tokenAmount != rhs.tokenAmount {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
extension TW_Cardano_Proto_TokenBundle: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".TokenBundle"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "token"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 1: try { try decoder.decodeRepeatedMessageField(value: &self.token) }()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if !self.token.isEmpty {
try visitor.visitRepeatedMessageField(value: self.token, fieldNumber: 1)
}
try unknownFields.traverse(visitor: &visitor)
}
public static func ==(lhs: TW_Cardano_Proto_TokenBundle, rhs: TW_Cardano_Proto_TokenBundle) -> Bool {
if lhs.token != rhs.token {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
@ -384,7 +478,9 @@ extension TW_Cardano_Proto_Transfer: SwiftProtobuf.Message, SwiftProtobuf._Messa
1: .standard(proto: "to_address"),
2: .standard(proto: "change_address"),
3: .same(proto: "amount"),
4: .standard(proto: "use_max_amount"),
4: .standard(proto: "token_amount"),
5: .standard(proto: "use_max_amount"),
6: .standard(proto: "force_fee"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
@ -396,13 +492,19 @@ extension TW_Cardano_Proto_Transfer: SwiftProtobuf.Message, SwiftProtobuf._Messa
case 1: try { try decoder.decodeSingularStringField(value: &self.toAddress) }()
case 2: try { try decoder.decodeSingularStringField(value: &self.changeAddress) }()
case 3: try { try decoder.decodeSingularUInt64Field(value: &self.amount) }()
case 4: try { try decoder.decodeSingularBoolField(value: &self.useMaxAmount) }()
case 4: try { try decoder.decodeSingularMessageField(value: &self._tokenAmount) }()
case 5: try { try decoder.decodeSingularBoolField(value: &self.useMaxAmount) }()
case 6: try { try decoder.decodeSingularUInt64Field(value: &self.forceFee) }()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every if/case branch local when no optimizations
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
// https://github.com/apple/swift-protobuf/issues/1182
if !self.toAddress.isEmpty {
try visitor.visitSingularStringField(value: self.toAddress, fieldNumber: 1)
}
@ -412,8 +514,14 @@ extension TW_Cardano_Proto_Transfer: SwiftProtobuf.Message, SwiftProtobuf._Messa
if self.amount != 0 {
try visitor.visitSingularUInt64Field(value: self.amount, fieldNumber: 3)
}
try { if let v = self._tokenAmount {
try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
} }()
if self.useMaxAmount != false {
try visitor.visitSingularBoolField(value: self.useMaxAmount, fieldNumber: 4)
try visitor.visitSingularBoolField(value: self.useMaxAmount, fieldNumber: 5)
}
if self.forceFee != 0 {
try visitor.visitSingularUInt64Field(value: self.forceFee, fieldNumber: 6)
}
try unknownFields.traverse(visitor: &visitor)
}
@ -422,7 +530,9 @@ extension TW_Cardano_Proto_Transfer: SwiftProtobuf.Message, SwiftProtobuf._Messa
if lhs.toAddress != rhs.toAddress {return false}
if lhs.changeAddress != rhs.changeAddress {return false}
if lhs.amount != rhs.amount {return false}
if lhs._tokenAmount != rhs._tokenAmount {return false}
if lhs.useMaxAmount != rhs.useMaxAmount {return false}
if lhs.forceFee != rhs.forceFee {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
@ -431,12 +541,15 @@ extension TW_Cardano_Proto_Transfer: SwiftProtobuf.Message, SwiftProtobuf._Messa
extension TW_Cardano_Proto_TransactionPlan: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".TransactionPlan"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "amount"),
2: .standard(proto: "available_amount"),
1: .standard(proto: "available_amount"),
2: .same(proto: "amount"),
3: .same(proto: "fee"),
4: .same(proto: "change"),
5: .same(proto: "utxos"),
6: .same(proto: "error"),
5: .standard(proto: "available_tokens"),
6: .standard(proto: "output_tokens"),
7: .standard(proto: "change_tokens"),
8: .same(proto: "utxos"),
9: .same(proto: "error"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
@ -445,23 +558,26 @@ extension TW_Cardano_Proto_TransactionPlan: SwiftProtobuf.Message, SwiftProtobuf
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 1: try { try decoder.decodeSingularUInt64Field(value: &self.amount) }()
case 2: try { try decoder.decodeSingularUInt64Field(value: &self.availableAmount) }()
case 1: try { try decoder.decodeSingularUInt64Field(value: &self.availableAmount) }()
case 2: try { try decoder.decodeSingularUInt64Field(value: &self.amount) }()
case 3: try { try decoder.decodeSingularUInt64Field(value: &self.fee) }()
case 4: try { try decoder.decodeSingularUInt64Field(value: &self.change) }()
case 5: try { try decoder.decodeRepeatedMessageField(value: &self.utxos) }()
case 6: try { try decoder.decodeSingularEnumField(value: &self.error) }()
case 5: try { try decoder.decodeRepeatedMessageField(value: &self.availableTokens) }()
case 6: try { try decoder.decodeRepeatedMessageField(value: &self.outputTokens) }()
case 7: try { try decoder.decodeRepeatedMessageField(value: &self.changeTokens) }()
case 8: try { try decoder.decodeRepeatedMessageField(value: &self.utxos) }()
case 9: try { try decoder.decodeSingularEnumField(value: &self.error) }()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if self.amount != 0 {
try visitor.visitSingularUInt64Field(value: self.amount, fieldNumber: 1)
}
if self.availableAmount != 0 {
try visitor.visitSingularUInt64Field(value: self.availableAmount, fieldNumber: 2)
try visitor.visitSingularUInt64Field(value: self.availableAmount, fieldNumber: 1)
}
if self.amount != 0 {
try visitor.visitSingularUInt64Field(value: self.amount, fieldNumber: 2)
}
if self.fee != 0 {
try visitor.visitSingularUInt64Field(value: self.fee, fieldNumber: 3)
@ -469,20 +585,32 @@ extension TW_Cardano_Proto_TransactionPlan: SwiftProtobuf.Message, SwiftProtobuf
if self.change != 0 {
try visitor.visitSingularUInt64Field(value: self.change, fieldNumber: 4)
}
if !self.availableTokens.isEmpty {
try visitor.visitRepeatedMessageField(value: self.availableTokens, fieldNumber: 5)
}
if !self.outputTokens.isEmpty {
try visitor.visitRepeatedMessageField(value: self.outputTokens, fieldNumber: 6)
}
if !self.changeTokens.isEmpty {
try visitor.visitRepeatedMessageField(value: self.changeTokens, fieldNumber: 7)
}
if !self.utxos.isEmpty {
try visitor.visitRepeatedMessageField(value: self.utxos, fieldNumber: 5)
try visitor.visitRepeatedMessageField(value: self.utxos, fieldNumber: 8)
}
if self.error != .ok {
try visitor.visitSingularEnumField(value: self.error, fieldNumber: 6)
try visitor.visitSingularEnumField(value: self.error, fieldNumber: 9)
}
try unknownFields.traverse(visitor: &visitor)
}
public static func ==(lhs: TW_Cardano_Proto_TransactionPlan, rhs: TW_Cardano_Proto_TransactionPlan) -> Bool {
if lhs.amount != rhs.amount {return false}
if lhs.availableAmount != rhs.availableAmount {return false}
if lhs.amount != rhs.amount {return false}
if lhs.fee != rhs.fee {return false}
if lhs.change != rhs.change {return false}
if lhs.availableTokens != rhs.availableTokens {return false}
if lhs.outputTokens != rhs.outputTokens {return false}
if lhs.changeTokens != rhs.changeTokens {return false}
if lhs.utxos != rhs.utxos {return false}
if lhs.error != rhs.error {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
@ -500,51 +628,91 @@ extension TW_Cardano_Proto_SigningInput: SwiftProtobuf.Message, SwiftProtobuf._M
5: .same(proto: "plan"),
]
fileprivate class _StorageClass {
var _utxos: [TW_Cardano_Proto_TxInput] = []
var _privateKey: [Data] = []
var _transferMessage: TW_Cardano_Proto_Transfer? = nil
var _ttl: UInt64 = 0
var _plan: TW_Cardano_Proto_TransactionPlan? = nil
static let defaultInstance = _StorageClass()
private init() {}
init(copying source: _StorageClass) {
_utxos = source._utxos
_privateKey = source._privateKey
_transferMessage = source._transferMessage
_ttl = source._ttl
_plan = source._plan
}
}
fileprivate mutating func _uniqueStorage() -> _StorageClass {
if !isKnownUniquelyReferenced(&_storage) {
_storage = _StorageClass(copying: _storage)
}
return _storage
}
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 1: try { try decoder.decodeRepeatedMessageField(value: &self.utxos) }()
case 2: try { try decoder.decodeRepeatedBytesField(value: &self.privateKey) }()
case 3: try { try decoder.decodeSingularMessageField(value: &self._transferMessage) }()
case 4: try { try decoder.decodeSingularUInt64Field(value: &self.ttl) }()
case 5: try { try decoder.decodeSingularMessageField(value: &self._plan) }()
default: break
_ = _uniqueStorage()
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 1: try { try decoder.decodeRepeatedMessageField(value: &_storage._utxos) }()
case 2: try { try decoder.decodeRepeatedBytesField(value: &_storage._privateKey) }()
case 3: try { try decoder.decodeSingularMessageField(value: &_storage._transferMessage) }()
case 4: try { try decoder.decodeSingularUInt64Field(value: &_storage._ttl) }()
case 5: try { try decoder.decodeSingularMessageField(value: &_storage._plan) }()
default: break
}
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every if/case branch local when no optimizations
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
// https://github.com/apple/swift-protobuf/issues/1182
if !self.utxos.isEmpty {
try visitor.visitRepeatedMessageField(value: self.utxos, fieldNumber: 1)
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every if/case branch local when no optimizations
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
// https://github.com/apple/swift-protobuf/issues/1182
if !_storage._utxos.isEmpty {
try visitor.visitRepeatedMessageField(value: _storage._utxos, fieldNumber: 1)
}
if !_storage._privateKey.isEmpty {
try visitor.visitRepeatedBytesField(value: _storage._privateKey, fieldNumber: 2)
}
try { if let v = _storage._transferMessage {
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
} }()
if _storage._ttl != 0 {
try visitor.visitSingularUInt64Field(value: _storage._ttl, fieldNumber: 4)
}
try { if let v = _storage._plan {
try visitor.visitSingularMessageField(value: v, fieldNumber: 5)
} }()
}
if !self.privateKey.isEmpty {
try visitor.visitRepeatedBytesField(value: self.privateKey, fieldNumber: 2)
}
try { if let v = self._transferMessage {
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
} }()
if self.ttl != 0 {
try visitor.visitSingularUInt64Field(value: self.ttl, fieldNumber: 4)
}
try { if let v = self._plan {
try visitor.visitSingularMessageField(value: v, fieldNumber: 5)
} }()
try unknownFields.traverse(visitor: &visitor)
}
public static func ==(lhs: TW_Cardano_Proto_SigningInput, rhs: TW_Cardano_Proto_SigningInput) -> Bool {
if lhs.utxos != rhs.utxos {return false}
if lhs.privateKey != rhs.privateKey {return false}
if lhs._transferMessage != rhs._transferMessage {return false}
if lhs.ttl != rhs.ttl {return false}
if lhs._plan != rhs._plan {return false}
if lhs._storage !== rhs._storage {
let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
let _storage = _args.0
let rhs_storage = _args.1
if _storage._utxos != rhs_storage._utxos {return false}
if _storage._privateKey != rhs_storage._privateKey {return false}
if _storage._transferMessage != rhs_storage._transferMessage {return false}
if _storage._ttl != rhs_storage._ttl {return false}
if _storage._plan != rhs_storage._plan {return false}
return true
}
if !storagesAreEqual {return false}
}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}

View File

@ -79,6 +79,7 @@ public enum TW_Common_Proto_SigningError: SwiftProtobuf.Enum {
/// Incorrect parameters
case errorInvalidParams // = 22
case errorInvalidRequestedTokenAmount // = 23
case UNRECOGNIZED(Int)
public init() {
@ -110,6 +111,7 @@ public enum TW_Common_Proto_SigningError: SwiftProtobuf.Enum {
case 20: self = .errorNoSupportN2N
case 21: self = .errorSignaturesCount
case 22: self = .errorInvalidParams
case 23: self = .errorInvalidRequestedTokenAmount
default: self = .UNRECOGNIZED(rawValue)
}
}
@ -139,6 +141,7 @@ public enum TW_Common_Proto_SigningError: SwiftProtobuf.Enum {
case .errorNoSupportN2N: return 20
case .errorSignaturesCount: return 21
case .errorInvalidParams: return 22
case .errorInvalidRequestedTokenAmount: return 23
case .UNRECOGNIZED(let i): return i
}
}
@ -173,6 +176,7 @@ extension TW_Common_Proto_SigningError: CaseIterable {
.errorNoSupportN2N,
.errorSignaturesCount,
.errorInvalidParams,
.errorInvalidRequestedTokenAmount,
]
}
@ -205,5 +209,6 @@ extension TW_Common_Proto_SigningError: SwiftProtobuf._ProtoNameProviding {
20: .same(proto: "Error_no_support_n2n"),
21: .same(proto: "Error_signatures_count"),
22: .same(proto: "Error_invalid_params"),
23: .same(proto: "Error_invalid_requested_token_amount"),
]
}

View File

@ -236,6 +236,14 @@ public struct TW_Polkadot_Proto_Staking {
set {messageOneof = .chill(newValue)}
}
public var chillAndUnbond: TW_Polkadot_Proto_Staking.ChillAndUnbond {
get {
if case .chillAndUnbond(let v)? = messageOneof {return v}
return TW_Polkadot_Proto_Staking.ChillAndUnbond()
}
set {messageOneof = .chillAndUnbond(newValue)}
}
public var unknownFields = SwiftProtobuf.UnknownStorage()
public enum OneOf_MessageOneof: Equatable {
@ -246,6 +254,7 @@ public struct TW_Polkadot_Proto_Staking {
case withdrawUnbonded(TW_Polkadot_Proto_Staking.WithdrawUnbonded)
case nominate(TW_Polkadot_Proto_Staking.Nominate)
case chill(TW_Polkadot_Proto_Staking.Chill)
case chillAndUnbond(TW_Polkadot_Proto_Staking.ChillAndUnbond)
#if !swift(>=4.1)
public static func ==(lhs: TW_Polkadot_Proto_Staking.OneOf_MessageOneof, rhs: TW_Polkadot_Proto_Staking.OneOf_MessageOneof) -> Bool {
@ -281,6 +290,10 @@ public struct TW_Polkadot_Proto_Staking {
guard case .chill(let l) = lhs, case .chill(let r) = rhs else { preconditionFailure() }
return l == r
}()
case (.chillAndUnbond, .chillAndUnbond): return {
guard case .chillAndUnbond(let l) = lhs, case .chillAndUnbond(let r) = rhs else { preconditionFailure() }
return l == r
}()
default: return false
}
}
@ -369,6 +382,18 @@ public struct TW_Polkadot_Proto_Staking {
public init() {}
}
public struct ChillAndUnbond {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
public var value: Data = Data()
public var unknownFields = SwiftProtobuf.UnknownStorage()
public init() {}
}
public struct Chill {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
@ -633,6 +658,7 @@ extension TW_Polkadot_Proto_Staking: SwiftProtobuf.Message, SwiftProtobuf._Messa
5: .standard(proto: "withdraw_unbonded"),
6: .same(proto: "nominate"),
7: .same(proto: "chill"),
8: .standard(proto: "chill_and_unbond"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
@ -732,6 +758,19 @@ extension TW_Polkadot_Proto_Staking: SwiftProtobuf.Message, SwiftProtobuf._Messa
self.messageOneof = .chill(v)
}
}()
case 8: try {
var v: TW_Polkadot_Proto_Staking.ChillAndUnbond?
var hadOneofValue = false
if let current = self.messageOneof {
hadOneofValue = true
if case .chillAndUnbond(let m) = current {v = m}
}
try decoder.decodeSingularMessageField(value: &v)
if let v = v {
if hadOneofValue {try decoder.handleConflictingOneOf()}
self.messageOneof = .chillAndUnbond(v)
}
}()
default: break
}
}
@ -771,6 +810,10 @@ extension TW_Polkadot_Proto_Staking: SwiftProtobuf.Message, SwiftProtobuf._Messa
guard case .chill(let v)? = self.messageOneof else { preconditionFailure() }
try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
}()
case .chillAndUnbond?: try {
guard case .chillAndUnbond(let v)? = self.messageOneof else { preconditionFailure() }
try visitor.visitSingularMessageField(value: v, fieldNumber: 8)
}()
case nil: break
}
try unknownFields.traverse(visitor: &visitor)
@ -1005,6 +1048,38 @@ extension TW_Polkadot_Proto_Staking.Nominate: SwiftProtobuf.Message, SwiftProtob
}
}
extension TW_Polkadot_Proto_Staking.ChillAndUnbond: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = TW_Polkadot_Proto_Staking.protoMessageName + ".ChillAndUnbond"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "value"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 1: try { try decoder.decodeSingularBytesField(value: &self.value) }()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if !self.value.isEmpty {
try visitor.visitSingularBytesField(value: self.value, fieldNumber: 1)
}
try unknownFields.traverse(visitor: &visitor)
}
public static func ==(lhs: TW_Polkadot_Proto_Staking.ChillAndUnbond, rhs: TW_Polkadot_Proto_Staking.ChillAndUnbond) -> Bool {
if lhs.value != rhs.value {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
extension TW_Polkadot_Proto_Staking.Chill: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = TW_Polkadot_Proto_Staking.protoMessageName + ".Chill"
public static let _protobuf_nameMap = SwiftProtobuf._NameMap()

View File

@ -0,0 +1,15 @@
// Copyright © 2017-2022 Trust Wallet.
//
// This file is part of Trust. The full Trust copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
// file LICENSE at the root of the source code distribution tree.
import Foundation
public func CardanoMinAdaAmount(tokenBundle: Data) -> UInt64 {
let tokenBundleData = TWDataCreateWithNSData(tokenBundle)
defer {
TWDataDelete(tokenBundleData)
}
return TWCardanoMinAdaAmount(tokenBundleData)
}

View File

@ -48,10 +48,9 @@ enum TWBlockchain {
TWBlockchainDecred = 35, // Bitcoin
TWBlockchainZcash = 36, // Bitcoin
TWBlockchainGroestlcoin = 37, // Bitcoin
TWBlockchainNativeEvmos = 38, // Cosmos
TWBlockchainThorchain = 39, // Cosmos
TWBlockchainRonin = 40, // Ethereum
TWBlockchainKusama = 41, // Polkadot
TWBlockchainThorchain = 38, // Cosmos
TWBlockchainRonin = 39, // Ethereum
TWBlockchainKusama = 40, // Polkadot
};
TW_EXTERN_C_END

View File

@ -0,0 +1,22 @@
// Copyright © 2017-2022 Trust Wallet.
//
// This file is part of Trust. The full Trust copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
// file LICENSE at the root of the source code distribution tree.
#pragma once
#include "TWBase.h"
#include "TWData.h"
TW_EXTERN_C_BEGIN
TW_EXPORT_STRUCT
struct TWCardano;
// The minimum ADA amount needed for a UTXO. See https://docs.cardano.org/native-tokens/minimum-ada-value-requirement
// Input is serialized TokenBundle protobuf object.
TW_EXPORT_STATIC_METHOD
uint64_t TWCardanoMinAdaAmount(TWData *_Nonnull tokenBundle) TW_VISIBILITY_DEFAULT;
TW_EXTERN_C_END

View File

@ -14,6 +14,7 @@ typedef TWData *_Nonnull TW_Cardano_Proto_OutPoint;
typedef TWData *_Nonnull TW_Cardano_Proto_TokenAmount;
typedef TWData *_Nonnull TW_Cardano_Proto_TxInput;
typedef TWData *_Nonnull TW_Cardano_Proto_TxOutput;
typedef TWData *_Nonnull TW_Cardano_Proto_TokenBundle;
typedef TWData *_Nonnull TW_Cardano_Proto_Transfer;
typedef TWData *_Nonnull TW_Cardano_Proto_TransactionPlan;
typedef TWData *_Nonnull TW_Cardano_Proto_SigningInput;

View File

@ -1,4 +1,4 @@
// Copyright © 2017-2021 Trust Wallet.
// Copyright © 2017-2022 Trust Wallet.
//
// This file is part of Trust. The full Trust copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
@ -106,6 +106,8 @@ enum TWCoinType {
TWCoinTypeAurora = 1323161554,
TWCoinTypeEvmos = 10009001,
TWCoinTypeNativeEvmos = 20009001,
TWCoinTypeMoonriver = 10001285,
TWCoinTypeMoonbeam = 10001284,
};
/// Returns the blockchain for a coin type.
@ -162,6 +164,10 @@ uint8_t TWCoinTypeP2shPrefix(enum TWCoinType coin);
TW_EXPORT_PROPERTY
uint8_t TWCoinTypeStaticPrefix(enum TWCoinType coin);
/// ChainID for this coin type. Caller must free return object.
TW_EXPORT_PROPERTY
TWString* _Nonnull TWCoinTypeChainId(enum TWCoinType coin);
/// SLIP-0044 id for this coin type
TW_EXPORT_PROPERTY
uint32_t TWCoinTypeSlip44Id(enum TWCoinType coin);

View File

@ -1,8 +1,11 @@
// Copyright © 2017-2020 Trust Wallet.
// Copyright © 2017-2022 Trust Wallet.
//
// This file is part of Trust. The full Trust copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
// file LICENSE at the root of the source code distribution tree.
//
// This is a GENERATED FILE from \registry.json, changes made here WILL BE LOST.
//
#pragma once
@ -10,35 +13,38 @@
TW_EXTERN_C_BEGIN
/// Chain identifier for Ethereum-based blockchains.
/// Chain identifiers for Ethereum-based blockchains, for convenience. Recommended to use the dynamic CoinType.ChainId() instead.
/// See also TWChainId.
TW_EXPORT_ENUM(uint32_t)
enum TWEthereumChainID {
TWEthereumChainIDEthereum = 1,
TWEthereumChainIDGo = 60,
TWEthereumChainIDPOA = 99,
TWEthereumChainIDClassic = 61,
TWEthereumChainIDPoa = 99,
TWEthereumChainIDVechain = 74,
TWEthereumChainIDCallisto = 820,
TWEthereumChainIDEthereumClassic = 61,
TWEthereumChainIDVeChain = 74,
TWEthereumChainIDThunderToken = 108,
TWEthereumChainIDTomoChain = 88,
TWEthereumChainIDBinanceSmartChain = 56,
TWEthereumChainIDTomochain = 88,
TWEthereumChainIDPolygon = 137,
TWEthereumChainIDWanchain = 888,
TWEthereumChainIDOptimism = 10,
TWEthereumChainIDArbitrum = 42161,
TWEthereumChainIDHeco = 128,
TWEthereumChainIDAvalanche = 43114,
TWEthereumChainIDXDai = 100,
TWEthereumChainIDFantom = 250,
TWEthereumChainIDThundertoken = 108,
TWEthereumChainIDGochain = 60,
TWEthereumChainIDCelo = 42220,
TWEthereumChainIDRonin = 2020,
TWEthereumChainIDWanchain = 888,
TWEthereumChainIDCronos = 25,
TWEthereumChainIDSmartBitcoinCash = 10000,
TWEthereumChainIDKuCoinCommunityChain = 321,
TWEthereumChainIDOptimism = 10,
TWEthereumChainIDXdai = 100,
TWEthereumChainIDSmartbch = 10000,
TWEthereumChainIDFantom = 250,
TWEthereumChainIDBoba = 288,
TWEthereumChainIDKcc = 321,
TWEthereumChainIDHeco = 128,
TWEthereumChainIDMetis = 1088,
TWEthereumChainIDAurora = 1313161554,
TWEthereumChainIDMoonbeam = 1284,
TWEthereumChainIDMoonriver = 1285,
TWEthereumChainIDRonin = 2020,
TWEthereumChainIDAvalanchec = 43114,
TWEthereumChainIDEvmos = 9001,
TWEthereumChainIDArbitrum = 42161,
TWEthereumChainIDSmartchain = 56,
TWEthereumChainIDAurora = 1313161554,
};
TW_EXTERN_C_END