Interface IMXProvider

interface IMXProvider {
    getAddress(): Promise<string>;
    registerOffchain(): Promise<RegisterUserResponse>;
    isRegisteredOffchain(): Promise<boolean>;
    isRegisteredOnchain(): Promise<boolean>;
    createOrder(request: UnsignedOrderRequest): Promise<CreateOrderResponse>;
    cancelOrder(request: GetSignableCancelOrderRequest): Promise<CancelOrderResponse>;
    createTrade(request: GetSignableTradeRequest): Promise<CreateTradeResponse>;
    transfer(request: UnsignedTransferRequest): Promise<CreateTransferResponseV1>;
    batchNftTransfer(request: NftTransferDetails[]): Promise<CreateTransferResponse>;
    exchangeTransfer(request: UnsignedExchangeTransferRequest): Promise<CreateTransferResponseV1>;
    deposit(deposit: TokenAmount): Promise<TransactionResponse>;
    prepareWithdrawal(request: TokenAmount): Promise<CreateWithdrawalResponse>;
    completeWithdrawal(starkPublicKey: string, token: AnyToken): Promise<TransactionResponse>;
}

Implemented by

Methods

  • Get the Signer address

    Returns Promise<string>

    Returns a promise that resolves with the signer's address

  • Register a User to Immutable X if they are not already registered

    Returns Promise<RegisterUserResponse>

    Returns a promise that resolves with the user registration response

  • Checks if a User is registered off-chain

    Returns Promise<boolean>

    Returns a promise that resolves with true if the User is registered with IMX, false otherwise

  • Checks if a User is registered on-chain

    Returns Promise<boolean>

    Returns a promise that resolves with true if the User is registered, false otherwise

  • Create an Order

    Parameters

    Returns Promise<CreateOrderResponse>

    Returns a promise that resolves with the created Order

  • Cancel an Order

    Parameters

    Returns Promise<CancelOrderResponse>

    Returns a promise that resolves with the cancelled Order

  • Create a new Transfer request

    Parameters

    Returns Promise<CreateTransferResponseV1>

    Returns a promise that resolves with the created Transfer

  • Create a batch of NFT transfer requests

    Parameters

    Returns Promise<CreateTransferResponse>

    Resolves a promise that resolves with the list of Transfer IDs

  • Create a new Exchange transaction

    Parameters

    Returns Promise<CreateTransferResponseV1>

    Returns a promise that resolves with the created Exchange Transaction

  • Deposit either ETH, ERC20 or ERC721 tokens

    Parameters

    Returns Promise<TransactionResponse>

    Returns a promise that resolves with the transaction

  • Create a Withdrawal

    Parameters

    • request: TokenAmount

      The token type amount in its corresponding unit

    Returns Promise<CreateWithdrawalResponse>

    Returns a promise that resolves with the created Withdrawal

  • Completes a Withdrawal

    Parameters

    • starkPublicKey: string

      The stark public key

    • token: AnyToken

      The token to withdraw

    Returns Promise<TransactionResponse>

    Returns a promise that resolves with the transaction