Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.spaceport.xyz/llms.txt

Use this file to discover all available pages before exploring further.

utils.SpaceportUtils Utility functions for the Spaceport SDK

Table of contents

General Methods

Job Status Methods

IPFS Properties

constructor

new SpaceportUtils(apiBaseUrl, client?): SpaceportUtils

Parameters

NameType
apiBaseUrlstring
client?SpaceportSDK

Returns

SpaceportUtils

General Methods

getNonce

getNonce(userAddress): Promise<number> Gets the current nonce for a user from the blockchain contract. This is required for generating valid signatures for contract interactions.

Parameters

NameTypeDescription
userAddress`0x${string}`The address to get the nonce for

Returns

Promise<number> The current nonce for the user

fetchQueueNonce

fetchQueueNonce(walletAddress): Promise<number> Fetch nonce from the queue service This gets the current nonce for transaction ordering from the queue management system.

Parameters

NameTypeDescription
walletAddressstringWallet address to fetch nonce for

Returns

Promise<number> Promise resolving to nonce number Example
const nonce = await sdk.utils.fetchQueueNonce('0x1234567890abcdef...');
console.log(`Current queue nonce: ${nonce}`);

Job Status Methods

pollJobStatus

pollJobStatus(jobId, options?): Promise<JobStatusResponse> Polls job status until completion or timeout. This function continuously checks the status of a job until it completes, fails, or times out.

Parameters

NameTypeDescription
jobIdstringThe ID of the job to poll
optionsJobStatusOptionsPolling options

Returns

Promise<JobStatusResponse> Promise that resolves with the final job status

IPFS Properties

ipfs

ipfs: Object IPFS utilities

Type declaration

NameTypeDescription
uploadFile(file: File) => Promise<string>-
uploadMetadata(metadata: Record<string, unknown>) => Promise<string>-