GithubHelp home page GithubHelp logo

metaplex-foundation / solana.swift Goto Github PK

View Code? Open in Web Editor NEW
158.0 3.0 66.0 3.01 MB

This is a open source library on pure swift for Solana protocol.

License: MIT License

Swift 99.79% Ruby 0.21%
solana swift spm library ios macos sol

solana.swift's Introduction

⛓️ Solana.Swift

Swift MIT Licence Swift Package Manager compatible

Solana.Swift is a Swift library for signing transactions and interacting with Programs in the Solana Network.

Web3.swift supports iOS, macOS, tvOS, watchOS and Linux with Swift Package Manager. Solana.Swift was built with modularity, portability, speed and efficiency in mind.

Features

  • Sign and send transactions.
  • Key pair generation
  • RPC configuration.
  • SPM integration
  • Fewer libraries requirement (TweetNACL, Starscream, secp256k1).
  • Fully tested (53%)
  • Sockets
  • Await/Async Support
  • Bip39 seed phrase support

Requirements

  • iOS 11.0+ / macOS 10.12+ / tvOS 11.0+ / watchOS 3.0+
  • Swift 5.3+

Installation

Solana.Swift is compatible with Swift Package Manager v5 (Swift 5 and above). Simply add it to the dependencies in your Package.swift.

From Xcode, you can use Swift Package Manager to add Solana.swift to your project.

  • File > Swift Packages > Add Package Dependency
  • Add https://github.com/metaplex-foundation/Solana.Swift
  • Select "brach" with "master"
  • Select Solana

If you encounter any problem or have a question about adding the package to an Xcode project, I suggest reading the [Adding Package Dependencies to Your App guide article from Apple.

Should Look like this

dependencies: [
    .package(name: "Solana", url: "https://github.com/metaplex-foundation/Solana.Swift.git", branch: "2.0.1"),
]
targets: [
    .target(
        name: "MyProject",
        dependencies: ["Solana"]
    ),
    .testTarget(
        name: "MyProjectTests",
        dependencies: ["MyProject"])
]

Usage

Initialization

Set the NetworkingRouter and set up your environment. You can also pass your URLSession with your settings. Use this router to initialize the SDK.

let endpoint = RPCEndpoint.devnetSolana
let router = NetworkingRouter(endpoint: endpoint)
let solana = Solana(router: router)

Signers or Accounts

The library provides an Signer protocol that acts as the signer for any operation. This account allows any client to implement their Wallet architecture and storage. Keep in mind that the secretKey is not handled by the protocol that's up to the implementation.

public protocol Signer {
    var publicKey: PublicKey { get }
    func sign(serializedMessage: Data) throws -> Data
}

An example implementation can be a HotAccount. Solana.Swift comes with HotAccount which allows the creation and recovery from a standard Solana Mnemonic. This implementation does provide a secretKey object. The secretKey is held on a variable keep in mind that this might now be a secure way of permanent storage.

public struct HotAccount: Signer {
    public let phrase: [String]
    public let publicKey: PublicKey
    public let secretKey: Data
    ...
}

Create Hot Account.

let account = HotAccount()

Create Hot Account from the seed phrase.

let phrase12 = "miracle pizza supply useful steak border same again youth silver access hundred".components(separatedBy: " ")
let account12 = HotAccount(phrase: phrase12)

Create a HotAccount from bip32Deprecated("m/501'") seed phrase. Yes, we support Wallet Index and several accounts from the same Mnemonic. This is helpful for wallet creation.

let phrase24 = "hint begin crowd dolphin drive render finger above sponsor prize runway invest dizzy pony bitter trial ignore crop please industry hockey wire use side".components(separatedBy: " ")
let account24 = HotAccount(phrase: phrase24, derivablePath: DerivablePath( 
        type: .bip32Deprecated,
        walletIndex: 0,
        accountIndex: 0
    )
)

It also supports bip44, bip44Change("m/44'/501'")

Seed Phrase Generation

Solana.Swift comes with Bip39 support. Do not confuse a seed phrase with an account. The Seed Phrase is a way to construct back the Account from a set of words.

To create a new seed phrase only use Mnemonic(). It will create a 256 strength from an English Wordlist.

let phrase = Mnemonic()
let account = HotAccount(phrase: phrase)

RPC API calls

RPC requests are an application’s gateway to the Solana cluster. Solana.Swift can be configured to the default free clusters (devnet, mainnet, testnet and custom)

public static let mainnetBetaSerum = RPCEndpoint(
    url: URL(string: "https://solana-api.projectserum.com")!, 
    urlWebSocket: URL(string: "wss://solana-api.projectserum.com")!, 
    network: .mainnetBeta
)

public static let mainnetBetaSolana = RPCEndpoint(
    url: URL(string: "https://api.mainnet-beta.solana.com")!, 
    urlWebSocket: URL(string: "wss://api.mainnet-beta.solana.com")!, 
    network: .mainnetBeta
)

public static let devnetSolana = RPCEndpoint(
    url: URL(string: "https://api.devnet.solana.com")!, 
    urlWebSocket: URL(string: "wss://api.devnet.solana.com")!, 
    network: .devnet
)

public static let testnetSolana = RPCEndpoint(
    url: URL(string: "https://api.testnet.solana.com")!, 
    urlWebSocket: URL(string: "wss://api.testnet.solana.com")!, 
    network: .testnet
)

To set up a custom one set your url, urlWebSocket and network.

public static let mainnetBetaAnkr = RPCEndpoint(
    url: URL(string: "https://rpc.ankr.com/solana")!, 
    urlWebSocket: URL(string: "wss://rpc.ankr.com/solana")!,
    network: .mainnetBeta
)

To configure just set your router to the cluster endpoint you need.

let endpoint = RPCEndpoint.devnetSolana
let router = NetworkingRouter(endpoint: endpoint)
let solana = Solana(router: router)

Solana.Swift support 45 RPC API calls. This is the way we interact with the blockchain.

Gets Accounts info.

Example using await

let info: BufferInfo<AccountInfo> = try await solana.api.getAccountInfo(account: "So11111111111111111111111111111111111111112", decodedTo: AccountInfo.self)

Example using callback

solana.api.getAccountInfo(account: "So11111111111111111111111111111111111111112", decodedTo: AccountInfo.self) { result in
    // process result
}

Gets BlockCommitment

Example using await

let block = try await solana.api.getBlockCommitment(block: 82493733)

Example using callback

 solana.api.getBlockCommitment(block: 82493733) { result in
    // process result
 }

Get ProgramAccounts

Example using await

let block = try await solana.api.getProgramAccounts(publicKey: "SwaPpA9LAaLfeLi3a68M4DjnLqgtticKg6CnyNwgAC8", decodedTo: TokenSwapInfo.self)

Example using callback

 solana.api.getProgramAccounts(publicKey: "SwaPpA9LAaLfeLi3a68M4DjnLqgtticKg6CnyNwgAC8", decodedTo: TokenSwapInfo.self) { result in
    // process result
 }

Check the usage below or look through the repositories callback and Await/Async tests.

Serialization and Deserialization of accounts

One of the Key concepts of Solana is the ability to read and write. Solana is handled by writing and reading to Accounts. As you might see in the previous examples we are handling this by passing a target object to serialize. This object has to comply with BufferLayout. BufferLayout should implement how objects are serialized/deserialized.

In Metaplex we provide a custom Borsch Serialization and Deserialization library called Beet. We also provide a code generation tool for autogenerating all the annoying code from an IDL we code this library Solita.

Actions

Actions are predefined program interfaces that construct the required inputs for the most common tasks in Solana ecosystems. You can see them as a bunch of code that implements Solana tasks using RPC calls.

We support 12.

  • closeTokenAccount: Closes token account
  • getTokenWallets: get token accounts
  • createAssociatedTokenAccount: Opens associated token account
  • sendSOL: Sends SOL native token
  • createTokenAccount: Opens token account
  • sendSPLTokens: Sends tokens
  • findSPLTokenDestinationAddress: Finds the address of a token of an address
  • serializeAndSendWithFee: Serializes and signs the transaction. Then it sends it to the blockchain.
  • getMintData: Get mint data for token
  • serializeTransaction: Serializes transaction
  • getPools: Get all available pools. Very intensive
  • swap: Swaps 2 tokens from the pool.

Example

Create an account token

Using await / async

let account: (signature: String, newPubkey: String)? = try await solana.action.createTokenAccount( mintAddress: mintAddress, payer: account)

Using callback

solana.action.createTokenAccount( mintAddress: mintAddress) { result in
// process
}

Sending sol

Using await / async

let transactionId = try await solana.action.sendSOL(
    to: toPublicKey,
    from: account,
    amount: balance/10
)
let toPublicKey = "3h1zGmCwsRJnVk5BuRNMLsPaQu1y2aqXqXDWYCgrp5UG"
let transactionId = try! solana.action.sendSOL(
            to: toPublicKey,
            amount: 10
){ result in
 // process
}

More Resources

Acknowledgment

This was originally based on P2P-ORG, but currently is no longer compatible.

solana.swift's People

Contributors

aajamaica avatar ajamaica avatar andyboyd avatar basememara avatar danqing avatar dezorkit avatar dhruv500 avatar ismyhc avatar j-h-a avatar megakoko avatar mike-metaplex avatar mirekr avatar nathanlawrence avatar rusik avatar samdowd avatar vpontis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

solana.swift's Issues

How to get Token Metadata on Devnet?

Hi how can i receive token metadata like symbol, icon and name from dev net:
https://explorer.solana.com/address/Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr?cluster=devnet

the function i use is the following:

let accounts = try await connection!.action.getTokenWallets(account: account!.publicKey.description)

which gives me the balance yes but not metadata provided:

Solana.Wallet(pubkey: "5v1hgkjCSee7LqMmghNk4Rq6szmmzu78hPKfDNeprdnc", ammount: Optional(Solana.TokenAmount(amount: "2000000000", decimals: 6, uiAmount: 2000.0, uiAmountString: "2000")), token: Optional(Solana.Token(chainId: nil, address: "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr", symbol: nil, name: nil, logoURI: nil, extensions: nil, tags: Optional([]), isNative: false)), liquidity: Optional(false))

so how can i get this information:
symbol: nil, name: nil, logoURI: nil,

Add networking module

Use a networking module so we can inject url session an configure endpoint and retry

make findProgramAddress public

Can the "findProgramAddress" function in the PublicKey extension be made public. It is currently private and therefore can't be used by applications to directly calculate Program Derived Addresses (PDA's).

File to update: Extensions / PublicKey / PublicKey+AssociatedTokenProgram.swift

Bump Swift Requirement to 5.4?

Is your feature request related to a problem? Please describe.
Result builders (a big part of the transaction template structures we discussed) require a bump to Swift 5.4. Though 5.5 has features that require specific iOS versions, I believe Swift 5.4 is entirely backwards compatible. As version bumps go, this one may be pretty innocuous.

Describe the solution you'd like
Bumping requirements in the package to Swift 5.4, amending Github workflows to support it, and updating the documentation.

Describe alternatives you've considered
An alternative would be to use either chained struct mutations (similar to Solnet's builders) or

Additional context
I've gotten Swift 5.4 working on GitHub actions before — it's not too bad.

Type 'SolanaSocket' does not conform to protocol 'WebSocketDelegate'

I have utilized this package dependency for Solana integration and used version 2.0.2 for Solana's flow. Unfortunately, I am encountering the following error in Xcode 15:

Type 'SolanaSocket' does not conform to the 'WebSocketDelegate' protocol.

There is already a WebSocketDelegate method within the SolanaSocket extension, but I am still getting this error, and I am unable to edit the file due to the package dependency.

It would be great if you could assist me with this?

Screenshot 2023-10-23 at 1 10 19 PM

Remove Cluster from Account

Is your feature request related to a problem? Please describe.
There is no need to set the Account cluster. It is not used for anything

Describe the solution you'd like
Remove the cluster from the account

Make parsed in ParsedInstruction public

I want to get info about transaction and use func getConfirmedTransaction(transactionSignature: String, onComplete: @escaping (Result<TransactionInfo, Error>) -> Void)
But I can't get info about transaction, because it's not public. Is it possible to make it public or should I use another func to get transaction info?

Await transaction result

Is there a way to wait for a transaction to be finalized before continuing to the next thing? This is really helpful to show a loading state to the user until we know the result of their action.

findProgramAddress — weird code

Hello Arturo!

I was trying findSPLTokenDestinationAddress and it didn't seem to work, I went into the source code and discovered this for-loop in findProgramAddress:

for nonce in stride(from: UInt8(255), to: 0, by: -1) {
            let seedsWithNonce = seeds + [Data([nonce])]
            return createProgramAddress(
                seeds: seedsWithNonce,
                programId: programId
            ).map {($0, nonce) }
        }

Is everything okay here? It returns on the first iteration of the loop.

If not, is the following code correct?

        for nonce in stride(from: UInt8(255), to: 0, by: -1) {
            let seedsWithNonce = seeds + [Data([nonce])]
            let programAddressResult = createProgramAddress(seeds: seedsWithNonce, programId: programId)
            if case .success(let publicKey) = programAddressResult {
                return .success((publicKey, nonce))
            }
        }

Thanks

Tests talk to Solana for real, and they fail

The tests are currently failing, and it appears some use the real NetworkingRouter and actually talk to a GenesysGo devnet node.

This is undesirable for a number of reasons.

Fix is to implement a mock version of SolanaRouter that provides appropriate responses for each test case.

How to use sendSPLTokens

Hi, first of all thanks for this great library.

I'm trying to use sendSPLTokens to transfer custom token to another wallet address, and I'm a bit stuck on what it means by fromPublicKey and destinationAddress

I tried either wallet address and token account address for fromPublicKey, but I got the below error

Transaction simulation failed: Attempt to debit an account but found no record of a prior credit

extension Action {
    public func sendSPLTokens(
        mintAddress: String,
        from fromPublicKey: String,
        to destinationAddress: String,
        amount: UInt64,
        allowUnfundedRecipient: Bool = false,
        onComplete: @escaping (Result<TransactionID, Error>) -> Void

In web3.js I can understand that the from and to refer to the token account address, not the wallet.

splToken.Token.createTransferInstruction(
        splToken.TOKEN_PROGRAM_ID,
        fromTokenAccount.address,
        toTokenAccount.address,
        fromWallet.publicKey,
        [],
        0
      )

I'm using testnet and my wallet has enough custom token https://explorer.solana.com/address/BPkzsoetXHfH228V8B74xpZC22SNVgu3NX8hiwNPbEpH?cluster=testnet

I know this is not really an issue with the library, but how to correctly use this method.
Thanks, any help is appreciated 🙏

Multi Request on RPC

Is your feature request related to a problem? Please describe.
Allow clients to batch rpc request of operation for parallel request.

Describe the solution you'd like
Allow the Router to ship more than one RPC request and return array of results. Not sure if I should limit them to N so we dont kill the rpc or get banned. Maybe thats developer responsability

Certain Programs are private unneccessarily

Describe the bug

  • TokenProgram is missing public declaration
  • AssociatedTokenProgram.createAssociatedTokenAccountInstruction is missing public declaration
  • TokenSwapProgram is missing public declaration

Expected behavior
All of these should be public. In both the solana-web3.js implementation and the SolanaKT implementation these are acessible, so the standard is already set to expose these.

Transaction.from(buffer: ) always crash

func testTransactionDecode() {
    let swapTransaction = "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAsTL5MjcP0ElSKS7nWnvOk+qZvJ6jITGFotkuy1gKFqIhsLSAdPdbjqMGnJ7T8GvDIZeCrkzY5cnTdJglaxmEudUCHtjI0soEUFAsQ3TdZgefXZpm+TSpDt0GSupo6DANLCL9p3EN7QVm+wCbiCUn2jVyJyazsZQYgqVRhf6h2a/pVY72d/tWNeZHNyS3Dha2QFVANOpHocez/NiIU8QV0yVF04h3XRAtqKdDmTPAd8xoLiu/N2FBWd4n6ilf8Yhj5ycgN6mCDYmBgfgSLDzFZMCMkNJi8513JLWWbMZSdwwSnCib7PSSoSILtrVDwUD5nwX+E/CqiYjJF6S312CKXScwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwZGb+UhFzL/7K26csOb57yM5bvF9xJrLEObOkAAAAAEedVb8jHAbu50xW7OaBUH/bGy3qP0jlECsc2iVrwTjwXQ6k8zc3ATpWPgk0jttvRZPZH8dkH5JHwkQahCobvrBpuIV/6rgYT7aH9jRhjANdrEOdwa6ztVmKDwAAAAAAEG3fbh12Whk9nL4UbO63msHLSF7V9bN5E6jPWFfv8AqTq4kD+3NcqxxnxZr0hX7fYbCvgypQp8WeMhkZ4OyKm8Yahhc3zJAYwffkWR86hkxsihTWzLBM1l7HhE4D472TKMlyWPTiSJ8bs9ECkUjg2DC1oTmdr/EIQEjnvY2+n4WbQ/+if11/ZKdMCbHylYed5LCas238ndUUsyGqezjOXoxvp6877brTo9ZfNqq8l0MbG75MLS9uDkfKYCA0UvXWFmjY92JM6L+n8NG0oowIrwOhILCaj2T4l5EfleAO8P/QcJAAUC2oUCAAkACQPoHwAAAAAAABAGAAUADAgNAQEIAgAFDAIAAACAlpgAAAAAAA0BBQERChYNDgAFBAEHDBIKChEKCw8DDgQBBgINJcEgmzNB1pyBBAEAAAAcAWQAAYCWmAAAAAAA3OYOAAAAAAAyAAANAwUAAAEJ"
    
    let data = Data(base64Encoded: swapTransaction)
    assert(data != nil)
    let transaction = try! Transaction.from(buffer: data!)
    print(transaction)
}

Get account info fails

Describe the bug
Error Retrieving Account information

To Reproduce
Steps to reproduce the behavior:

        let network = NetworkingRouter(endpoint: .mainnetBetaSolana)
        solana = Solana(router: network, accountStorage: accoutStorage)
        
        // Entered valid phrase for testing
        let account = Account(phrase: ["my", "phrase"], network: .mainnetBeta, derivablePath: nil)
        
        accoutStorage.save(account!)
        
        solana.api.getAccountInfo(account: account!.publicKey.base58EncodedString, decodedTo: AccountInfo.self) {
            switch $0 {
            case .success(let info):
                print(info)
            case .failure(let error):
                print(error)
             /*
value is null
request(method:bcMethod:parameters:onComplete:) -> {\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"slot\":112043777},\"value\":null},\"id\":\"17BBD8D5-7A01-4C72-9049-203894E719AA\"}\n"
            */

            }
        }

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):
iOS

Smartphone (please complete the following information):
iPhone Simulator

Additional context
Add any other context about the problem here.

Add `systemProgramId` to `PublicKey`

The system program address in PublicKey is exposed as simply programId.

This is confusing, especially given that programId appears in so many other places, meaning different program ids.

I suggest adding systemProgramId with the same value and marking programId as deprecated like this:

@available(*, deprecated, renamed: "systemProgramId")
static let programId = PublicKey(string: "11111111111111111111111111111111")!
static let systemProgramId = PublicKey(string: "11111111111111111111111111111111")!

Xcode will generate a fix-it automatically with this method of deprecation, so it is easy for users to change.

RPCEndpoint is using the wrong url of testnet api

RPCEndpoint is using the wrong url of testnet api in the definition of its static property .testnetSolana. If using this in the initiation of a NetworkRouter and call RPC APIs will end up with a network error.

It should be
RPCEndpoint(url: URL(string: "https://api.testnet.solana.com")!, urlWebSocket: URL(string: "wss://api.testnet.solana.com")!, network: .testnet)

instead of
RPCEndpoint(url: URL(string: "https://testnet.solana.com")!, urlWebSocket: URL(string: "wss://testnet.solana.com")!, network: .testnet)

Action.sendSPLTokens fails with a destination address of an original account address

Describe the bug
Action.sendSPLTokens always fails with a destination address of an original account address (the address of SOL account), no matter if there is an existing associated token address under the original account. The action only works when "to" and "from" are both associated token addresses other than their owners.

Expected behavior
If I did not get the design intention wrong, the action should check if the destination passing in is an associated token address or an original address. If it is an original address, the program will find its associated token address registered under the mint, or create a new one if not existing. However I'm getting errors under both conditions.

I'm using the mint address of USDC in my tests on testnet: CpMah17kQEL2wqyMKt3mZBdTnZbkbfx4nqmQMFDP5vwp

error: no such module 'Solana' in build archive section ( GitHub CICD )

@ajamaica I am using Solana Swift Package Dependency in my project and using some model classes from your summer wallet demo. But while running the CICD workflow ( GitHub actions ) in the build archive section getting the error error: no such module 'Solana' in the Summer Wallet Model classes. I have also attached the screenshot regarding that. (It's working in manual archive from Xcode.) I have also added clean and build command in the CICD workflow so can fetch this Package Dependency.

I am fixing this error since many days but not getting success so please I would like your help.

RLRmt

08O4E

Make it possible to create your own custom transactions

It's currently not possible to send custom transactions to your own Solana program with this package as-is.
TransactionInstruction does not have a public init which means you can't create and send one from outside the package.

Longer term it may be desirable to have full Anchor support, but in the mean-time (and for programs that don't use Anchor) it would be useful to be able to create and send custom instructions.

#83 discusses a possible way to do this by creating a TransactionInstruction and then sending it with solana.action.serializeAndSendWithFee - however, without a public initialiser this isn't actually possible from outside.

It would be good to discuss the options, a public init would be the simplest, but it may also be desirable to have static helpers like createCustomInstruction which could be made generic and specialised on a CustomInstruction interface, allowing external code to implement custom instructions and then create/send them. Has this been thought about much?

To have more info when calling `getTokenWallets()`

When calling getTokenWallets() it returns with an array of Wallets.
My understand is if the wallets' token is not supported, the Token parameter of the returning Wallet will only contain an address.

Maybe adding some option to config to fetch more data of the token, like name, logo, and even attributes for NFTs.

Or is there a function that already meets the needs?

Thank you. This library really helps a lot

Serialize and Send Transaction Not Working For Custom Programs

Describe the bug
I'm currently using MW to create unsigned transactions, return to frontend, serialize and sign. After signing and sending the transaction I'm getting "Signature Verification Failed" error from the chain.

I'm using serialize function with requiredAllSignatures and verifySignatures parameters as true and getting no error. However, when sending on-chain this error occurs. When I checked the serialized data created for same transaction on web3.js and Solana.Swift library there were some differences in UInt8 array.

To Reproduce
Steps to reproduce the behavior:

  1. https://api.magiceden.dev or https://docs.hyperspace.xyz/hype/developer-guide/ can be used to create the NFT transactions.
  2. Create the transaction object from the retrieved tx.
  3. Partial sign, serialize and send the transaction on chain.
  4. See error

Expected behavior
Transaction should go through and be successful on chain.

Screenshots
Screen Shot 2022-11-02 at 01 33 45

How to use a private key in this API?

Not sure if I am missing some documentation around this, if I am please point me to the right place.

I need to implement some features to the app I am building, I have managed to use Metaplex Solana.Swift HotAccount to create a wallet, and use its public key to retrieve NFTs. I have not managed to use a private key to, say, retrieve the account mnemonic phrase. Are these functions not available? If not, what should I be using?

I can see that there is a function called "SendSol". It seems to take in an account object presumably attached with private key? How does this process work? Where is the documentation I can use to investigate?

Build failures on Xcode 14.0.1

Describe the bug
Attempting to build a project that has Solana.swift as a dependency in SPM fails to build with a linker error, Undefined symbol: __swift_FORCE_LOAD_$_XCTestSwiftSupport

To Reproduce
Steps to reproduce the behavior:

  1. Create a new project (I've tried both an iOS app and a framework, both behave the same)
  2. Add Solana.swift as a dependency in SPM
  3. Build the target
  4. See build failure Undefined symbol: __swift_FORCE_LOAD_$_XCTestSwiftSupport

Expected behavior
The project should build

Screenshots
image

Cannot create token account for receiver

I am using this library for solana spl token transfer. I can successfully created token account for sender but not able to create token account for receiver. As i have no secret key of receiver so how can i create token account for receiver can anyone help please?

Add public, standalone version of Transaction.partialSign to support remote signing

Is your feature request related to a problem? Please describe.
We'd like to use partial signing to add a remote feePayer to transactions on iOS.

Describe the solution you'd like
A public, standalone version of Transaction.partialSign is required to support remote signing.

Additional context
This already exists on solana-web3.js, see implementation here: https://github.com/solana-labs/solana-web3.js/blob/13cd6f5/src/transaction.ts#L494:L525

Currently the Solana.Swift lib has the same internal "_partialSign" function as JS, but it's missing the public wrapper.
https://github.com/ajamaica/Solana.Swift/blob/master/Sources/Solana/Models/SendingTransaction/Transaction.swift#L76

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.