Skip to content

Commit

Permalink
Merge pull request #1 from tkey/feat/tx-signing
Browse files Browse the repository at this point in the history
Feat/tx signing
  • Loading branch information
himanshuchawla009 authored Sep 5, 2023
2 parents 730a5ac + 75247e8 commit 206ae41
Show file tree
Hide file tree
Showing 11 changed files with 810 additions and 1 deletion.
Binary file added .DS_Store
Binary file not shown.
24 changes: 24 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
on:
push:
branches:
- main
pull_request:
types:
- opened
- reopened
- synchronize

jobs:
test:
runs-on: macos-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "14.2.0"
- name: package
run: xcodebuild test -scheme Web3SwiftMpcProvider -destination "platform=iOS Simulator,OS=16.2,name=iPhone 14" COMPILER_INDEX_STORE_ENABLE=NO
- name: SwiftLint
run: swiftlint lint ./Sources --reporter github-actions-logging
97 changes: 97 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
.DS_Store
/.build
/Packages
/*.xcodeproj
xcuserdata/
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## User settings
xcuserdata/

## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout

## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
build/
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3

## Obj-C/Swift specific
*.hmap

## App packaging
*.ipa
*.dSYM.zip
*.dSYM

## Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
# Package.resolved
# *.xcodeproj
#
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
# hence it is not needed unless you have added a package configuration file to your project
.swiftpm/

.build/

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
Pods/
#
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build/

# Accio dependency management
Dependencies/
.accio/

# fastlane
#
# It is recommended to not store the screenshots in the git repo.
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output

# Code Injection
#
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/
.idea
.DS_Store
151 changes: 151 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
{
"object": {
"pins": [
{
"package": "BigInt",
"repositoryURL": "https://github.com/attaswift/BigInt.git",
"state": {
"branch": null,
"revision": "0ed110f7555c34ff468e72e1686e59721f2b0da6",
"version": "5.3.0"
}
},
{
"package": "CryptoSwift",
"repositoryURL": "https://github.com/krzyzanowskim/CryptoSwift.git",
"state": {
"branch": null,
"revision": "32f641cf24fc7abc1c591a2025e9f2f572648b0f",
"version": "1.7.2"
}
},
{
"package": "GenericJSON",
"repositoryURL": "https://github.com/iwill/generic-json-swift",
"state": {
"branch": null,
"revision": "0a06575f4038b504e78ac330913d920f1630f510",
"version": "2.0.2"
}
},
{
"package": "secp256k1",
"repositoryURL": "https://github.com/GigaBitcoin/secp256k1.swift.git",
"state": {
"branch": null,
"revision": "1a14e189def5eaa92f839afdd2faad8e43b61a6e",
"version": "0.12.2"
}
},
{
"package": "SocketIO",
"repositoryURL": "https://github.com/socketio/socket.io-client-swift",
"state": {
"branch": null,
"revision": "af5ce97b755d964235348d96f6db5cbdcbe334a5",
"version": "16.0.1"
}
},
{
"package": "Starscream",
"repositoryURL": "https://github.com/daltoniam/Starscream",
"state": {
"branch": null,
"revision": "df8d82047f6654d8e4b655d1b1525c64e1059d21",
"version": "4.0.4"
}
},
{
"package": "swift-atomics",
"repositoryURL": "https://github.com/apple/swift-atomics.git",
"state": {
"branch": null,
"revision": "6c89474e62719ddcc1e9614989fff2f68208fe10",
"version": "1.1.0"
}
},
{
"package": "swift-collections",
"repositoryURL": "https://github.com/apple/swift-collections.git",
"state": {
"branch": null,
"revision": "937e904258d22af6e447a0b72c0bc67583ef64a2",
"version": "1.0.4"
}
},
{
"package": "swift-log",
"repositoryURL": "https://github.com/apple/swift-log.git",
"state": {
"branch": null,
"revision": "532d8b529501fb73a2455b179e0bbb6d49b652ed",
"version": "1.5.3"
}
},
{
"package": "swift-nio",
"repositoryURL": "https://github.com/apple/swift-nio.git",
"state": {
"branch": null,
"revision": "cf281631ff10ec6111f2761052aa81896a83a007",
"version": "2.58.0"
}
},
{
"package": "swift-nio-extras",
"repositoryURL": "https://github.com/apple/swift-nio-extras.git",
"state": {
"branch": null,
"revision": "0e0d0aab665ff1a0659ce75ac003081f2b1c8997",
"version": "1.19.0"
}
},
{
"package": "swift-nio-ssl",
"repositoryURL": "https://github.com/apple/swift-nio-ssl.git",
"state": {
"branch": null,
"revision": "320bd978cceb8e88c125dcbb774943a92f6286e9",
"version": "2.25.0"
}
},
{
"package": "swift-nio-transport-services",
"repositoryURL": "https://github.com/apple/swift-nio-transport-services.git",
"state": {
"branch": null,
"revision": "e7403c35ca6bb539a7ca353b91cc2d8ec0362d58",
"version": "1.19.0"
}
},
{
"package": "tss-client-swift",
"repositoryURL": "https://github.com/torusresearch/tss-client-swift.git",
"state": {
"branch": null,
"revision": "a5f54880550d7c0f2979e06290a1ac0941626b3f",
"version": "1.0.12"
}
},
{
"package": "web3.swift",
"repositoryURL": "https://github.com/argentlabs/web3.swift",
"state": {
"branch": null,
"revision": "8ca33e700ed8de6137a0e1471017aa3b3c8de0db",
"version": "1.6.0"
}
},
{
"package": "websocket-kit",
"repositoryURL": "https://github.com/vapor/websocket-kit.git",
"state": {
"branch": null,
"revision": "53fe0639a98903858d0196b699720decb42aee7b",
"version": "2.14.0"
}
}
]
},
"version": 1
}
31 changes: 31 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// swift-tools-version: 5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "Web3SwiftMpcProvider",
platforms: [.iOS(.v14)],
products: [
.library(
name: "Web3SwiftMpcProvider",
targets: ["Web3SwiftMpcProvider"]),

],
dependencies: [
.package(url: "https://github.com/argentlabs/web3.swift", from:"1.6.0"),
.package(url: "https://github.com/torusresearch/tss-client-swift.git", from: "1.0.12"),
],
targets: [
.target(
name: "Web3SwiftMpcProvider",
dependencies: ["web3.swift", "tss-client-swift"],
path: "Sources/Web3SwiftMpcProvider"
),
.testTarget(
name: "Web3SwiftMpcProviderTests",
dependencies: ["Web3SwiftMpcProvider"],
path: "Tests"),
],
swiftLanguageVersions: [.v5]
)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# mpc-signing-provider-swift
# MpcProvider

A description of this package.
Binary file added Sources/.DS_Store
Binary file not shown.
42 changes: 42 additions & 0 deletions Sources/Web3SwiftMpcProvider/EthTssAccountParams.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
public final class EthTssAccountParams {
private(set) var publicKey: String
private(set) var factorKey: String
private(set) var tssNonce: Int32
private(set) var tssShare: String
private(set) var tssIndex: String
private(set) var selectedTag: String
private(set) var verifier: String
private(set) var verifierID: String
private(set) var nodeIndexes: [Int]
private(set) var tssEndpoints: [String]
private(set) var authSigs: [String]
/// Instantiates EthTssAccountParams which are used to instantiate an EtheriumTssAccount
///
/// - Parameters:
/// - publicKey : Public key for the account, EtheriumAddress is derived from this.
/// - factorKey: The factor key
/// - tssNonce: The current tss nonce
/// - tssShare: The current tss share
/// - tssIndex: The index corresponding to the tssShare
/// - selectedTag: The current tss tag
/// - verifier: The verifier for the account
/// - verifierID: The identifier for the account
/// - nodeIndexes: The node indexes returned form the sapphire network
/// - tssEndpoints: The tss endpoints for the sapphire network
/// - authSigs: The signatures returned for the sapphire network
///

Check warning on line 27 in Sources/Web3SwiftMpcProvider/EthTssAccountParams.swift

View workflow job for this annotation

GitHub Actions / test

A doc comment should be attached to a declaration (orphaned_doc_comment)
// swiftlint:disable:next line_length
public init(publicKey: String, factorKey: String, tssNonce: Int32, tssShare: String, tssIndex: String, selectedTag: String, verifier: String, verifierID: String, nodeIndexes: [Int], tssEndpoints: [String], authSigs: [String]) {
self.publicKey = publicKey
self.factorKey = factorKey
self.tssNonce = tssNonce
self.tssShare = tssShare
self.tssIndex = tssIndex
self.selectedTag = selectedTag
self.verifier = verifier
self.verifierID = verifierID
self.nodeIndexes = nodeIndexes
self.tssEndpoints = tssEndpoints
self.authSigs = authSigs
}
}
Loading

0 comments on commit 206ae41

Please sign in to comment.