Skip to main content

Class: MoneriumClient

Constructors

new MoneriumClient()

new MoneriumClient(envOrOptions?): MoneriumClient

Parameters

envOrOptions?: ENV | ClassOptions

Returns

MoneriumClient

Default Value

sandbox

Example

new MoneriumClient() // defaults to `sandbox`

new MoneriumClient('production')

new MoneriumClient({
environment: 'sandbox',
clientId: 'your-client-id',
redirectUri: 'your-redirect-url'
})

Defined in

client.ts:90

Properties

bearerProfile?

optional bearerProfile: BearerProfile

The bearer profile will be available after authentication, it includes the access_token and refresh_token

Defined in

client.ts:61


isAuthorized

isAuthorized: boolean = !!this.bearerProfile

Defined in

client.ts:69


state

state: undefined | string

The state parameter is used to maintain state between the request and the callback.

Defined in

client.ts:75

Methods

Auth

authorize()

authorize(client?): Promise<void>

Construct 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

Parameters

client?: AuthFlowOptions

Returns

Promise<void>

string https://monerium.dev/api-docs#operation/auth

Defined in

client.ts:130


disconnect()

disconnect(): Promise<void>

Cleanups the socket and the subscriptions

Returns

Promise<void>

Defined in

client.ts:525


getAccess()

getAccess(client?): Promise<boolean>

Will redirect to the authorization code flow and store the code verifier in the local storage

Parameters

client?: ClientCredentials | AuthorizationCodeCredentials | DeprecatedAuthorizationCodeCredentials

the client credentials

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();
Defined in

client.ts:176


getAuthContext()

getAuthContext(): Promise<AuthContext>

https://monerium.dev/api-docs#operation/auth-context

Returns

Promise<AuthContext>

Defined in

client.ts:298


revokeAccess()

revokeAccess(): Promise<void>

Revokes access

Returns

Promise<void>

Defined in

client.ts:538

Accounts

getBalances()

getBalances(profileId?): Promise<Balances[]>

https://monerium.dev/api-docs#operation/profile-balances

Parameters

profileId?: string

the id of the profile to fetch balances.

Returns

Promise<Balances[]>

Defined in

client.ts:322


linkAddress()

linkAddress(profileId, body): Promise<LinkedAddress>

https://monerium.dev/api-docs#operation/profile-addresses

Parameters

profileId: string

body: LinkAddress

Returns

Promise<LinkedAddress>

Defined in

client.ts:361

Profiles

getProfile()

getProfile(profileId): Promise<Profile>

https://monerium.dev/api-docs#operation/profile

Parameters

profileId: string

the id of the profile to fetch.

Returns

Promise<Profile>

Defined in

client.ts:307


getProfiles()

getProfiles(): Promise<Profile[]>

https://monerium.dev/api-docs#operation/profiles

Returns

Promise<Profile[]>

Defined in

client.ts:314

Orders

connectOrderSocket()

connectOrderSocket(): Promise<void>

Connects to the order notifications socket

Returns

Promise<void>

Defined in

client.ts:482


getOrder()

getOrder(orderId): Promise<Order>

https://monerium.dev/api-docs#operation/order

Parameters

orderId: string

Returns

Promise<Order>

Defined in

client.ts:343


getOrders()

getOrders(filter?): Promise<Order[]>

https://monerium.dev/api-docs#operation/orders

Parameters

filter?: OrderFilter

Returns

Promise<Order[]>

Defined in

client.ts:334


placeOrder()

placeOrder(order): Promise<Order>

https://monerium.dev/api-docs#operation/post-orders

Parameters

order: NewOrder

Returns

Promise<Order>

Defined in

client.ts:376


subscribeOrders()

subscribeOrders(event, handler): void

Subscribe to MoneriumEvent to receive notifications using the Monerium API (WebSocket) We are setting a subscription map because we need the user to have a token to start the WebSocket connection https://monerium.dev/api-docs#operation/profile-orders-notifications

Parameters

event: OrderState

The event to subscribe to

handler: MoneriumEventListener

The handler to be called when the event is triggered

Returns

void

Defined in

client.ts:554


subscribeToOrderNotifications()

subscribeToOrderNotifications(): WebSocket

Subscribes to the order notifications socket

Returns

WebSocket

Defined in

client.ts:493


unsubscribeOrders()

unsubscribeOrders(event): void

Unsubscribe from MoneriumEvent and close the socket if there are no more subscriptions

Parameters

event: OrderState

The event to unsubscribe from

Returns

void

Defined in

client.ts:563


uploadSupportingDocument()

uploadSupportingDocument(document): Promise<SupportingDoc>

https://monerium.dev/api-docs#operation/supporting-document

Parameters

document: File

Returns

Promise<SupportingDoc>

Defined in

client.ts:393

Tokens

getTokens()

getTokens(): Promise<Token[]>

https://monerium.dev/api-docs#operation/tokens

Returns

Promise<Token[]>

Defined in

client.ts:351