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

Defined in

client.ts:116

Properties

PropertyTypeDescriptionDefined in
bearerProfile?BearerProfileThe bearer profile will be available after authentication, it includes the access_token and refresh_tokenclient.ts:95
isAuthorizedbooleanThe client is authorized if the bearer profile is availableclient.ts:103
stateundefined | stringThe state parameter is used to maintain state between the request and the callback.client.ts:111

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

Defined in

client.ts:169


disconnect()

disconnect(): Promise<void>

Cleanups the localstorage and websocket connections

Returns

Promise<void>

Defined in

client.ts:815


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);

Defined in

client.ts:270


revokeAccess()

revokeAccess(): Promise<void>

Revokes access

Returns

Promise<void>

Defined in

client.ts:828


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

Defined in

client.ts:219

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')

Defined in

client.ts:456


getAddresses()

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

Parameters

ParameterTypeDescription
params?AddressesQueryParamsNo required parameters.

Returns

Promise<AddressesResponse>

See

API Documentation

Defined in

client.ts:465


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

Defined in

client.ts:478


linkAddress()

linkAddress(payload: LinkAddress): Promise<LinkedAddress>

Add a new address to the profile

Parameters

ParameterType
payloadLinkAddress

Returns

Promise<LinkedAddress>

See

API Documentation

Defined in

client.ts:549

Profiles

getProfile()

getProfile(profile: string): Promise<Profile>

Parameters

ParameterTypeDescription
profilestringthe id of the profile to fetch.

Returns

Promise<Profile>

See

API Documentation

Defined in

client.ts:432


getProfiles()

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

Parameters

ParameterType
params?ProfilesQueryParams

Returns

Promise<ProfilesResponse>

See

API Documentation

Defined in

client.ts:439


submitProfileDetails()

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

Parameters

ParameterType
profilestring
bodySubmitProfileDetailsPayload

Returns

Promise<ResponseStatus>

See

API Documentation

Defined in

client.ts:624

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

Defined in

client.ts:504


getIbans()

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

Fetch all IBANs for the profile

Parameters

ParameterType
queryParameters?IbansQueryParams

Returns

Promise<IBANsResponse>

See

API Documentation

Defined in

client.ts:512


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

Defined in

client.ts:585


requestIban()

requestIban(payload: RequestIbanPayload): Promise<ResponseStatus>

Parameters

ParameterTypeDescription
payloadRequestIbanPayload

Returns

Promise<ResponseStatus>

See

API Documentation

Defined in

client.ts:604

Orders

getOrder()

getOrder(orderId: string): Promise<Order>

Parameters

ParameterType
orderIdstring

Returns

Promise<Order>

See

API Documentation

Defined in

client.ts:532


getOrders()

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

Parameters

ParameterType
filter?OrderFilter

Returns

Promise<OrdersResponse>

See

API Documentation

Defined in

client.ts:525


placeOrder()

placeOrder(order: NewOrder): Promise<Order>

Parameters

ParameterType
orderNewOrder

Returns

Promise<Order>

See

API Documentation

Defined in

client.ts:563


subscribeOrderNotifications()

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

Connects to the order notifications socket

Parameters

ParameterTypeDescription
params?object
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

Defined in

client.ts:731


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

Defined in

client.ts:789


uploadSupportingDocument()

uploadSupportingDocument(document: File): Promise<SupportingDoc>

Parameters

ParameterType
documentFile

Returns

Promise<SupportingDoc>

See

API Documentation

Defined in

client.ts:639

Tokens

getTokens()

getTokens(): Promise<Token[]>

Returns

Promise<Token[]>

See

API Documentation

Defined in

client.ts:540