Skip to content

Commit

Permalink
Organize files and folders
Browse files Browse the repository at this point in the history
  • Loading branch information
André Vants committed Jul 28, 2022
1 parent a7e7273 commit 48390fd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
5 changes: 5 additions & 0 deletions Sources/WalletConnectRelay/RPC/RPCMethod.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
protocol RPCMethod {
associatedtype Parameters
var method: String { get }
var params: Parameters { get }
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import JSONRPC

protocol RPCMethod {
associatedtype Parameters
var method: String { get }
var params: Parameters { get }
}

protocol RelayRPC: RPCMethod {}

extension RelayRPC where Parameters: Codable {
Expand All @@ -16,7 +10,10 @@ extension RelayRPC where Parameters: Codable {

func wrapToIridium() -> PrefixDecorator<Self> {
return PrefixDecorator(rpcMethod: self, prefix: "iridium")
// return PrefixDecorator.iridium(rpcMethod: self)
}

func wrapToIRN() -> PrefixDecorator<Self> {
return PrefixDecorator(rpcMethod: self, prefix: "irn")
}

func asRPCRequest() -> RPCRequest {
Expand All @@ -39,16 +36,3 @@ struct PrefixDecorator<T>: RelayRPC where T: RelayRPC {
rpcMethod.params
}
}


// TODO: Move
import Foundation

struct WalletConnectRPCID: IdentifierGenerator {

func next() -> RPCID {
let timestamp = Int64(Date().timeIntervalSince1970 * 1000) * 1000
let random = Int64.random(in: 0..<1000)
return .right(Int(timestamp + random))
}
}
11 changes: 11 additions & 0 deletions Sources/WalletConnectRelay/RPC/WalletConnectRPCID.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Foundation
import JSONRPC

struct WalletConnectRPCID: IdentifierGenerator {

func next() -> RPCID {
let timestamp = Int64(Date().timeIntervalSince1970 * 1000) * 1000
let random = Int64.random(in: 0..<1000)
return .right(Int(timestamp + random))
}
}

0 comments on commit 48390fd

Please sign in to comment.