Skip to content

Commit

Permalink
make block number optional
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Oct 9, 2024
1 parent a2d472a commit 63b79e1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
6 changes: 5 additions & 1 deletion Sources/XMTPiOS/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,11 @@ public final class Client {
do {
let signedData = try await signingKey.sign(message: signatureRequest.signatureText())
if signingKey.isSmartContractWallet {
try await signatureRequest.addScwSignature(signatureBytes: signedData.rawData, address: signingKey.address, chainId: signingKey.chainId, blockNumber: signingKey.blockNumber)
try await signatureRequest.addScwSignature(signatureBytes: signedData.rawData,
address: signingKey.address,
chainId: UInt64(signingKey.chainId),
blockNumber: signingKey.blockNumber.flatMap { $0 >= 0 ? UInt64($0) : nil })

} else {
try await signatureRequest.addEcdsaSignature(signatureBytes: signedData.rawData)
}
Expand Down
10 changes: 5 additions & 5 deletions Sources/XMTPiOS/SigningKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public protocol SigningKey {
var isSmartContractWallet: Bool { get }

/// The name of the chainId for example "1"
var chainId: UInt64 { get }
var chainId: Int64 { get }

/// The blockNumber of the chain for example "1"
var blockNumber: UInt64 { get }
var blockNumber: Int64? { get }

/// Sign the data and return a secp256k1 compact recoverable signature.
func sign(_ data: Data) async throws -> Signature
Expand All @@ -42,12 +42,12 @@ extension SigningKey {
return false
}

public var chainId: UInt64 {
public var chainId: Int64 {
return 1
}

public var blockNumber: UInt64 {
return 1
public var blockNumber: Int64? {
return nil
}

func createIdentity(_ identity: PrivateKey, preCreateIdentityCallback: PreEventCallback? = nil) async throws -> AuthorizedIdentity {
Expand Down
2 changes: 1 addition & 1 deletion XMTP.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |spec|
#

spec.name = "XMTP"
spec.version = "0.15.1"
spec.version = "0.15.1-alpha0"
spec.summary = "XMTP SDK Cocoapod"

# This description is used to generate tags and improve search results.
Expand Down

0 comments on commit 63b79e1

Please sign in to comment.