Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

The ImmutableX Core SDK Swift provides convenient access to the Immutable API's for applications written on the ImmutableX platform.

License

Notifications You must be signed in to change notification settings

immutable/imx-core-sdk-swift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


🚨 This library is no longer maintained 🚨

If you're building apps with Immutable, please use Immutable's Unified SDK

ImmutableX Core SDK Swift

Maintainability Test Coverage

The ImmutableX Core SDK Swift provides convenient access to the Immutable API's for applications written on the ImmutableX platform.

Documentation

See the developer guides for information on building on ImmutableX.

See the API reference documentation for more information on our API's.

Installation

Prerequisites

  • iOS 13.0 or macOS 10.15
  • Swift 5.7

Swift Package Manager

In your Package.swift:

dependencies: [
    .package(url: "https://github.com/immutable/imx-core-sdk-swift.git", from: "1.0.0-beta.2")
]

Cocoapods

In your Podfile:

platform :ios, '13.0'
use_frameworks!

target 'MyApp' do
  pod 'ImmutableXCore'
end

Usage

Initialisation

The Core SDK must be initialised before any of its classes are used. Upon initialisation the base environment and log level may be defined. Once initialised a shared instace will be available for accessing the Workflow Functions.

For example, you initialise the SDK and retrieve a URL to buy crypto through Moonpay:

ImmutableX.initialize(base: .sandbox)

let url = try await ImmutableX.shared.buyCryptoURL(signer: signer)

Workflow Functions

Utility functions accessed via ImmutableX.shared that will chain necessary API calls to complete a process or perform a transaction.

  • Register a user with ImmutableX
  • Buy cryptocurrency via Moonpay
  • Buy ERC721
  • Sell ERC721
  • Cancel order
  • Transfer ERC20/ERC721/ETH

Standard API Requests

The Core SDK includes classes that interact with the ImmutableX APIs.

e.g. Get a list of collections ordered by name in ascending order

let collections = try await CollectionsAPI.listCollections(
    pageSize: 20,
    orderBy: .name,
    direction: "asc"
)

View the OpenAPI spec for a full list of API requests available in the Core SDK.

Wallet Connection

In order to use any workflow functions, you will need to pass in the connected wallet provider. This means you will need to implement your own Wallet L1 Signer and L2 StarkSigner.

Once you have a Signer instance you can generate the user's Stark key pair and use the result to instantiate a StarkSigner, for example, by using the default StandardStarkSigner provided by the SDK.

let keyPair = try await StarkKey.generateKeyPair(from: signer)
let starkSigner = StandardStarkSigner(pair: keyPair)

Autogenerated Code

Parts of the Core SDK are automagically generated.

API Autogenerated Code

We use OpenAPI (formally known as Swagger) to auto-generate the API clients that connect to the public APIs.

The OpenAPI spec is retrieved from https://api.x.immutable.com/openapi and also saved in the repo here.

Upon updating the openapi.json file, ensure openapi-generator is installed, then run ./generateapi.sh to regenerate the files. Any custom templates should be appropriately modified or removed as needed. These can be found in the .openapi-generator/templates directory.

Changelog Management

The following headings should be used as appropriate

  • Added
  • Changed
  • Deprecated
  • Removed
  • Fixed

What follows is an example with all the change headings, for real world use only use headings when appropriate.

This goes at the top of the CHANGELOG.md above the most recent release:

...

## [Unreleased]

### Added

for new features.

### Changed

for changes in existing functionality.

### Deprecated

for soon-to-be removed features.

### Removed

for now removed features.

### Fixed

for any bug fixes.

...

Contributing

If you would like to contribute by reporting bugs, suggest enchacements or pull requests, please read our contributing guide.

Getting Help

ImmutableX is open to all to build on, with no approvals required. If you want to talk to us to learn more, or apply for developer grants, click below:

Contact us

Project Support

To get help from other developers, discuss ideas, and stay up-to-date on what's happening, become a part of our community on Discord.

Join us on Discord

You can also join the conversation, connect with other projects, and ask questions in our ImmutableX Discourse forum.

Visit the forum

Still need help?

You can also apply for marketing support for your project. Or, if you need help with an issue related to what you're building with ImmutableX, click below to submit an issue. Select I have a question or issue related to building on ImmutableX as your issue type.

Contact support

License

ImmutableX Core SDK Swift repository is distributed under the terms of the Apache License (Version 2.0).

About

The ImmutableX Core SDK Swift provides convenient access to the Immutable API's for applications written on the ImmutableX platform.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages