Skip to main content

Class: MoneriumClient

In the Monerium UI, create an application to get the clientId and register your redirectUri.

import { MoneriumClient } from '@monerium/sdk';

const monerium = new MoneriumClient() // defaults to `sandbox`

// or
new MoneriumClient('production')

// or
new MoneriumClient({
environment: 'sandbox',
clientId: 'your-client-id',
redirectUri: 'http://your-redirect-url.com/monerium'
});

Constructors

new MoneriumClient()

new MoneriumClient(envOrOptions?: ENV | ClassOptions): MoneriumClient

Parameters

ParameterType
envOrOptions?ENV | ClassOptions

Returns

MoneriumClient

Default Value

sandbox

Properties

PropertyTypeDescription
bearerProfile?BearerProfileThe bearer profile will be available after authentication, it includes the access_token and refresh_token
isAuthorizedbooleanThe client is authorized if the bearer profile is available
stateundefined | stringThe state parameter is used to maintain state between the request and the callback.

Authentication

authorize()

authorize(params?: AuthFlowOptions): Promise<void>

Constructs the url to the authorization code flow and redirects, Code Verifier needed for the code challenge is stored in local storage For automatic wallet link, add the following properties: address, signature & chain

This authorization code is then used to request an access token via the token endpoint. (https://monerium.dev/api-docs#operation/auth-token)

Parameters

ParameterTypeDescription
params?AuthFlowOptionsthe auth flow params

Returns

Promise<void>

void

See

API Documentation


disconnect()

disconnect(): Promise<void>

Cleanups the localstorage and websocket connections

Returns

Promise<void>


getAccess()

getAccess(refreshToken?: string): Promise<boolean>

Will use the authorization code flow code to get access token

Parameters

ParameterTypeDescription
refreshToken?stringprovide the refresh token to get a new access token

Returns

Promise<boolean>

boolean to indicate if access has been granted

Example

  import { MoneriumClient } from '@monerium/sdk';
// Initialize the client with credentials
const monerium = new MoneriumClient({
environment: 'sandbox',
clientId: 'your_client_credentials_uuid', // replace with your client ID
clientSecret: 'your_client_secret', // replace with your client secret
});

await monerium.getAccess();

const refreshToken = monerium.bearerProfile?.refresh_token;

// TODO: store the refresh token securely

// reconnect...
await monerium.getAccess(refreshToken);

revokeAccess()

revokeAccess(): Promise<void>

Revokes access

Returns

Promise<void>


siwe()

siwe(params?: AuthFlowSIWEOptions): Promise<void>

Constructs the url to the authorization code flow and redirects, Code Verifier needed for the code challenge is stored in local storage

"Sign in with Ethereum" (SIWE) flow can be used for existing Monerium customers. In this case the payload must include a valid EIP-4361 (https://eips.ethereum.org/EIPS/eip-4361) message and signature. On successful authorization the authorization code is returned at once.

This authorization code is then used to request an access token via the token endpoint.

https://monerium.com/siwe

Parameters

ParameterTypeDescription
params?AuthFlowSIWEOptionsthe auth flow SIWE params

Returns

Promise<void>

void

See

API Documentation

Addresses

getAddress()

getAddress(address: string): Promise<Address>

Get details for a single address by using the address public key after the address has been successfully linked to Monerium.

Parameters

ParameterTypeDescription
addressstringThe public key of the blockchain account.

Returns

Promise<Address>

See

API Documentation

Example

 monerium.getAddress('0x1234567890abcdef1234567890abcdef12345678')

getAddresses()

getAddresses(params?: AddressesQueryParams): Promise<AddressesResponse>

Parameters

ParameterTypeDescription
params?AddressesQueryParamsNo required parameters.

Returns

Promise<AddressesResponse>

See

API Documentation


getBalances()

getBalances(address: string, chain: string | number, currencies?: Currency | Currency[]): Promise<Balances>

Parameters

ParameterType
addressstring
chainstring | number
currencies?Currency | Currency[]

Returns

Promise<Balances>

See

API Documentation


linkAddress()

linkAddress(payload: LinkAddress): Promise<LinkedAddress>

Add a new address to the profile

Parameters

ParameterType
payloadLinkAddress

Returns

Promise<LinkedAddress>

See

API Documentation

Profiles

getProfile()

getProfile(profile: string): Promise<Profile>

Parameters

ParameterTypeDescription
profilestringthe id of the profile to fetch.

Returns

Promise<Profile>

See

API Documentation


getProfiles()

getProfiles(params?: ProfilesQueryParams): Promise<ProfilesResponse>

Parameters

ParameterType
params?ProfilesQueryParams

Returns

Promise<ProfilesResponse>

See

API Documentation


submitProfileDetails()

submitProfileDetails(profile: string, body: SubmitProfileDetailsPayload): Promise<ResponseStatus>

Parameters

ParameterType
profilestring
bodySubmitProfileDetailsPayload

Returns

Promise<ResponseStatus>

See

API Documentation

IBANs

getIban()

getIban(iban: string): Promise<IBAN>

Fetch details about a single IBAN

Parameters

ParameterTypeDescription
ibanstringthe IBAN to fetch.

Returns

Promise<IBAN>

See

API Documentation


getIbans()

getIbans(queryParameters?: IbansQueryParams): Promise<IBANsResponse>

Fetch all IBANs for the profile

Parameters

ParameterType
queryParameters?IbansQueryParams

Returns

Promise<IBANsResponse>

See

API Documentation


moveIban()

moveIban(iban: string, payload: MoveIbanPayload): Promise<ResponseStatus>

Parameters

ParameterTypeDescription
ibanstringthe IBAN to move.
payloadMoveIbanPayloadthe payload to move the IBAN.

Returns

Promise<ResponseStatus>

See

API Documentation


requestIban()

requestIban(payload: RequestIbanPayload): Promise<ResponseStatus>

Parameters

ParameterTypeDescription
payloadRequestIbanPayload

Returns

Promise<ResponseStatus>

See

API Documentation

Orders

getOrder()

getOrder(orderId: string): Promise<Order>

Parameters

ParameterType
orderIdstring

Returns

Promise<Order>

See

API Documentation


getOrders()

getOrders(filter?: OrderFilter): Promise<OrdersResponse>

Parameters

ParameterType
filter?OrderFilter

Returns

Promise<OrdersResponse>

See

API Documentation


placeOrder()

placeOrder(order: NewOrder): Promise<Order>

Parameters

ParameterType
orderNewOrder

Returns

Promise<Order>

See

API Documentation


subscribeOrderNotifications()

subscribeOrderNotifications(params?: { filter: OrderNotificationQueryParams; onError: (err: Event) => void; onMessage: (data: Order) => void; }): undefined | WebSocket

Connects to the order notifications socket

Parameters

ParameterTypeDescription
params?{ filter: OrderNotificationQueryParams; onError: (err: Event) => void; onMessage: (data: Order) => void; }
params.filter?OrderNotificationQueryParamsspecify which type of orders to listen to
params.onError?(err: Event) => void-
params.onMessage?(data: Order) => void-

Returns

undefined | WebSocket

See

API Document - Websocket


unsubscribeOrderNotifications()

unsubscribeOrderNotifications(params?: OrderNotificationQueryParams): void

Closes the order notifications sockets

Parameters

ParameterTypeDescription
params?OrderNotificationQueryParamsspecify which socket to close or close all if not provided

Returns

void

See

API Document - Websocket


uploadSupportingDocument()

uploadSupportingDocument(document: File): Promise<SupportingDoc>

Parameters

ParameterType
documentFile

Returns

Promise<SupportingDoc>

See

API Documentation

Tokens

getTokens()

getTokens(): Promise<Token[]>

Returns

Promise<Token[]>

See

API Documentation