Git Product home page Git Product logo

feerelayerswift's Introduction

FeeRelayerSwift

[![CI Status](https://img.shields.io/travis/Chung Tran/FeeRelayerSwift.svg?style=flat)](https://travis-ci.org/Chung Tran/FeeRelayerSwift) Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

FeeRelayerSwift is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'FeeRelayerSwift', :git => 'https://github.com/p2p-org/FeeRelayerSwift.git'

Tests

RelayTests

To run relay tests, create a valid file with name relay-tests.json inside Tests/Resources, contains following content (without comments):

{
    "topUp": {
        "endpoint": <String>, // Solana api endpoint
        "endpointAdditionalQuery": <String?>,
        "seedPhrase": <String>, // Solana account seed phrase
        "payingTokenMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
        "payingTokenAddress": "mCZrAFuPfBDPUW45n5BSkasRLpPZpmqpY7vs3XSYE7x",
        "amount": 10000
    },
    "solToSPL": {
        "endpoint": <String>, // Solana api endpoint
        "endpointAdditionalQuery": <String?>,
        "seedPhrase": <String>, // Solana account seed phrase
        "fromMint": "So11111111111111111111111111111111111111112",
        "toMint": "2Kc38rfQ49DFaKHQaWbijkE7fcymUMLY5guUiUsDmFfn",
        "sourceAddress": <String>,
        "destinationAddress": <String>,
        "payingTokenMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
        "payingTokenAddress": <String>,
        "inputAmount": 100000,
        "slippage": 0.2,
        "comment": "Swap 0.0001 SOL to KURO paid with USDC"
    },
    "splToSOL": {
        "endpoint": <String>, // Solana api endpoint
        "endpointAdditionalQuery": <String?>,
        "seedPhrase": <String>, // Solana account seed phrase
        "fromMint": <String>,
        "toMint": "So11111111111111111111111111111111111111112",
        "sourceAddress": <String>,
        "destinationAddress": <String>,
        "payingTokenMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
        "payingTokenAddress": <String>,
        "inputAmount": 10000000,
        "slippage": 0.2,
        "comment": "Swap 10 KURO to SOL paid with USDC"
    },
    "splToCreatedSpl": {
        "endpoint": <String>, // Solana api endpoint
        "endpointAdditionalQuery": <String?>,
        "seedPhrase": <String>, // Solana account seed phrase
        "fromMint": <String>, // Mint of token that you want to swap from
        "toMint": <String>, // Mint of token that you want to swap to
        "sourceAddress": <String>, // Source token address
        "destinationAddress": <String?>, // Destination token address
        "payingTokenMint": <String>, // Mint of token that you want to use to pay fee
        "payingTokenAddress": <String>, // Address of token that have enough balance to cover fee
        "inputAmount": 1000000, // Input amount in lamports
        "slippage": 0.05
    },
    "splToNonCreatedSpl": {
        "endpoint": <String>, // Solana api endpoint
        "endpointAdditionalQuery": <String?>,
        "seedPhrase": <String>, // Solana account seed phrase
        "fromMint": <String>, // Mint of token that you want to swap from
        "toMint": <String>, // Mint of token that you want to swap to
        "sourceAddress": <String>, // Source token address
        "destinationAddress": null, // Destination token address
        "payingTokenMint": <String>, // Mint of token that you want to use to pay fee
        "payingTokenAddress": <String>, // Address of token that have enough balance to cover fee
        "inputAmount": 1000000, // Input amount in lamports
        "slippage": 0.05
    },
    "usdtTransfer": { // relay_transfer_spl_token
        "endpoint": <String>, // Solana api endpoint
        "endpointAdditionalQuery": <String?>,
        "seedPhrase": <String>, // Solana account seed phrase
        "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
        "sourceTokenAddress": "mCZrAFuPfBDPUW45n5BSkasRLpPZpmqpY7vs3XSYE7x",
        "destinationAddress": "9BDAsqBpawnEmaJnMJo8NPqyL8HrT6AdujnuFsy4m8sj",
        "inputAmount": 100,
        "payingTokenAddress": "mCZrAFuPfBDPUW45n5BSkasRLpPZpmqpY7vs3XSYE7x",
        "payingTokenMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
    },
    "usdtBackTransfer": { // relay_transfer_spl_token
        "endpoint": <String>, // Solana api endpoint
        "endpointAdditionalQuery": <String?>,
        "seedPhrase": <String>, // Solana account seed phrase
        "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
        "sourceTokenAddress": "9BDAsqBpawnEmaJnMJo8NPqyL8HrT6AdujnuFsy4m8sj",
        "destinationAddress": "mCZrAFuPfBDPUW45n5BSkasRLpPZpmqpY7vs3XSYE7x",
        "inputAmount": 100,
        "payingTokenAddress": "9BDAsqBpawnEmaJnMJo8NPqyL8HrT6AdujnuFsy4m8sj",
        "payingTokenMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
    },
    "usdtTransferToNonCreatedToken": {
        "endpoint": <String>, // Solana api endpoint
        "endpointAdditionalQuery": <String?>,
        "seedPhrase": <String>, // Solana account seed phrase
        "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
        "sourceTokenAddress": "9BDAsqBpawnEmaJnMJo8NPqyL8HrT6AdujnuFsy4m8sj",
        "destinationAddress": "7hTyqUwMQF24B63M4vRzjYGsJ5VBiL7WiSZJ29LQQwE8",
        "inputAmount": 100,
        "expectedFee": 10000,
        "payingTokenAddress": "9BDAsqBpawnEmaJnMJo8NPqyL8HrT6AdujnuFsy4m8sj",
        "payingTokenMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
    },
    "relaySendNativeSOL": { // relay_transaction
                "endpoint": <String>, // Solana api endpoint
        "endpointAdditionalQuery": <String?>,
        "seedPhrase": <String>, // Solana account seed phrase
        "destinationAddress": <String?>, // Destination token address
        "inputAmount": 1000000, // Input amount in lamports
        "payingTokenMint": <String>, // Mint of token that you want to use to pay fee
        "payingTokenAddress": <String>, // Address of token that have enough balance to cover fee
    }
}

Author

Chung Tran, [email protected]

License

FeeRelayerSwift is available under the MIT license. See the LICENSE file for more info.

feerelayerswift's People

Contributors

bigearsenal avatar trgilong avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.