Skip to content

Latest commit

 

History

History
1567 lines (1266 loc) · 48.9 KB

API.md

File metadata and controls

1567 lines (1266 loc) · 48.9 KB

Swift API reference

OMSWallet

OMSWallet

public final class OMSWallet: Sendable {
    public let wallet: WalletClient
    public let indexer: IndexerClient
    public convenience init(publishableKey: String) throws
}

WalletClient

public final class WalletClient: @unchecked Sendable

Authentication and sessions

WalletClient.walletAddress

public internal(set) var walletAddress: String? { get set }

WalletClient.walletId

public internal(set) var walletId: String { get set }

WalletClient.session

public var session: OMSWalletSessionState { get }

Snapshot of the current durable wallet-session state.

WalletClient.addSessionExpiredObserver(_:)

@discardableResult public func addSessionExpiredObserver(_ observer: @escaping @MainActor @Sendable (OMSWalletSessionExpiredEvent) -> Void) -> OMSWalletSessionExpiredObservation

WalletClient.startEmailAuth(email:sessionLifetimeSeconds:)

public func startEmailAuth(email: String, sessionLifetimeSeconds: UInt32 = 604_800) async throws

Initiates email-based OTP authentication by sending a one-time code to the given address.

WalletClient.completeEmailAuth(code:walletSelection:walletType:)

@discardableResult public func completeEmailAuth(code: String, walletSelection: WalletSelectionBehavior = .automatic, walletType: WalletType = WalletType.ethereum) async throws -> CompleteAuthResult

Completes the email OTP authentication flow.

WalletClient.signInWithOidcIdToken(idToken:issuer:audience:walletType:walletSelection:sessionLifetimeSeconds:provider:providerLabel:)

@discardableResult public func signInWithOidcIdToken(idToken: String, issuer: String, audience: String, walletType: WalletType = WalletType.ethereum, walletSelection: WalletSelectionBehavior = .automatic, sessionLifetimeSeconds: UInt32 = 604_800, provider: String? = nil, providerLabel: String? = nil) async throws -> CompleteAuthResult

Signs in with an OIDC ID token.

WalletClient.startOIDCRedirectAuth(provider:walletType:loginHint:authorizeParams:walletSelection:sessionLifetimeSeconds:)

public func startOIDCRedirectAuth(provider: CustomOIDCProviderConfiguration, walletType: WalletType = WalletType.ethereum, loginHint: String? = nil, authorizeParams: [String : String] = [:], walletSelection: WalletSelectionBehavior? = nil, sessionLifetimeSeconds: UInt32? = nil) async throws -> StartOIDCRedirectAuthResult

Starts OIDC authorization-code redirect authentication.

WalletClient.startOIDCRedirectAuth(provider:omsRelayReturnURI:walletType:loginHint:walletSelection:sessionLifetimeSeconds:)

public func startOIDCRedirectAuth(provider: OMSRelayOIDCProvider, omsRelayReturnURI: String, walletType: WalletType = WalletType.ethereum, loginHint: String? = nil, walletSelection: WalletSelectionBehavior? = nil, sessionLifetimeSeconds: UInt32? = nil) async throws -> StartOIDCRedirectAuthResult

Starts OIDC authorization-code redirect authentication through the built-in OMS relay for the fixed Google and Apple provider values.

WalletClient.handleOIDCRedirectCallback(_:walletSelection:sessionLifetimeSeconds:)

public func handleOIDCRedirectCallback(_ callbackURL: String?, walletSelection: WalletSelectionBehavior? = nil, sessionLifetimeSeconds: UInt32? = nil) async throws -> OIDCRedirectAuthResult

Safely handles an incoming OIDC authorization-code redirect callback.

WalletClient.listWallets()

public func listWallets() async throws -> [Wallet]

Lists all wallets available to the authenticated credential.

WalletClient.useWallet(walletId:)

@discardableResult public func useWallet(walletId: String) async throws -> WalletSelectionResult

Activates an existing wallet by its WaaS wallet ID and persists its address and signer metadata to the keychain.

WalletClient.createWallet(walletType:reference:)

@discardableResult public func createWallet(walletType: WalletType = WalletType.ethereum, reference: String? = nil) async throws -> WalletSelectionResult

Creates a new wallet of the specified type for the authenticated user and persists its address and signer metadata to the keychain.

WalletClient.importWallet(privateKey:reference:)

@discardableResult public func importWallet(privateKey: WalletImportPrivateKey, reference: String? = nil) async throws -> WalletSelectionResult

Imports and activates an Ethereum or Solana private key.

WalletClient.getWalletImportRecipientKey(cipherSuite:)

public func getWalletImportRecipientKey(cipherSuite: WalletImportCipherSuite) async throws -> WalletImportRecipientKey

Fetches an attested recipient key for advanced wallet-import encryption flows.

WalletClient.importEncryptedWallet(walletType:keyMaterial:reference:)

@discardableResult public func importEncryptedWallet(walletType: WalletType, keyMaterial: EncryptedWalletImportKeyMaterial, reference: String? = nil) async throws -> WalletSelectionResult

Imports and activates key material encrypted by the caller for an attested WaaS recipient key.

WalletClient.getIdToken(ttlSeconds:customClaims:)

public func getIdToken(ttlSeconds: UInt32? = nil, customClaims: [String : JSONValue]? = nil) async throws -> String

WalletClient.inspectRemoteCredential(credentialId:)

public func inspectRemoteCredential(credentialId: String) async throws -> RemoteCredentialMetadata

Returns display metadata for a remote credential before the owner approves access.

WalletClient.authorizeRemoteAccess(credentialId:network:grants:expiresAt:sessionId:)

public func authorizeRemoteAccess(credentialId: String, network: Network, grants: [SmartSessionGrant], expiresAt: String, sessionId: String? = nil) async throws -> AuthorizedRemoteAccess

Authorizes owner-approved EVM smart-session grants for a remote credential. Omit sessionId to create a session; pass an existing session ID to replace that session's grants and requested expiry without changing its signer. WaaS caps the effective expiry at the remote credential's expiry.

WalletClient.listAccess(pageSize:type:)

public func listAccess(pageSize: UInt32? = nil, type: AccessGrantType? = nil) async throws -> [AccessGrant]

Returns all wallet access grants, following WaaS cursors automatically.

WalletClient.listAccessPage(pageSize:cursor:type:)

public func listAccessPage(pageSize: UInt32? = nil, cursor: String? = nil, type: AccessGrantType? = nil) async throws -> AccessGrantPage

Returns one credential-access page for this wallet.

WalletClient.listAccessPages(pageSize:type:)

public func listAccessPages(pageSize: UInt32? = nil, type: AccessGrantType? = nil) -> ListAccessPages

Returns credential-access pages for this wallet until WaaS stops returning a cursor.

WalletClient.getRemoteAccessSession(sessionId:)

public func getRemoteAccessSession(sessionId: String) async throws -> RemoteAccessSession

Returns one owner-visible remote session and verifies that it belongs to the selected wallet.

WalletClient.getRemoteAccessSessionUsage(sessionId:network:)

public func getRemoteAccessSessionUsage(sessionId: String, network: Network) async throws -> [SmartSessionGrantUsage]

Returns the current usage for each bounded grant in an owner-visible remote session.

WalletClient.revokeAccess(credentialId:sessionId:)

public func revokeAccess(credentialId: String, sessionId: String? = nil) async throws

Revokes one access grant from the selected wallet. Use listAccess() or listAccessPage(pageSize:cursor:type:) first to retrieve the direct or remote grant. Omit sessionId for a direct grant; for a remote grant, pass its session ID to revoke exactly that session.

WalletClient.signOut()

public func signOut() throws

Clears the wallet session from the device keychain.

WalletSelectionBehavior

public enum WalletSelectionBehavior: String, Codable, Equatable, Sendable {
    case automatic
    case manual
    public init?(rawValue: String)
}

CompleteAuthResult

public enum CompleteAuthResult: Sendable {
    case walletSelected(
        walletAddress: String,
        wallet: Wallet,
        wallets: [Wallet],
        credential: WalletCredential
    )
    case walletSelection(PendingWalletSelection)
    public var credential: WalletCredential { get }
    public var walletAddress: String? { get }
    public var wallet: Wallet? { get }
}

PendingWalletSelection

public final class PendingWalletSelection: @unchecked Sendable {
    public let walletType: WalletType
    public let wallets: [Wallet]
    public let credential: WalletCredential
    @discardableResult public func selectWallet(walletId: String) async throws -> WalletSelectionResult
    @discardableResult public func createAndSelectWallet(reference: String? = nil) async throws -> WalletSelectionResult
}

WalletSelectionResult

public struct WalletSelectionResult: Sendable {
    public let walletAddress: String
    public let wallet: Wallet
    public init(walletAddress: String, wallet: Wallet)
}

Wallet

public struct Wallet: Codable, Equatable, Sendable {
    public let id: String
    public let type: WalletType
    public let address: String
    public let reference: String?
    public let keyOrigin: WalletKeyOrigin
    public init(id: String, type: WalletType, address: String, reference: String? = nil, keyOrigin: WalletKeyOrigin)
    public init(from decoder: any Decoder) throws
}

WalletType

public enum WalletType: Codable, Equatable, Hashable, Sendable {
    case ethereum
    case solana
    case unknown(String)
    public var wireValue: String { get }
    public init(wireValue: String)
    public init(from decoder: Decoder) throws
    public func encode(to encoder: Encoder) throws
}

WalletKeyOrigin

public enum WalletKeyOrigin: Codable, Equatable, Hashable, Sendable {
    case enclave
    case imported
    case unknown(String)
    public var wireValue: String { get }
    public init(wireValue: String)
    public init(from decoder: Decoder) throws
    public func encode(to encoder: Encoder) throws
}

WalletImportCipherSuite

public enum WalletImportCipherSuite: String, CaseIterable, Sendable {
    case x25519Sha256Aes256Gcm = "x25519-sha256-aes256gcm"
    case x25519Sha256ChaCha20Poly1305 = "x25519-sha256-chacha20poly1305"
    case p256Sha256Aes256Gcm = "p256-sha256-aes256gcm"
    case p256Sha256ChaCha20Poly1305 = "p256-sha256-chacha20poly1305"
    public init?(rawValue: String)
}

WalletImportPrivateKey

public enum WalletImportPrivateKey: Sendable {
    case ethereum(String)
    case ethereumBytes(Data)
    case solana(String)
    case solanaBytes(Data)
}

WalletImportRecipientKey

public struct WalletImportRecipientKey: Equatable, Sendable {
    public let keyId: String
    public let cipherSuite: WalletImportCipherSuite
    public let publicKey: String
    public init(keyId: String, cipherSuite: WalletImportCipherSuite, publicKey: String)
}

EncryptedWalletImportKeyMaterial

public struct EncryptedWalletImportKeyMaterial: Equatable, Sendable {
    public let keyId: String
    public let cipherSuite: WalletImportCipherSuite
    public let encapsulatedKey: String
    public let ciphertext: String
    public init(keyId: String, cipherSuite: WalletImportCipherSuite, encapsulatedKey: String, ciphertext: String)
}

WalletCredential

public struct WalletCredential: Codable, Equatable, Sendable {
    public let credentialId: String
    public let expiresAt: String
    public let isCaller: Bool
    public init(credentialId: String, expiresAt: String, isCaller: Bool)
    public init(from decoder: any Decoder) throws
}

RemoteCredentialMetadata

public struct RemoteCredentialMetadata: Codable, Equatable, Sendable {
    public let appUrl: String
    public let appName: String
    public let appLogoUrl: String
    public let custom: [String : String]
    public init(appUrl: String, appName: String, appLogoUrl: String, custom: [String : String])
    public init(from decoder: any Decoder) throws
}

SmartSessionGrant

public enum SmartSessionGrant: Equatable, Sendable {
    case nativeTransfer(to: String, limit: String)
    case erc20Transfer(token: String, to: String? = nil, limit: String, cumulative: Bool? = nil)
}

AccessGrantType

public enum AccessGrantType: String, Codable, Equatable, Sendable {
    case direct
    case remote
    public init?(rawValue: String)
}

RemoteAccessGrant

public struct RemoteAccessGrant: Equatable, Sendable {
    public let credential: WalletCredential
    public let sessionId: String
    public let metadata: RemoteCredentialMetadata
    public let grants: [SmartSessionGrant]
    public init(credential: WalletCredential, sessionId: String, metadata: RemoteCredentialMetadata, grants: [SmartSessionGrant])
}

AccessGrant

public enum AccessGrant: Equatable, Sendable {
    case direct(WalletCredential)
    case remote(RemoteAccessGrant)
    public var credential: WalletCredential { get }
}

AccessGrantPage

public struct AccessGrantPage: Equatable, Sendable {
    public let grants: [AccessGrant]
    public let page: Page?
    public init(grants: [AccessGrant], page: Page? = nil)
}

AuthorizedRemoteAccess

public struct AuthorizedRemoteAccess: Equatable, Sendable {
    public let walletId: String
    public let sessionId: String
    public let expiresAt: String
}

RemoteAccessSession

public struct RemoteAccessSession: Equatable, Sendable {
    public let sessionId: String
    public let walletId: String
    public let signerAddress: String
    public let grants: [SmartSessionGrant]
    public let chainId: Int
    public let expiresAt: String
}

SmartSessionGrantUsage

public struct SmartSessionGrantUsage: Equatable, Sendable {
    public let grant: SmartSessionGrant
    public let used: String?
}

CustomOIDCProviderConfiguration

public struct CustomOIDCProviderConfiguration: Sendable {
    public let issuer: String
    public let clientID: String
    public let authorizationURL: String
    public let provider: String?
    public let providerLabel: String?
    public let scopes: [String]
    public let providerRedirectURI: String
    public let authorizeParams: [String : String]
    public let authMode: OIDCAuthMode
    public init(issuer: String, clientID: String, authorizationURL: String, providerRedirectURI: String, provider: String? = nil, providerLabel: String? = nil, scopes: [String] = [], authorizeParams: [String : String] = [:], authMode: OIDCAuthMode = .authCodePKCE)
}

A caller-owned OIDC provider configuration for authorization-code redirect auth.

OIDCAuthMode

public enum OIDCAuthMode: String, Codable, Equatable, Sendable {
    case authCode = "auth-code"
    case authCodePKCE = "auth-code-pkce"
    public init?(rawValue: String)
}

OIDC redirect auth-code mode.

OMSRelayOIDCProvider

public struct OMSRelayOIDCProvider: Equatable, Hashable, Sendable

A fixed OIDC provider whose OAuth callback is owned by the OMS relay.

OMSRelayOIDCProviders

public enum OMSRelayOIDCProviders {
    public static let google: OMSRelayOIDCProvider
    public static let apple: OMSRelayOIDCProvider
}

SDK-owned OMS relay provider values.

StartOIDCRedirectAuthResult

public struct StartOIDCRedirectAuthResult: Sendable {
    public let authorizationURL: String
    public init(authorizationURL: String)
}

Result returned after starting an OIDC authorization-code redirect flow.

OIDCRedirectAuthResult

public enum OIDCRedirectAuthResult: Sendable {
    case completed(CompleteAuthResult)
    case notOIDCRedirectCallback
    case noPendingAuth
}

Result of handling an incoming OIDC authorization-code redirect callback.

OMSWalletSessionState

public struct OMSWalletSessionState: Equatable, Sendable {
    /// Address of the selected wallet in a completed session, or `nil` when the SDK is signed out.
    public let walletAddress: String?
    /// Expiration time for the current completed wallet session, or `nil` when unavailable.
    public let expiresAt: Date?
    /// Auth metadata for the current completed wallet session.
    public let auth: OMSWalletSessionAuth?
    public init(walletAddress: String?, expiresAt: Date? = nil, auth: OMSWalletSessionAuth? = nil)
}

OMSWalletSessionAuth

public enum OMSWalletSessionAuth: Codable, Equatable, Sendable {
    case email(OMSWalletEmailSessionAuth)
    case oidc(OMSWalletOidcSessionAuth)
    public var email: String? { get }
    public init(from decoder: Decoder) throws
    public func encode(to encoder: Encoder) throws
}

OMSWalletEmailSessionAuth

public struct OMSWalletEmailSessionAuth: Codable, Equatable, Sendable {
    public let email: String
    public init(email: String)
    public init(from decoder: Decoder) throws
    public func encode(to encoder: Encoder) throws
}

OMSWalletOidcSessionAuth

public struct OMSWalletOidcSessionAuth: Codable, Equatable, Sendable {
    public let flow: OMSWalletOidcSessionAuthFlow
    public let issuer: String
    public let provider: String?
    public let providerLabel: String?
    public let email: String?
    public init(flow: OMSWalletOidcSessionAuthFlow, issuer: String, provider: String? = nil, providerLabel: String? = nil, email: String? = nil)
    public init(from decoder: Decoder) throws
    public func encode(to encoder: Encoder) throws
}

OMSWalletOidcSessionAuthFlow

public enum OMSWalletOidcSessionAuthFlow: String, Codable, Equatable, Sendable {
    case redirect
    case idToken = "id-token"
    public init?(rawValue: String)
}

OMSWalletSessionExpiredEvent

public struct OMSWalletSessionExpiredEvent: Equatable, Sendable {
    public let session: OMSWalletSessionState
    public let expiredAt: Date
    public init(session: OMSWalletSessionState, expiredAt: Date)
}

OMSWalletSessionExpiredObservation

public final class OMSWalletSessionExpiredObservation: @unchecked Sendable {
    public func cancel()
}

ListAccessPages

public struct ListAccessPages: AsyncSequence {
    public typealias Element = AccessGrantPage
    public func makeAsyncIterator() -> AsyncIterator
    public struct AsyncIterator: AsyncIteratorProtocol {
        public mutating func next() async throws -> AccessGrantPage?
    }
}

Transactions and signing

WalletClient.signMessage(network:message:)

public func signMessage(network: Network, message: String) async throws -> String

Signs an arbitrary message using the wallet's session key.

WalletClient.signSolanaMessage(message:)

public func signSolanaMessage(message: String) async throws -> String

WalletClient.signTypedData(network:typedData:)

public func signTypedData(network: Network, typedData: JSONValue) async throws -> String

WalletClient.isValidMessageSignature(network:walletAddress:message:signature:)

public func isValidMessageSignature(network: Network, walletAddress: String, message: String, signature: String) async throws -> Bool

WalletClient.isValidSolanaMessageSignature(walletAddress:message:signature:)

public func isValidSolanaMessageSignature(walletAddress: String, message: String, signature: String) async throws -> Bool

WalletClient.isValidTypedDataSignature(network:walletAddress:typedData:signature:)

public func isValidTypedDataSignature(network: Network, walletAddress: String, typedData: JSONValue, signature: String) async throws -> Bool

WalletClient.sendTransaction(network:to:value:selectFeeOption:mode:waitForStatus:statusPolling:)

public func sendTransaction(network: Network, to: String, value: String, selectFeeOption: FeeOptionSelector? = nil, mode: TransactionMode = .relayer, waitForStatus: Bool = true, statusPolling: TransactionStatusPollingOptions = TransactionStatusPollingOptions()) async throws -> SendTransactionResponse

WalletClient.sendTransaction(network:request:selectFeeOption:waitForStatus:statusPolling:)

public func sendTransaction(network: Network, request: SendTransactionRequest, selectFeeOption: FeeOptionSelector? = nil, waitForStatus: Bool = true, statusPolling: TransactionStatusPollingOptions = TransactionStatusPollingOptions()) async throws -> SendTransactionResponse

WalletClient.sendSolanaTransfer(network:asset:to:amount:selectFeeOption:mode:waitForStatus:statusPolling:)

public func sendSolanaTransfer(network: SolanaNetwork, asset: String, to: String, amount: String, selectFeeOption: FeeOptionSelector? = nil, mode: TransactionMode = .relayer, waitForStatus: Bool = true, statusPolling: TransactionStatusPollingOptions = TransactionStatusPollingOptions()) async throws -> SendTransactionResponse

WalletClient.callContract(network:contract:method:args:selectFeeOption:mode:waitForStatus:statusPolling:)

public func callContract(network: Network, contract: String, method: String, args: [AbiArg]?, selectFeeOption: FeeOptionSelector? = nil, mode: TransactionMode = .relayer, waitForStatus: Bool = true, statusPolling: TransactionStatusPollingOptions = TransactionStatusPollingOptions()) async throws -> SendTransactionResponse

WalletClient.getTransactionStatus(txnId:)

public func getTransactionStatus(txnId: String) async throws -> TransactionStatusResponse

Returns the current execution status for a prepared or submitted transaction.

SendTransactionRequest

public struct SendTransactionRequest: Sendable {
    public let to: String
    public let value: String
    public let data: String?
    public let mode: TransactionMode
    public init(to: String, value: String, data: String? = nil, mode: TransactionMode = .relayer)
}

SendTransactionResponse

public struct SendTransactionResponse: Codable, Sendable, Equatable {
    public let txnId: String
    public let status: TransactionStatus
    public let txnHash: String?
    public let statusResolution: TransactionStatusResolution
    public init(txnId: String, status: TransactionStatus, txnHash: String? = nil, statusResolution: TransactionStatusResolution)
    public init(from decoder: any Decoder) throws
}

TransactionMode

public enum TransactionMode: Codable, Equatable, Hashable, Sendable {
    case native
    case relayer
    case unknown(String)
    public var wireValue: String { get }
    public init(wireValue: String)
    public init(from decoder: Decoder) throws
    public func encode(to encoder: Encoder) throws
}

TransactionStatusPollingOptions

public struct TransactionStatusPollingOptions: Sendable, Equatable {
    public let timeoutMs: UInt64?
    public let intervalMs: UInt64?
    public let fastIntervalMs: UInt64?
    public let fastPollCount: Int?
    public init(timeoutMs: UInt64? = nil, intervalMs: UInt64? = nil, fastIntervalMs: UInt64? = nil, fastPollCount: Int? = nil)
}

TransactionStatusResponse

public struct TransactionStatusResponse: Codable, Equatable, Sendable {
    public let status: TransactionStatus
    public let txnHash: String?
    public init(status: TransactionStatus, txnHash: String? = nil)
    public init(from decoder: any Decoder) throws
}

TransactionStatus

public enum TransactionStatus: Codable, Equatable, Hashable, Sendable {
    case quoted
    case pending
    case executed
    case failed
    case unknown(String)
    public var wireValue: String { get }
    public init(wireValue: String)
    public init(from decoder: Decoder) throws
    public func encode(to encoder: Encoder) throws
}

TransactionStatusResolution

public enum TransactionStatusResolution: String, Codable, Sendable, Equatable {
    case notRequested
    case resolved
    case timedOut
    public init?(rawValue: String)
}

FeeOptionSelector

public struct FeeOptionSelector: Sendable {
    /// Sponsored transactions pass an empty array. Returning `nil` acknowledges the free fee;
    /// throw to stop execution.
    public typealias Select = @Sendable (_ options: [FeeOptionWithBalance]) async throws -> FeeOptionSelection?
    public init(_ select: @escaping Select)
    public func callAsFunction(_ options: [FeeOptionWithBalance]) async throws -> FeeOptionSelection?
    public func callAsFunction(_ options: [FeeOption]) async throws -> FeeOptionSelection?
    public static let firstAvailable: FeeOptionSelector
    public static func custom(_ pick: @escaping Select) -> FeeOptionSelector
}

FeeOptionWithBalance

public struct FeeOptionWithBalance: Sendable {
    public let feeOption: FeeOption
    public let selection: FeeOptionSelection
    public let balance: TokenBalance?
    public let available: String?
    public let availableRaw: String?
    public let decimals: Int?
    public init(feeOption: FeeOption, selection: FeeOptionSelection? = nil, balance: TokenBalance? = nil, available: String? = nil, availableRaw: String? = nil, decimals: Int? = nil)
}

FeeOption

public struct FeeOption: Codable, Equatable, Sendable {
    public let token: FeeToken
    public let value: String
    public let displayValue: String
    public init(token: FeeToken, value: String, displayValue: String)
    public init(from decoder: any Decoder) throws
}

FeeOptionSelection

public struct FeeOptionSelection: Codable, Equatable, Sendable {
    public let token: String
    public let index: UInt32?
    public init(token: String, index: UInt32? = nil)
    public init(feeOption: FeeOption, index: UInt32? = nil)
    public init(from decoder: any Decoder) throws
}

FeeToken

public struct FeeToken: Codable, Equatable, Sendable {
    public let network: String
    public let name: String
    public let symbol: String
    public let type: String
    public let decimals: UInt32?
    public let logoUrl: String?
    public let contractAddress: String?
    public let tokenId: String?
    public init(network: String, name: String, symbol: String, type: String, decimals: UInt32? = nil, logoUrl: String? = nil, contractAddress: String? = nil, tokenId: String? = nil)
    public init(from decoder: any Decoder) throws
}

AbiArg

public struct AbiArg: Codable, Equatable, Sendable {
    public let type: String
    public let value: JSONValue
    public init(type: String, value: JSONValue)
    public init(from decoder: any Decoder) throws
}

Indexer

IndexerClient

public final class IndexerClient: Sendable

IndexerClient.getBalances(_:)

public func getBalances(_ params: GetBalancesParams) async throws -> BalancesResult

IndexerClient.getTransactionHistory(_:)

public func getTransactionHistory(_ params: GetTransactionHistoryParams) async throws -> TransactionHistoryResult

IndexerClient.getSolanaBalances(_:)

public func getSolanaBalances(_ params: GetSolanaBalancesParams) async throws -> SolanaBalancesResult

GetSolanaBalancesParams

public struct GetSolanaBalancesParams: Sendable {
    public let walletAddress: String
    public let networks: [SolanaNetwork]
    public let includeMetadata: Bool
    public let omitNativeBalances: Bool?
    public let mintAddresses: [String]
    public let excludedMintAddresses: [String]
    public init(walletAddress: String, networks: [SolanaNetwork] = [.mainnet, .devnet], includeMetadata: Bool = true, omitNativeBalances: Bool? = nil, mintAddresses: [String] = [], excludedMintAddresses: [String] = [])
}

SolanaBalancesResult

public struct SolanaBalancesResult: Sendable {
    public let status: Int
    public let balances: [SolanaBalance]
    public let errors: [SolanaNetworkError]
}

SolanaBalance

public enum SolanaBalance: Decodable, Sendable {
    case native(SolanaNativeBalance)
    case fungibleToken(SolanaFungibleTokenBalance)
    public init(from decoder: Decoder) throws
}

SolanaNativeBalance

public struct SolanaNativeBalance: Codable, Sendable {
    public let network: SolanaNetwork
    public let accountAddress: String
    public let name: String
    public let symbol: String
    public let decimals: Int
    public let balance: String
    public let formattedBalance: String
    public let imageUrl: String?
    public let metadataUri: String?
    public let verificationStatus: SolanaVerificationStatus
    public let verificationSource: SolanaVerificationSource
    public let priceUSD: String?
    public let balanceUSD: String?
    public init(from decoder: any Decoder) throws
}

SolanaFungibleTokenBalance

public struct SolanaFungibleTokenBalance: Codable, Sendable {
    public let network: SolanaNetwork
    public let accountAddress: String
    public let tokenProgram: SolanaTokenProgram
    public let mintAddress: String
    public let name: String
    public let symbol: String
    public let decimals: Int
    public let balance: String
    public let formattedBalance: String
    public let imageUrl: String?
    public let metadataUri: String?
    public let verificationStatus: SolanaVerificationStatus
    public let verificationSource: SolanaVerificationSource
    public let priceUSD: String?
    public let balanceUSD: String?
    public init(from decoder: any Decoder) throws
}

SolanaNetworkError

public struct SolanaNetworkError: Codable, Sendable {
    public let network: SolanaNetwork
    public let reason: String
    public init(from decoder: any Decoder) throws
}

SolanaVerificationStatus

public enum SolanaVerificationStatus: String, Codable, Sendable {
    case verified
    case unverified
    case unknown
    public init?(rawValue: String)
}

SolanaVerificationSource

public enum SolanaVerificationSource: String, Codable, Sendable {
    case jupiter
    case solflareUtl = "solflare-utl"
    case none
    public init?(rawValue: String)
}

SolanaTokenProgram

public enum SolanaTokenProgram: String, Codable, Sendable {
    case splToken = "spl-token"
    case token2022 = "token-2022"
    public init?(rawValue: String)
}

GetBalancesParams

public struct GetBalancesParams: Sendable {
    public let walletAddress: String
    public let networks: [Network]?
    public let networkType: IndexerNetworkType?
    public let contractAddresses: [String]?
    public let includeMetadata: Bool
    public let omitPrices: Bool?
    public let tokenIds: [String]?
    public let contractStatus: ContractVerificationStatus?
    public let page: TokenBalancesPageRequest?
    public init(walletAddress: String, networks: [Network]? = nil, networkType: IndexerNetworkType? = nil, contractAddresses: [String]? = nil, includeMetadata: Bool = true, omitPrices: Bool? = nil, tokenIds: [String]? = nil, contractStatus: ContractVerificationStatus? = nil, page: TokenBalancesPageRequest? = nil)
}

BalancesResult

public struct BalancesResult: Sendable {
    public let status: Int
    public let page: TokenBalancesPage?
    public let nativeBalances: [NativeTokenBalance]
    public let balances: [ContractTokenBalance]
    public init(status: Int, page: TokenBalancesPage?, nativeBalances: [NativeTokenBalance], balances: [ContractTokenBalance])
}

NativeTokenBalance

public struct NativeTokenBalance: Codable, Sendable {
    public let contractType: String
    public let accountAddress: String
    public let name: String
    public let symbol: String
    public let balance: String
    public let chainId: Int64
    public let balanceUSD: String?
    public let priceUSD: String?
    public let priceUpdatedAt: String?
    public init(accountAddress: String, name: String, symbol: String, balance: String, chainId: Int64, balanceUSD: String? = nil, priceUSD: String? = nil, priceUpdatedAt: String? = nil)
    public init(from decoder: Decoder) throws
    public func encode(to encoder: Encoder) throws
}

ContractTokenBalance

public struct ContractTokenBalance: Codable, Sendable {
    public let contractType: String
    public let contractAddress: String
    public let accountAddress: String
    public let tokenId: String
    public let balance: String
    public let blockHash: String
    public let blockNumber: Int64
    public let chainId: Int64
    public let balanceUSD: String?
    public let priceUSD: String?
    public let priceUpdatedAt: String?
    public let uniqueCollectibles: String?
    public let isSummary: Bool?
    public let contractInfo: TokenContractInfo?
    public let tokenMetadata: TokenMetadata?
    public init(contractType: String, contractAddress: String, accountAddress: String, tokenId: String, balance: String, blockHash: String, blockNumber: Int64, chainId: Int64, balanceUSD: String? = nil, priceUSD: String? = nil, priceUpdatedAt: String? = nil, uniqueCollectibles: String? = nil, isSummary: Bool? = nil, contractInfo: TokenContractInfo? = nil, tokenMetadata: TokenMetadata? = nil)
    public init(from decoder: Decoder) throws
    public func encode(to encoder: Encoder) throws
}

TokenBalance

public enum TokenBalance: Sendable {
    case native(NativeTokenBalance)
    case contract(ContractTokenBalance)
    public var contractType: String { get }
    public var accountAddress: String { get }
    public var balance: String { get }
    public var chainId: Int64 { get }
    public var balanceUSD: String? { get }
    public var priceUSD: String? { get }
    public var priceUpdatedAt: String? { get }
}

TokenBalancesPage

public struct TokenBalancesPage: Codable, Sendable {
    public let page: Int
    public let column: String?
    public let before: JSONValue?
    public let after: JSONValue?
    public let sort: [SortBy]?
    public let pageSize: Int
    public let more: Bool
    public init(page: Int, column: String? = nil, before: JSONValue? = nil, after: JSONValue? = nil, sort: [SortBy]? = nil, pageSize: Int, more: Bool)
    public init(from decoder: any Decoder) throws
}

TokenBalancesPageRequest

public struct TokenBalancesPageRequest: Codable, Sendable {
    public let page: Int?
    public let column: String?
    public let before: JSONValue?
    public let after: JSONValue?
    public let sort: [SortBy]?
    public let pageSize: Int?
    public init(page: Int? = nil, column: String? = nil, before: JSONValue? = nil, after: JSONValue? = nil, sort: [SortBy]? = nil, pageSize: Int? = nil)
    public init(from decoder: any Decoder) throws
}

TokenContractInfo

public struct TokenContractInfo: Codable, Sendable {
    public let chainId: Int64
    public let address: String
    public let source: String
    public let name: String
    public let type: String
    public let symbol: String
    public let decimals: Int?
    public let logoURI: String?
    public let deployed: Bool
    public let bytecodeHash: String
    public let extensions: [String : JSONValue]
    public let updatedAt: String
    public let queuedAt: String?
    public let status: String
    public init(chainId: Int64, address: String, source: String, name: String, type: String, symbol: String, decimals: Int? = nil, logoURI: String? = nil, deployed: Bool, bytecodeHash: String, extensions: [String : JSONValue], updatedAt: String, queuedAt: String? = nil, status: String)
    public init(from decoder: any Decoder) throws
}

TokenMetadata

public struct TokenMetadata: Codable, Sendable {
    public let chainId: Int64?
    public let contractAddress: String?
    public let tokenId: String
    public let source: String
    public let name: String
    public let description: String?
    public let image: String?
    public let video: String?
    public let audio: String?
    public let properties: [String : JSONValue]?
    public let attributes: [[String : JSONValue]]
    public let imageData: String?
    public let externalUrl: String?
    public let backgroundColor: String?
    public let animationUrl: String?
    public let decimals: Int?
    public let updatedAt: String?
    public let assets: [TokenMetadataAsset]?
    public let status: String
    public let queuedAt: String?
    public let lastFetched: String?
    public init(chainId: Int64? = nil, contractAddress: String? = nil, tokenId: String, source: String, name: String, description: String? = nil, image: String? = nil, video: String? = nil, audio: String? = nil, properties: [String : JSONValue]? = nil, attributes: [[String : JSONValue]], imageData: String? = nil, externalUrl: String? = nil, backgroundColor: String? = nil, animationUrl: String? = nil, decimals: Int? = nil, updatedAt: String? = nil, assets: [TokenMetadataAsset]? = nil, status: String, queuedAt: String? = nil, lastFetched: String? = nil)
    public init(from decoder: Decoder) throws
    public func encode(to encoder: Encoder) throws
}

TokenMetadataAsset

public struct TokenMetadataAsset: Codable, Sendable {
    public let id: Int64?
    public let collectionId: Int64?
    public let tokenId: String?
    public let url: String?
    public let metadataField: String?
    public let name: String?
    public let filesize: Int64?
    public let mimeType: String?
    public let width: Int?
    public let height: Int?
    public let updatedAt: String?
    public init(id: Int64? = nil, collectionId: Int64? = nil, tokenId: String? = nil, url: String? = nil, metadataField: String? = nil, name: String? = nil, filesize: Int64? = nil, mimeType: String? = nil, width: Int? = nil, height: Int? = nil, updatedAt: String? = nil)
    public init(from decoder: Decoder) throws
    public func encode(to encoder: Encoder) throws
}

GetTransactionHistoryParams

public struct GetTransactionHistoryParams: Sendable {
    public let walletAddress: String
    public let networks: [Network]?
    public let networkType: IndexerNetworkType?
    public let contractAddresses: [String]?
    public let transactionHashes: [String]?
    public let metaTransactionIds: [String]?
    public let fromBlock: Int?
    public let toBlock: Int?
    public let tokenId: String?
    public let includeMetadata: Bool
    public let omitPrices: Bool?
    public let metadataOptions: MetadataOptions?
    public let page: TokenBalancesPageRequest?
    public init(walletAddress: String, networks: [Network]? = nil, networkType: IndexerNetworkType? = nil, contractAddresses: [String]? = nil, transactionHashes: [String]? = nil, metaTransactionIds: [String]? = nil, fromBlock: Int? = nil, toBlock: Int? = nil, tokenId: String? = nil, includeMetadata: Bool = true, omitPrices: Bool? = nil, metadataOptions: MetadataOptions? = nil, page: TokenBalancesPageRequest? = nil)
}

TransactionHistoryResult

public struct TransactionHistoryResult: Sendable {
    public let status: Int
    public let page: TokenBalancesPage?
    public let transactions: [Transaction]
    public init(status: Int, page: TokenBalancesPage?, transactions: [Transaction])
}

Transaction

public struct Transaction: Codable, Sendable {
    public let txnHash: String
    public let blockNumber: Int64
    public let blockHash: String
    public let chainId: Int64
    public let metaTxnId: String?
    public let transfers: [TransactionTransfer]
    public let timestamp: String
    public init(txnHash: String, blockNumber: Int64, blockHash: String, chainId: Int64, metaTxnId: String? = nil, transfers: [TransactionTransfer] = [], timestamp: String)
    public init(from decoder: Decoder) throws
    public func encode(to encoder: Encoder) throws
}

TransactionTransfer

public struct TransactionTransfer: Codable, Sendable {
    public let transferType: String
    public let contractAddress: String
    public let contractType: String
    public let from: String
    public let to: String
    public let tokenIds: [String]?
    public let amounts: [String]
    public let logIndex: Int
    public let amountsUSD: [String]?
    public let pricesUSD: [String]?
    public let contractInfo: TokenContractInfo?
    public let tokenMetadata: [String : TokenMetadata]?
    public init(transferType: String, contractAddress: String, contractType: String, from: String, to: String, tokenIds: [String]? = nil, amounts: [String], logIndex: Int, amountsUSD: [String]? = nil, pricesUSD: [String]? = nil, contractInfo: TokenContractInfo? = nil, tokenMetadata: [String : TokenMetadata]? = nil)
    public init(from decoder: Decoder) throws
    public func encode(to encoder: Encoder) throws
}

IndexerNetworkType

public enum IndexerNetworkType: String, Codable, Sendable {
    case mainnets = "MAINNETS"
    case testnets = "TESTNETS"
    case all = "ALL"
    public init?(rawValue: String)
}

ContractVerificationStatus

public enum ContractVerificationStatus: String, Codable, Sendable {
    case verified = "VERIFIED"
    case unverified = "UNVERIFIED"
    case all = "ALL"
    public init?(rawValue: String)
}

MetadataOptions

public struct MetadataOptions: Codable, Sendable {
    public let verifiedOnly: Bool?
    public let unverifiedOnly: Bool?
    public let includeContracts: [String]?
    public init(verifiedOnly: Bool? = nil, unverifiedOnly: Bool? = nil, includeContracts: [String]? = nil)
    public init(from decoder: any Decoder) throws
}

Page

public struct Page: Codable, Equatable, Sendable {
    public let limit: UInt32?
    public let cursor: String?
    public init(limit: UInt32? = nil, cursor: String? = nil)
    public init(from decoder: any Decoder) throws
}

SortBy

public struct SortBy: Codable, Sendable {
    public let column: String
    public let order: SortOrder
    public init(column: String, order: SortOrder)
    public init(from decoder: any Decoder) throws
}

SortOrder

public enum SortOrder: String, Codable, Sendable {
    case descending = "DESC"
    case ascending = "ASC"
    public init?(rawValue: String)
}

Networks, types, and errors

Network

public enum Network: String, CaseIterable, Sendable, CustomStringConvertible {
    case mainnet
    case sepolia
    case polygon
    case polygonAmoy = "amoy"
    case arbitrum
    case arbitrumSepolia = "arbitrum-sepolia"
    case optimism
    case optimismSepolia = "optimism-sepolia"
    case base
    case baseSepolia = "base-sepolia"
    case bsc
    case bscTestnet = "bsc-testnet"
    case arbitrumNova = "arbitrum-nova"
    case avalanche
    case avalancheTestnet = "avalanche-testnet"
    case katana
    public static let amoy: Network
    public var id: Int { get }
    public var chainId: String { get }
    public var name: String { get }
    public var nativeTokenSymbol: String { get }
    public var explorerUrl: String { get }
    public var explorerURL: URL { get }
    public var displayName: String { get }
    public var description: String { get }
    public static var supportedNetworks: [Network] { get }
    public static func findById(_ chainId: Int) -> Network?
    public static func findByName(_ name: String) -> Network?
    public init?(rawValue: String)
}

SolanaNetwork

public enum SolanaNetwork: String, CaseIterable, Codable, Sendable, CustomStringConvertible {
    case devnet = "solana:devnet"
    case mainnet = "solana:mainnet"
    public var description: String { get }
    public init?(rawValue: String)
}

SolanaNetworks

public enum SolanaNetworks {
    public static let devnet: SolanaNetwork
    public static let mainnet: SolanaNetwork
}

JSONValue

public enum JSONValue: Codable, Equatable, Sendable {
    case object([String: JSONValue])
    case array([JSONValue])
    case string(String)
    case integer(Int64)
    case unsignedInteger(UInt64)
    case number(Double)
    case bool(Bool)
    case null
    public init(from decoder: Decoder) throws
    public func encode(to encoder: Encoder) throws
}

JSON value used by SDK APIs that accept or return dynamic JSON payloads.

OMSWalletError

public struct OMSWalletError: Error, LocalizedError, @unchecked Sendable {
    public let code: OMSWalletErrorCode
    public let operation: OMSWalletOperation?
    public let status: Int?
    public let txnId: String?
    public let retryable: Bool?
    public let upstreamError: OMSWalletUpstreamError?
    public let underlyingError: (any Error)?
    public var errorDescription: String? { get }
}

OMSWalletErrorCode

public enum OMSWalletErrorCode: String, Sendable {
    case httpError = "OMS_HTTP_ERROR"
    case invalidResponse = "OMS_INVALID_RESPONSE"
    case requestFailed = "OMS_REQUEST_FAILED"
    case authCommitmentConsumed = "OMS_AUTH_COMMITMENT_CONSUMED"
    case sessionMissing = "OMS_SESSION_MISSING"
    case sessionExpired = "OMS_SESSION_EXPIRED"
    case walletSelectionStale = "OMS_WALLET_SELECTION_STALE"
    case walletSelectionUnavailable = "OMS_WALLET_SELECTION_UNAVAILABLE"
    case walletSelectionInFlight = "OMS_WALLET_SELECTION_IN_FLIGHT"
    case transactionExecutionUnconfirmed = "OMS_TRANSACTION_EXECUTION_UNCONFIRMED"
    case transactionStatusLookupFailed = "OMS_TRANSACTION_STATUS_LOOKUP_FAILED"
    case validationError = "OMS_VALIDATION_ERROR"
    case storageError = "OMS_STORAGE_ERROR"
    case attestationVerificationFailed = "OMS_ATTESTATION_VERIFICATION_FAILED"
    public init?(rawValue: String)
}

OMSWalletOperation

public enum OMSWalletOperation: String, Sendable {
    case pendingWalletSelection = "wallet.pendingWalletSelection"
    case pendingWalletSelectionSelectWallet = "wallet.pendingWalletSelection.selectWallet"
    case pendingWalletSelectionCreateAndSelectWallet = "wallet.pendingWalletSelection.createAndSelectWallet"
    case walletStartEmailAuth = "wallet.startEmailAuth"
    case walletCompleteEmailAuth = "wallet.completeEmailAuth"
    case walletSignInWithOidcIdToken = "wallet.signInWithOidcIdToken"
    case walletStartOIDCRedirectAuth = "wallet.startOIDCRedirectAuth"
    case walletHandleOIDCRedirectCallback = "wallet.handleOIDCRedirectCallback"
    case walletUseWallet = "wallet.useWallet"
    case walletCreateWallet = "wallet.createWallet"
    case walletImportWallet = "wallet.importWallet"
    case walletGetImportRecipientKey = "wallet.getWalletImportRecipientKey"
    case walletImportEncryptedWallet = "wallet.importEncryptedWallet"
    case walletListWallets = "wallet.listWallets"
    case walletSignOut = "wallet.signOut"
    case walletListAccess = "wallet.listAccess"
    case walletListAccessPage = "wallet.listAccessPage"
    case walletListAccessPages = "wallet.listAccessPages"
    case walletInspectRemoteCredential = "wallet.inspectRemoteCredential"
    case walletAuthorizeRemoteAccess = "wallet.authorizeRemoteAccess"
    case walletGetRemoteAccessSession = "wallet.getRemoteAccessSession"
    case walletGetRemoteAccessSessionUsage = "wallet.getRemoteAccessSessionUsage"
    case walletGetIdToken = "wallet.getIdToken"
    case walletRevokeAccess = "wallet.revokeAccess"
    case walletSignMessage = "wallet.signMessage"
    case walletSignSolanaMessage = "wallet.signSolanaMessage"
    case walletSignTypedData = "wallet.signTypedData"
    case walletIsValidMessageSignature = "wallet.isValidMessageSignature"
    case walletIsValidSolanaMessageSignature = "wallet.isValidSolanaMessageSignature"
    case walletIsValidTypedDataSignature = "wallet.isValidTypedDataSignature"
    case walletSendTransaction = "wallet.sendTransaction"
    case walletSendSolanaTransfer = "wallet.sendSolanaTransfer"
    case walletCallContract = "wallet.callContract"
    case walletExecute = "wallet.execute"
    case walletGetTransactionStatus = "wallet.getTransactionStatus"
    case walletTransactionStatus = "wallet.transactionStatus"
    case indexerGetBalances = "indexer.getBalances"
    case indexerGetSolanaBalances = "indexer.getSolanaBalances"
    case indexerGetTransactionHistory = "indexer.getTransactionHistory"
    public init?(rawValue: String)
}

OMSWalletUpstreamError

public struct OMSWalletUpstreamError: Equatable, Sendable {
    public let service: OMSWalletUpstreamService
    public let name: String?
    public let code: String?
    public let message: String?
    public let status: Int?
}

OMSWalletUpstreamService

public enum OMSWalletUpstreamService: String, Sendable {
    case waas = "Waas"
    case indexer = "Indexer"
    public init?(rawValue: String)
}

UnitConversionError

public enum UnitConversionError: Error, Equatable {
    case invalidDecimals(Int)
    case invalidValue(String)
    case fractionalComponentExceedsDecimals(value: String, decimals: Int)
}

parseUnits(value:decimals:)

public func parseUnits(value: String, decimals: Int = 18) throws -> String

formatUnits(value:decimals:)

public func formatUnits(value: String, decimals: Int = 18) throws -> String