Skip to content

Commit

Permalink
all files
Browse files Browse the repository at this point in the history
  • Loading branch information
zanyfly committed Jul 25, 2024
1 parent a9900c1 commit 2f67249
Show file tree
Hide file tree
Showing 195 changed files with 20,471 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Create documentation

on:
push:
branches: [ main ]
paths:
- 'Sources/**/*'

jobs:
docs:
runs-on: macos-12
steps:
- uses: actions/checkout@v3

- uses: fwcd/swift-docc-action@v1
with:
target: SolanaSwift
output: ./docs
hosting-base-path: solana-swift
disable-indexing: 'true'
transform-for-static-hosting: 'true'

- name: Init new repo for docs
run: |
cd docs
git init
git add -A
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m 'deploy'
- name: Force push to destination branch
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: docs
force: true
directory: ./docs
26 changes: 26 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Run unit test

on:
pull_request:
branches:
- 'main'

jobs:
unit-test:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Run tests
run: swift test --filter "SolanaSwiftUnitTests" --enable-code-coverage
- name: Processing converage data
run: |
xcrun llvm-cov export -format="lcov" .build/debug/SolanaSwiftPackageTests.xctest/Contents/MacOS/SolanaSwiftPackageTests -instr-profile .build/debug/codecov/default.profdata > info.lcov
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: ./info.lcov # optional
flags: unittests # optional
name: codecov-umbrella # optional
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
23 changes: 23 additions & 0 deletions .github/workflows/upversion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Up version

on:
workflow_dispatch:
inputs:
version:
description: 'Version'
required: true

jobs:
upversion:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}

- name: upversion
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
run: |
brew install gnu-sed
./upversion ${{ github.event.inputs.version }}
45 changes: 45 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# OS X
.DS_Store

# Xcode
build/
.build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
*.xccheckout
profile
*.moved-aside
DerivedData
*.hmap
*.ipa

# Bundler
.bundle

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

Carthage/Build

# Swift package manager
.swiftpm

# 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-ignore-the-pods-directory-in-source-control
#
# Note: if you ignore the Pods directory, make sure to uncomment
# `pod install` in .travis.yml
#
# Pods/
OrcaSwapTransitiveTests-Secret.swift

.build
.idea
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# references:
# * https://www.objc.io/issues/6-build-tools/travis-ci/
# * https://github.com/supermarin/xcpretty#usage

osx_image: xcode7.3
language: swift
# cache: cocoapods
# podfile: Example/Podfile
# before_install:
# - gem install cocoapods # Since Travis is not always on latest version
# - pod install --project-directory=Example
script:
- set -o pipefail && xcodebuild test -enableCodeCoverage YES -workspace Example/SolanaSwift.xcworkspace -scheme SolanaSwift-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty
- pod lib lint
110 changes: 110 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
## 5.0.0

- Fix TokenMetadata encoding, tags.
- Remove deprecated PublicKey.tokenProgramId, use TokenProgram.id instead.
- Remove deprecated PublicKey.programId, use SystemProgram.id instead.
- Remove deprecated PublicKey.ownerValidationProgramId, use OwnerValidationProgram.id instead.
- Remove deprecated PublicKey.splAssociatedTokenAccountProgramId, use AssociatedTokenProgram.id instead.
- Remove deprecated typealias AccountInfo, use TokenAccountState or Token2022AccountState instead.
- Remove deprecated typealias Mint, use TokenMintState or Token2022MintState instead.
- Remove deprecated typealias Wallet, use AccountBalance instead.
- Support token 2022 via method getAccountBalances (See GetAccountBalancesTests).
- Support token 2022 and Token2022Program.

## 4.0.0

- Rename Wallet to AccountBalance.
- Remove comment headers
- Do swiftformat entire codebase
- Change target to iOS 15, tvOS 11, watchOS 4
- Rename TransactionStatus to PendingTransactionStatus
- Rename Mint to SPLTokenMintState
- Rename AccountInfo to SPLTokenAccountState
- Remove SolanaError and split it into separated error types like PublicKeyError, TransactionConfirmationError, BlockchainClientError, BinaryReaderError, BorshCodableError, KeyPairError, VersionedMessageError, VersionedTransactionError.
- Remove DeserializationError and migrate them to BorshCodableError.
- Add transactionSimulationError, couldNotRetrieveAccountInfo & blockhashNotFound cases into APIClientError.
- Rename Mnemomic.Error into MnemonicError.
- Rename Ed25519HDKey.Error to Ed25519HDKeyError.
- Remove getTokenWallets method (should be done in client)
- Remove some methods in Error+Extensions.
- Rename Token to TokenMetadata.
- Rename Token.address to Token.mintAddress.
...

## 3.0.0

- Change iconUrl of some tokens
- Fix decoding for ConfirmedTransaction
- Add support additional params for socket
- Conform PreparedTransaction to Equatable
- Rename Account to KeyPair and deprecated Account
- Public some structs
- Fix decimal for USDC from 8 to 6
- Add empty init for KeyPair
- Add test for SendTransaction
- Add support Commitment in getTokenWallets
- Add support for VersionedTransaction

## 2.5.3

- Add rpc method getRecentPerformanceSamples
- Change tokens repository endpoint

## 2.5.2

- Add convenience variables for common tokens (ETH, USDT)
- Make signing in method prepare transaction optional if signers is not provided

## 2.5.1

- Add supply property for struct Wallet

## 2.5.0

- Add usdc to TokenList
- Add slot info to TransactionStatus
- Add option skipPreflight to RequestModels

## 2.4.0

- Replacing LoggerSwift with abstraction

## 2.3.0

- Added support for socket encoding response

## 2.2.2

- Update coingeko id for SOL and renBTC

## 2.2.1

- Publish init SendingTransaction with Signature
- Fix batch loading with zero and one element

## 2.2.0

- Improve batch loading with same request type

## 2.1.3

- Fix message deserialization
- Add partial sign

## 2.1.0

- Fix `prepareForSendingNativeSOL`
- Enable testnet only on debug

## 2.0.1

- Update documentation
- Update `Task_retrying`

## 2.0.0

- Migrate to swift concurrency

## 1.0.0

- Release library
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2020 P2P Economy Limited

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
52 changes: 52 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"object": {
"pins": [
{
"package": "secp256k1",
"repositoryURL": "https://github.com/Boilertalk/secp256k1.swift.git",
"state": {
"branch": null,
"revision": "cd187c632fb812fd93711a9f7e644adb7e5f97f0",
"version": "0.1.7"
}
},
{
"package": "SwiftDocCPlugin",
"repositoryURL": "https://github.com/apple/swift-docc-plugin",
"state": {
"branch": null,
"revision": "9b1258905c21fc1b97bf03d1b4ca12c4ec4e5fda",
"version": "1.2.0"
}
},
{
"package": "SymbolKit",
"repositoryURL": "https://github.com/apple/swift-docc-symbolkit",
"state": {
"branch": null,
"revision": "b45d1f2ed151d057b54504d653e0da5552844e34",
"version": "1.0.0"
}
},
{
"package": "Task_retrying",
"repositoryURL": "https://github.com/bigearsenal/task-retrying-swift.git",
"state": {
"branch": null,
"revision": "208f1e8dfa93022a7d39ab5b334d5f43a934d4b1",
"version": "2.0.0"
}
},
{
"package": "TweetNacl",
"repositoryURL": "https://github.com/bitmark-inc/tweetnacl-swiftwrap.git",
"state": {
"branch": null,
"revision": "f8fd111642bf2336b11ef9ea828510693106e954",
"version": "1.1.0"
}
}
]
},
"version": 1
}
49 changes: 49 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// swift-tools-version:5.7.1

import PackageDescription

let package = Package(
name: "SolanaSwift",
platforms: [
.macOS(.v10_15),
.iOS(.v15),
.tvOS(.v11),
.watchOS(.v4),
],
products: [
.library(
name: "SolanaSwift",
targets: ["SolanaSwift"]
),
],
dependencies: [
// Main depedencies
.package(url: "https://github.com/Boilertalk/secp256k1.swift.git", from: "0.1.0"),
.package(url: "https://github.com/bitmark-inc/tweetnacl-swiftwrap.git", from: "1.0.2"),
.package(url: "https://github.com/bigearsenal/task-retrying-swift.git", from: "2.0.0"),

// Docs generator
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
],
targets: [
.target(
name: "SolanaSwift",
dependencies: [
.product(name: "secp256k1", package: "secp256k1.swift"),
.product(name: "TweetNacl", package: "tweetnacl-swiftwrap"),
.product(name: "Task_retrying", package: "task-retrying-swift"),
]
),
.testTarget(
name: "SolanaSwiftUnitTests",
dependencies: ["SolanaSwift"],
resources: [
.process("Resources/get_all_tokens_info.json"),
]
),
.testTarget(
name: "SolanaSwiftIntegrationTests",
dependencies: ["SolanaSwift"]
),
]
)
Loading

0 comments on commit 2f67249

Please sign in to comment.