@monerium/sdk 3.5.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,22 +1,47 @@
1
- type TransportRequest = {
2
- method: string;
3
- url: string;
4
- headers: Record<string, string>;
5
- body?: BodyInit | string;
6
- signal?: AbortSignal;
7
- };
8
- type TransportResponse = {
9
- status: number;
10
- headers?: Record<string, string>;
11
- bodyText: string;
1
+ /**
2
+ * Generate a cryptographically random PKCE code verifier (RFC 7636).
3
+ * Returns a base64url-encoded string of 32 random bytes (256 bits of entropy).
4
+ * The caller is responsible for storing this until the callback.
5
+ * @group Auth
6
+ * @category Functions
7
+ */
8
+ declare const randomPKCECodeVerifier: () => string;
9
+ /**
10
+ * Derive the S256 code challenge from a code verifier.
11
+ * Synchronous. Returns a base64url-encoded SHA-256 hash.
12
+ * @group Auth
13
+ * @category Functions
14
+ */
15
+ declare const calculatePKCECodeChallenge: (codeVerifier: string) => string;
16
+ /**
17
+ * Generate a new PKCE code verifier and its corresponding challenge.
18
+ * @group Auth
19
+ * @category Functions
20
+ */
21
+ declare const generatePKCE: () => {
22
+ codeVerifier: string;
23
+ codeChallenge: string;
12
24
  };
25
+ interface ParsedAuthorizationResponse {
26
+ code?: string;
27
+ state?: string;
28
+ error?: string;
29
+ errorDescription?: string;
30
+ }
13
31
  /**
14
- * Replaces the internal `fetch` call. Headers (`Authorization`, `Content-Type`,
15
- * `Accept`) are pre-populated. Must return a `Promise` resolving with the raw
16
- * response `status` and `bodyText`. Throw on network-level failures.
17
- * The SDK owns JSON parsing and error normalisation.
32
+ * Parse a callback URL or query string into structured fields.
33
+ *
34
+ * - Returns an empty object if none of the expected parameters are present.
35
+ * - Check for the presence of `code` or `error` to determine if the URL
36
+ * contains an OAuth2 authorization response.
37
+ *
38
+ * @example
39
+ * const { code, error } = parseAuthorizationResponse(req.url);
40
+ * const { code, error } = parseAuthorizationResponse('?code=abc&state=xyz');
41
+ * @group Auth
42
+ * @category Functions
18
43
  */
19
- type Transport = (request: TransportRequest) => Promise<TransportResponse>;
44
+ declare const parseAuthorizationResponse: (input: string) => ParsedAuthorizationResponse;
20
45
 
21
46
  /**
22
47
  * Single source of truth for all supported EVM chain pairs.
@@ -102,70 +127,96 @@ declare const EVM_CHAIN_PAIRS: readonly [{
102
127
  readonly chainId: 501;
103
128
  };
104
129
  }];
105
- type ProductionChain = (typeof EVM_CHAIN_PAIRS)[number]['production']['id'] | 'noble';
106
- type SandboxChain = (typeof EVM_CHAIN_PAIRS)[number]['sandbox']['id'] | 'grand';
130
+ /**
131
+ * All supported production chain names.
132
+ * @group Primitives
133
+ */
134
+ type ProductionChain = 'ethereum' | 'gnosis' | 'polygon' | 'arbitrum' | 'linea' | 'scroll' | 'base' | 'camino' | 'noble';
135
+ /**
136
+ * All supported sandbox chain names.
137
+ * @group Primitives
138
+ */
139
+ type SandboxChain = 'sepolia' | 'chiado' | 'amoy' | 'arbitrumsepolia' | 'lineasepolia' | 'scrollsepolia' | 'basesepolia' | 'columbus' | 'grand';
107
140
  /**
108
141
  * All known EVM chain IDs. The union extends `number` for backwards
109
142
  * compatibility — known values are listed in EVM_CHAIN_PAIRS above.
143
+ * @group Primitives
110
144
  */
111
145
  type EvmChainId = number | (typeof EVM_CHAIN_PAIRS)[number]['production' | 'sandbox']['chainId'];
146
+ /**
147
+ * @group Primitives
148
+ */
149
+ type Chain = ProductionChain | SandboxChain;
150
+ /**
151
+ * @group Primitives
152
+ */
153
+ type ChainId = EvmChainId | CosmosChainId;
154
+ /**
155
+ * @group Primitives
156
+ */
157
+ type CosmosChainId = 'noble-1' | 'grand-1' | 'florin-1';
112
158
 
159
+ /**
160
+ * @group Primitives
161
+ */
113
162
  type Environment = {
114
163
  name: ENV;
115
164
  api: string;
116
165
  web: string;
117
- wss: string;
118
166
  };
167
+ /**
168
+ * @group Primitives
169
+ */
119
170
  type Config = {
120
171
  environments: {
121
172
  production: Environment;
122
173
  sandbox: Environment;
123
174
  };
124
175
  };
176
+ /**
177
+ * @group Primitives
178
+ */
125
179
  type ENV = 'sandbox' | 'production';
126
-
127
- type Chain = string | ProductionChain | SandboxChain;
128
- type ChainId = EvmChainId | CosmosChainId;
129
- type CosmosChainId = 'noble-1' | 'grand-1' | 'florin-1';
180
+ /**
181
+ * @group Tokens
182
+ */
130
183
  declare enum Currency {
131
184
  eur = "eur",
132
185
  usd = "usd",
133
186
  gbp = "gbp",
134
187
  isk = "isk"
135
188
  }
189
+ /**
190
+ * @group Tokens
191
+ */
136
192
  type TokenSymbol = 'EURe' | 'GBPe' | 'USDe' | 'ISKe';
193
+ /**
194
+ * @group Tokens
195
+ */
137
196
  type Ticker = 'EUR' | 'GBP' | 'USD' | 'ISK';
197
+ /**
198
+ * @group Tokens
199
+ */
138
200
  type CurrencyCode = 'eur' | 'gbp' | 'usd' | 'isk';
139
- type AuthArgs = Omit<AuthCodePayload, 'grant_type'> | Omit<RefreshTokenPayload, 'grant_type'> | Omit<ClientCredentialsPayload, 'grant_type'>;
140
- /** One of the options for the {@link AuthArgs}.
141
- *
142
- * [Auth endpoint in API documentation:](https://docs.monerium.com/api#operation/auth).
143
- * */
144
- interface AuthCodePayload {
145
- grant_type: 'authorization_code';
146
- client_id: string;
147
- code: string;
148
- code_verifier: string;
149
- redirect_uri: string;
150
- }
151
- /** One of the options for the {@link AuthArgs}.
152
- *
153
- * [Auth endpoint in API documentation:](https://docs.monerium.com/api#operation/auth).
154
- * */
155
- interface RefreshTokenPayload {
156
- grant_type: 'refresh_token';
157
- client_id: string;
158
- refresh_token: string;
159
- }
160
- /** One of the options for the {@link AuthArgs}.
161
- *
162
- * [Auth endpoint in API documentation:](https://docs.monerium.com/api#operation/auth).
163
- * */
164
- interface ClientCredentialsPayload {
165
- grant_type: 'client_credentials';
166
- client_id: string;
167
- client_secret: string;
201
+ /**
202
+ * Information about the EURe token on different networks.
203
+ * @group Tokens
204
+ */
205
+ interface Token {
206
+ currency: Currency;
207
+ ticker: Ticker;
208
+ symbol: TokenSymbol;
209
+ chain: Chain;
210
+ /** The address of the EURe contract on this network */
211
+ address: string;
212
+ /** How many decimals this token supports */
213
+ decimals: number;
168
214
  }
215
+ /**
216
+ * Returned by all auth grant functions. Store server-side — never in the browser.
217
+ * @group Auth
218
+ * @category Types
219
+ */
169
220
  interface BearerProfile {
170
221
  access_token: string;
171
222
  token_type: string;
@@ -174,133 +225,82 @@ interface BearerProfile {
174
225
  profile: string;
175
226
  userId: string;
176
227
  }
177
- interface PKCERequestShared {
178
- /** the authentication flow client id of the application */
179
- client_id: string;
180
- /** the redirect uri of the application */
181
- redirect_uri?: string;
182
- /** the code challenge automatically generated by the SDK */
183
- code_challenge: string;
184
- /** the code challenge method for the authentication flow , handled by the SDK */
185
- code_challenge_method: 'S256';
186
- /** the state of the application */
187
- state?: string;
188
- }
189
228
  /**
190
- * @returns A {@link PKCERequest} object with properties omitted that are automatically computed in by the SDK.
229
+ * @group Profiles
191
230
  */
192
- type PKCERequestArgs = Omit<PKCERequest, 'code_challenge' | 'code_challenge_method' | 'response_type'>;
193
- interface PKCERequest extends PKCERequestShared {
194
- /** the response type of the authentication flow, handled by the SDK */
195
- response_type: 'code';
196
- /** the email of the user to prefill the login form */
197
- email?: string;
198
- /** @deprecated: will be removed, the scope of the application */
199
- scope?: string;
200
- /** the address of the wallet to automatically link */
201
- address?: string;
202
- /** the signature of the wallet to automatically link */
203
- signature?: string;
204
- /** The network of the wallet to automatically link */
205
- chain?: Chain | ChainId;
206
- /**
207
- * You can skip the connect wallet and request IBAN steps in the Authorization Flow and use the Link Address and Request IBAN API endpoints after you have gotten the authorization
208
- * @deprecated Account creation is no longer offered in the auth flow
209
- * */
210
- skip_create_account?: boolean;
211
- /** You can skip the KYC onboarding steps in the Authorization Flow and use the the details, additional data, and verifications API endpoints after you have gotten the authorization. */
212
- skip_kyc?: boolean;
213
- }
231
+ type Method = 'password' | 'resource' | 'jwt' | 'apiKey' | 'bearer';
214
232
  /**
215
- * @returns A {@link PKCESIWERequest} object with properties omitted that are automatically computed in by the SDK.
233
+ * @group Profiles
216
234
  */
217
- type PKCERSIWERequestArgs = Omit<PKCESIWERequest, 'code_challenge' | 'code_challenge_method' | 'authentication_method'>;
218
- interface PKCESIWERequest extends PKCERequestShared {
219
- /**
220
- * Authentication method used. The default is to redirect the user to Monerium login screen, where the user can either sign in, or go through the register flow.
221
- * `siwe` is only applicable for existing Monerium customers who have already linked at least one of their addresses with Monerium.
222
- **/
223
- authentication_method: 'siwe';
224
- /** An EIP-4361 compatible message. https://eips.ethereum.org/EIPS/eip-4361
225
- * https://monerium.com/siwe
226
- * */
227
- message: string;
228
- /** Signature for the SIWE message. Must include the 0x prefix. */
229
- signature: string;
230
- }
231
- declare enum Method {
232
- password = "password",
233
- resource = "resource",
234
- jwt = "jwt",
235
- apiKey = "apiKey",
236
- bearer = "bearer"
237
- }
235
+ type ProfileKind = 'corporate' | 'personal';
236
+ /**
237
+ * @ignore
238
+ * @deprecated Use ProfileKind instead
239
+ * */
238
240
  declare enum ProfileType {
239
241
  corporate = "corporate",
240
242
  personal = "personal"
241
243
  }
242
- declare enum Permission {
243
- read = "read",
244
- write = "write"
245
- }
246
- declare enum ProfileState {
247
- /** The profile has been created but no details have been submitted.*/
248
- created = "created",
249
- /** The details have been submitted and are being processed. */
250
- pending = "pending",
251
- /** The profile is active and all Monerium services are supported.*/
252
- approved = "approved",
253
- /**The applicant details did not meet the compliance requirements of Monerium. Details can be fixed and re-submitted for processing.*/
254
- rejected = "rejected",
255
- /**Monerium is unable to offer the applicant services because of compliance reasons. Details cannot be re-submitted.*/
256
- blocked = "blocked"
257
- }
258
- declare enum KYCState {
259
- absent = "absent",
260
- submitted = "submitted",
261
- pending = "pending",
262
- confirmed = "confirmed"
263
- }
264
- declare enum KYCOutcome {
265
- approved = "approved",
266
- rejected = "rejected",
267
- unknown = "unknown"
268
- }
269
- declare enum AccountState {
270
- requested = "requested",
271
- approved = "approved",
272
- pending = "pending",
273
- rejected = "rejected",
274
- closed = "closed"
275
- }
276
- interface KYC {
277
- state: KYCState;
278
- outcome: KYCOutcome;
279
- }
280
- declare enum PaymentStandard {
281
- iban = "iban",
282
- scan = "scan",
283
- chain = "chain",
284
- account = "account"
244
+ /**
245
+ * @group Profiles
246
+ */
247
+ type Permission = 'read' | 'write';
248
+ /**
249
+ * The state of the profile lifecycle.
250
+ * @group Profiles
251
+ */
252
+ type ProfileState = 'created' | 'incomplete' | 'submitted' | 'approved' | 'rejected';
253
+ /**
254
+ * KYC details section with its current state.
255
+ *
256
+ * @group Profiles
257
+ */
258
+ interface ProfileDetailsState {
259
+ state: ProfileState;
285
260
  }
286
261
  /**
287
- * The type of ID document. Passports, National ID cards, and driving licenses are supported.
288
- * The ID document must verify the person's name, birthday, and nationality
262
+ * Additional data section used for risk calculations.
263
+ *
264
+ * @group Profiles
289
265
  */
290
- declare enum IdDocumentKind {
291
- passport = "passport",
292
- nationalIdentityCard = "nationalIdentityCard",
293
- drivingLicense = "drivingLicense"
266
+ interface ProfileFormState {
267
+ state: ProfileState;
294
268
  }
295
- interface Identifier {
296
- standard: PaymentStandard;
297
- bic?: string;
269
+ /**
270
+ * The type of personal profile verification.
271
+ *
272
+ * @group Profiles
273
+ */
274
+ type PersonalVerificationKind = 'idDocument' | 'facialSimilarity' | 'proofOfResidency' | 'sourceOfFunds';
275
+ /**
276
+ * The type of corporate profile verification.
277
+ *
278
+ * @group Profiles
279
+ */
280
+ type CorporateVerificationKind = 'sourceOfFunds' | 'corporateName' | 'corporateAddress' | 'registrationNumber' | 'dateOfRegistration' | 'beneficialOwnership' | 'powerOfAttorney';
281
+ /**
282
+ * Verification items required for this profile, each with its current state.
283
+ *
284
+ * @group Profiles
285
+ */
286
+ interface ProfileVerificationState {
287
+ kind: PersonalVerificationKind | CorporateVerificationKind;
288
+ state: ProfileState;
298
289
  }
290
+ /**
291
+ * The type of ID document. Passports, National ID cards, and driving licenses are supported.
292
+ * The ID document must verify the person's name, birthday, and nationality.
293
+ * @group Profiles
294
+ */
295
+ type IdDocumentKind = 'passport' | 'nationalIdentityCard' | 'drivingLicense';
296
+ /**
297
+ * @group Profiles
298
+ */
299
299
  interface AuthContext {
300
300
  userId: string;
301
301
  email: string;
302
302
  name: string;
303
- roles: [] | null;
303
+ roles?: string[];
304
304
  auth: {
305
305
  method: Method;
306
306
  subject: string;
@@ -310,59 +310,108 @@ interface AuthContext {
310
310
  defaultProfile: string;
311
311
  profiles: {
312
312
  id: string;
313
- kind: ProfileType | 'unknown';
313
+ kind: ProfileKind | 'unknown';
314
314
  name: string;
315
315
  perms: Permission[];
316
316
  }[];
317
317
  }
318
+ /**
319
+ * @group Profiles
320
+ */
318
321
  interface ProfilesResponse {
319
- profiles: Profile[];
322
+ profiles: Omit<Profile, 'details' | 'form' | 'verifications'>[];
320
323
  }
324
+ /**
325
+ * @group Profiles
326
+ */
321
327
  interface Profile {
328
+ /** Unique identifier of the profile. The Profile ID is the main identifier used to represent ownership of other API resources */
322
329
  id: string;
330
+ /** String identifier specifying the type of the profile. */
331
+ kind: ProfileKind;
332
+ /** The Profile name. This can be a corporate or an individual. */
323
333
  name: string;
324
- kind: ProfileType;
334
+ /** The state of the profile lifecycle. */
325
335
  state: ProfileState;
336
+ /** KYC details section with its current state. */
337
+ details?: ProfileDetailsState;
338
+ /** The form data for the profile. */
339
+ form?: ProfileFormState;
340
+ /** Verification items required for this profile, each with its current state. */
341
+ verifications?: ProfileVerificationState[];
326
342
  }
327
- /** @deprecated use Profile */
328
- type ProfilePermissions = Profile;
329
- interface ProfilesQueryParams {
330
- /** profile state to filter by */
343
+ /**
344
+ * @group Profiles
345
+ */
346
+ interface GetProfilesParams {
347
+ /** Filter the list on the state of profiles */
331
348
  state?: ProfileState;
332
- /** profile kind to filter by */
333
- kind?: ProfileType;
349
+ /** Filter the list on the kind of profiles*/
350
+ kind?: ProfileKind;
334
351
  }
352
+ /**
353
+ * @group Profiles
354
+ */
335
355
  interface PersonalProfileDetails {
336
356
  idDocument: {
357
+ /** The document number. */
337
358
  number: string;
359
+ /** The type of ID document. Must verify the person's name, birthday, and nationality */
338
360
  kind: IdDocumentKind;
339
361
  };
340
362
  firstName: string;
341
363
  lastName: string;
364
+ /** Street and building number where the person lives. */
342
365
  address: string;
366
+ /** Postal code where the person lives. */
343
367
  postalCode: string;
368
+ /** City where the person lives. */
344
369
  city: string;
370
+ /**Two-letter country code [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) where the person lives */
345
371
  country: string;
372
+ /** State/County where the person lives. */
346
373
  countryState?: string;
374
+ /** Two-letter country code [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) for the person's nationality. */
347
375
  nationality: string;
376
+ /** The person's date of birth in `YYYY-MM-DD format. */
348
377
  birthday: string;
349
378
  }
350
- interface PersonalProfileDetailsRequest {
351
- personal: PersonalProfileDetails;
352
- }
379
+ /**
380
+ * @group Profiles
381
+ */
353
382
  type Representative = PersonalProfileDetails;
383
+ /**
384
+ * @group Profiles
385
+ */
354
386
  type Beneficiary = Omit<PersonalProfileDetails, 'idDocument'> & {
355
387
  /** Ownership in % that is between 25% and 100%. */
356
388
  ownershipPercentage: number;
357
389
  };
390
+ /**
391
+ * @group Profiles
392
+ */
358
393
  type Director = Omit<PersonalProfileDetails, 'idDocument'>;
394
+ /**
395
+ * @group Profiles
396
+ */
359
397
  interface CorporateProfileDetails {
360
398
  name: string;
361
399
  registrationNumber: string;
400
+ /** The company's registration date in the `YYYY-MM-DD` format. */
401
+ registrationDate?: string;
402
+ /** The company's VAT number */
403
+ vatNumber?: string;
404
+ /** The company's website */
405
+ website?: string;
406
+ /** Street and building number where the corporate is located. */
362
407
  address: string;
408
+ /** Postal code where the corporate is located. */
363
409
  postalCode: string;
410
+ /** City where the corporate is located. */
364
411
  city: string;
412
+ /** Two-letter country code [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) where the corporate is located */
365
413
  country: string;
414
+ /** State/County where the corporate is located. */
366
415
  countryState: string;
367
416
  /** List of individuals representing the company and authorized to act on it's behalf. */
368
417
  representatives: Representative[];
@@ -371,16 +420,138 @@ interface CorporateProfileDetails {
371
420
  /** List of Individual who has powers to legally bind the company (power of procuration). */
372
421
  directors: Director[];
373
422
  }
374
- interface CorporateProfileDetailsRequest {
423
+ /**
424
+ * @group Profiles
425
+ */
426
+ type UpdateProfileDetailsInput = {
427
+ /** The profile ID to update. */
428
+ profile: string;
429
+ personal: PersonalProfileDetails;
430
+ } | {
431
+ /** The profile ID to update. */
432
+ profile: string;
375
433
  corporate: CorporateProfileDetails;
434
+ };
435
+ /**
436
+ * @group Profiles
437
+ */
438
+ type PersonalProfileForm = {
439
+ /** The occupation code representing the individual's current employment status. */
440
+ occupation: 'OCCUPATION_STUDENT' | 'OCCUPATION_EMPLOYED' | 'OCCUPATION_SELF_EMPLOYED' | 'OCCUPATION_UNEMPLOYED' | 'OCCUPATION_RETIRED';
441
+ /** The profession code representing the individual's professional field. */
442
+ profession: 'PROF_ACCOUNTANCY' | 'PROF_ADMINISTRATIVE' | 'PROF_AGRICULTURE' | 'PROF_ARTS_MEDIA' | 'PROF_BROKER_DEALER' | 'PROF_CATERING_HOSPITALITY' | 'PROF_CHARITY' | 'PROF_CONSTRUCTION_REAL_ESTATE' | 'PROF_DEALER_HIGH_VALUE_GOODS' | 'PROF_DEALER_PRECIOUS_METALS' | 'PROF_EDUCATION' | 'PROF_EMERGENCY_SERVICES' | 'PROF_EXTRACTIVE_INDUSTRY' | 'PROF_FIN_SERVICES_BANKING' | 'PROF_FIN_SERVICES_INSURANCE' | 'PROF_FIN_SERVICES_OTHER' | 'PROF_FIN_SERVICES_PRIVATE_BANKING' | 'PROF_GAMBLING' | 'PROF_GOVERNMENT' | 'PROF_HEALTHCARE_MEDICAL' | 'PROF_INFORMATION_TECHNOLOGY' | 'PROF_LEGAL' | 'PROF_MANUFACTURING' | 'PROF_MARKETING' | 'PROF_MILITARY_DEFENCE' | 'PROF_MONEY_SERVICE_BUSINESS' | 'PROF_PENSIONER' | 'PROF_PUBLIC_PROCUREMENT' | 'PROF_RETAIL_SALES';
443
+ /** The origin of the fund code representing the source of the individual's funds. */
444
+ fundOrigin: 'FUND_ORIGIN_SALARY' | 'FUND_ORIGIN_DIVIDENDS' | 'FUND_ORIGIN_INHERITANCE' | 'FUND_ORIGIN_SAVINGS' | 'FUND_ORIGIN_INVESTMENT' | 'FUND_ORIGIN_GIFT' | 'FUND_ORIGIN_MINING' | 'FUND_ORIGIN_REAL_ESTATE' | 'FUND_ORIGIN_LOAN';
445
+ /** The code representing the individual's annual income range. */
446
+ annualIncome: 'ANNUAL_INCOME_UNDER_10K' | 'ANNUAL_INCOME_10K_TO_50K' | 'ANNUAL_INCOME_50K_TO_150K' | 'ANNUAL_INCOME_150K_TO_300K' | 'ANNUAL_INCOME_OVER_300K';
447
+ /** The code representing the individual's monthly turnover range. */
448
+ monthlyTurnover: 'TURNOVER_UNDER_10K' | 'TURNOVER_10K_TO_50K' | 'TURNOVER_50K_TO_150K' | 'TURNOVER_150K_TO_500K' | 'TURNOVER_OVER_500K';
449
+ /** The code representing the number of transactions the individual makes each month. */
450
+ monthlyTransactionCount: 'TRANSACTION_COUNT_LESS_THAN_5' | 'TRANSACTION_COUNT_5_TO_50' | 'TRANSACTION_COUNT_50_TO_100' | 'TRANSACTION_COUNT_100_TO_200' | 'TRANSACTION_COUNT_OVER_200';
451
+ /** List of codes representing the individual's financial activities. */
452
+ activities: ('ACTIVITY_COMMERCE_SELLING' | 'ACTIVITY_COMMERCE_BUYING' | 'ACTIVITY_INVESTING_CRYPTO' | 'ACTIVITY_OTHER')[];
453
+ /** A description of the other activity if the code `ACTIVITY_OTHER` is chosen. */
454
+ activityOther?: string;
455
+ /** Indicates whether the individual holds a politically exposed person (PEP) status. */
456
+ publicFunction: boolean;
457
+ /** Indicates whether the individual is the owner of the funds. */
458
+ fundOwner: boolean;
459
+ /** Indicates whether the individual is a United States citizen. */
460
+ usCitizen: boolean;
461
+ /** Indicates whether the individual is subject to US tax obligations (e.g. holds a US tax identification number or is a US resident for tax purposes). */
462
+ usTaxPerson: boolean;
463
+ /** Tax Identification Number (TIN) assigned by the individual's tax authority. Format varies by country (e.g. SSN in the US, NI number in the UK). */
464
+ taxId: string;
465
+ };
466
+ /**
467
+ * Form for a company
468
+ * @group Profiles
469
+ */
470
+ type CorporateProfileForm = {
471
+ /** A brief description of the company's services. */
472
+ service: string;
473
+ };
474
+ /**
475
+ * @group Profiles
476
+ */
477
+ type UpdateProfileFormInput = {
478
+ /** The profile ID to update. */
479
+ profile: string;
480
+ personal: PersonalProfileForm;
481
+ } | {
482
+ /** The profile ID to update. */
483
+ profile: string;
484
+ corporate: CorporateProfileForm;
485
+ };
486
+ /**
487
+ * @group Profiles
488
+ */
489
+ interface CreateProfileInput {
490
+ /** Determines whether the profile is personal or corporate, and which body structure to use in subsequent PATCH endpoints. */
491
+ kind: ProfileKind;
492
+ /** Optional partner-supplied profile ID. */
493
+ id?: string;
494
+ }
495
+ /**
496
+ * @group Profiles
497
+ */
498
+ type KYCProvider = 'sumsub';
499
+ /**
500
+ * @group Profiles
501
+ */
502
+ interface ShareProfileKYCInput {
503
+ /** Id of the profile to share. */
504
+ profile: string;
505
+ /** Determines whether the profile is personal or corporate, and which body structure to use in subsequent PATCH endpoints. */
506
+ provider: KYCProvider;
507
+ /** Token for a personal profile applicant. */
508
+ personal: {
509
+ /** Provider-issued applicant token. */
510
+ token: string;
511
+ };
512
+ }
513
+ /**
514
+ * @group Profiles
515
+ */
516
+ interface PersonalProfileVerification {
517
+ /** The type of the verification. */
518
+ kind: PersonalVerificationKind;
519
+ /** ID of a previously uploaded file associated with this verification. */
520
+ fileId: string;
521
+ }
522
+ /**
523
+ * @group Profiles
524
+ */
525
+ interface CorporateProfileVerification {
526
+ /** The type of the verification. */
527
+ kind: CorporateVerificationKind;
528
+ /** ID of a previously uploaded file associated with this verification. */
529
+ fileId: string;
376
530
  }
377
- type SubmitProfileDetailsPayload = PersonalProfileDetailsRequest | CorporateProfileDetailsRequest;
531
+ /**
532
+ * @group Profiles
533
+ */
534
+ type UpdateProfileVerificationsInput = {
535
+ /** The profile ID to update. */
536
+ profile: string;
537
+ personal: PersonalProfileVerification[];
538
+ } | {
539
+ /** The profile ID to update. */
540
+ profile: string;
541
+ corporate: CorporateProfileVerification[];
542
+ };
543
+ /**
544
+ * @group Addresses
545
+ */
378
546
  interface AddressesQueryParams {
379
547
  /** Filter the list by profile */
380
548
  profile?: string;
381
549
  /** Filter the list by chain */
382
550
  chain?: Chain | ChainId;
383
551
  }
552
+ /**
553
+ * @group Addresses
554
+ */
384
555
  interface Address {
385
556
  /** The id of the profile the address belongs to. */
386
557
  profile: string;
@@ -389,84 +560,146 @@ interface Address {
389
560
  /** Which chains is the address linked on. */
390
561
  chains: Chain[];
391
562
  }
563
+ /**
564
+ * @group Addresses
565
+ */
392
566
  interface AddressesResponse {
393
567
  addresses: Address[];
394
568
  }
569
+ /**
570
+ * @group Addresses
571
+ */
395
572
  interface CurrencyBalance {
396
573
  currency: Currency;
397
574
  amount: string;
398
575
  }
576
+ /**
577
+ * @group Addresses
578
+ */
579
+ interface GetBalancesParams {
580
+ address: string;
581
+ chain: Chain | ChainId;
582
+ currencies?: Currency | Currency[];
583
+ }
584
+ /**
585
+ * @group Addresses
586
+ */
399
587
  interface Balances {
400
588
  id: string;
401
589
  address: string;
402
590
  chain: Chain;
403
591
  balances: CurrencyBalance[];
404
592
  }
405
- declare enum OrderKind {
406
- redeem = "redeem",
407
- issue = "issue"
408
- }
409
- declare enum OrderState {
410
- placed = "placed",
411
- pending = "pending",
412
- processed = "processed",
413
- rejected = "rejected"
593
+ /**
594
+ * @group Orders
595
+ */
596
+ type PaymentStandard = 'iban' | 'scan' | 'chain' | 'account';
597
+ /**
598
+ * @group Orders
599
+ */
600
+ interface Identifier {
601
+ standard: PaymentStandard;
602
+ bic?: string;
414
603
  }
604
+ /**
605
+ * @group Orders
606
+ */
607
+ type OrderKind = 'issue' | 'redeem';
608
+ /**
609
+ * @group Orders
610
+ */
611
+ type OrderState = 'placed' | 'pending' | 'processed' | 'rejected';
612
+ /**
613
+ * @group Orders
614
+ */
415
615
  interface Fee {
416
616
  provider: 'satchel';
417
617
  currency: Currency;
418
618
  amount: string;
419
619
  }
620
+ /**
621
+ * @group Orders
622
+ */
420
623
  interface IBANIdentifier extends Identifier {
421
- standard: PaymentStandard.iban;
624
+ standard: 'iban';
422
625
  iban: string;
423
626
  }
627
+ /**
628
+ * @group Orders
629
+ */
424
630
  interface CrossChainIdentifier extends Identifier {
425
- standard: PaymentStandard.chain;
631
+ standard: 'chain';
426
632
  /** The receivers address */
427
633
  address: string;
428
634
  /** The receivers network */
429
635
  chain: Chain | ChainId;
430
636
  }
637
+ /**
638
+ * @group Orders
639
+ */
431
640
  interface BankAccountIdentifier extends Identifier {
432
641
  /** The standard of the bank account. This is used to identify generic bank account. */
433
- standard: PaymentStandard.account;
642
+ standard: 'account';
434
643
  /** The account number of the bank account. */
435
644
  accountNumber: number;
436
645
  /** The address of the bank account holder. */
437
646
  address: string;
438
647
  }
648
+ /**
649
+ * @group Orders
650
+ */
439
651
  interface SCANIdentifier extends Identifier {
440
- standard: PaymentStandard.scan;
652
+ standard: 'scan';
441
653
  sortCode: string;
442
654
  accountNumber: string;
443
655
  }
656
+ /**
657
+ * @group Orders
658
+ */
444
659
  interface Individual extends CounterpartDetails {
445
660
  firstName?: string;
446
661
  lastName?: string;
447
662
  address?: string;
448
663
  }
664
+ /**
665
+ * @group Orders
666
+ */
449
667
  interface Corporation extends CounterpartDetails {
450
668
  companyName: string;
451
669
  }
670
+ /**
671
+ * @group Orders
672
+ */
452
673
  interface Issuer {
453
674
  /** The sender name. This can be a corporate or an individual. */
454
675
  name: string;
455
676
  }
677
+ /**
678
+ * @group Orders
679
+ */
456
680
  interface Counterpart {
457
681
  identifier: IBANIdentifier | SCANIdentifier | CrossChainIdentifier | BankAccountIdentifier;
458
682
  details: Individual | Corporation | Issuer;
459
683
  }
684
+ /**
685
+ * @group Orders
686
+ */
460
687
  interface CounterpartDetails {
461
688
  name?: string;
462
689
  bank?: CounterpartBank;
463
690
  country?: string;
464
691
  }
692
+ /**
693
+ * @group Orders
694
+ */
465
695
  interface CounterpartBank {
466
696
  name?: string;
467
697
  address?: string;
468
698
  bic?: string;
469
699
  }
700
+ /**
701
+ * @group Orders
702
+ */
470
703
  interface OrderMetadata {
471
704
  placedAt: string;
472
705
  processedAt?: string;
@@ -474,7 +707,10 @@ interface OrderMetadata {
474
707
  txHashes?: string[];
475
708
  supportingDocumentId?: string;
476
709
  }
477
- interface OrderFilter {
710
+ /**
711
+ * @group Orders
712
+ */
713
+ interface OrderParams {
478
714
  address?: string;
479
715
  txHash?: string;
480
716
  profile?: string;
@@ -482,6 +718,9 @@ interface OrderFilter {
482
718
  accountId?: string;
483
719
  state?: OrderState;
484
720
  }
721
+ /**
722
+ * @group Orders
723
+ */
485
724
  interface Order {
486
725
  id: string;
487
726
  profile: string;
@@ -496,25 +735,20 @@ interface Order {
496
735
  meta: OrderMetadata;
497
736
  state: OrderState;
498
737
  }
738
+ /**
739
+ * @group Orders
740
+ */
499
741
  interface OrdersResponse {
500
742
  orders: Order[];
501
743
  }
502
744
  /**
503
- * Information about the EURe token on different networks.
745
+ * @group Orders
504
746
  */
505
- interface Token {
506
- currency: Currency;
507
- ticker: Ticker;
508
- symbol: TokenSymbol;
509
- chain: Chain;
510
- /** The address of the EURe contract on this network */
511
- address: string;
512
- /** How many decimals this token supports */
513
- decimals: number;
514
- }
515
- type NewOrder = NewOrderByAddress | NewOrderByAccountId;
516
- interface NewOrderCommon {
747
+ interface PlaceOrderInput {
517
748
  /** The unique identifier of the order */
749
+ address: string;
750
+ /** The senders network */
751
+ chain: Chain | ChainId;
518
752
  id?: string;
519
753
  amount: string;
520
754
  signature: string;
@@ -524,20 +758,18 @@ interface NewOrderCommon {
524
758
  memo?: string;
525
759
  supportingDocumentId?: string;
526
760
  }
527
- interface NewOrderByAddress extends NewOrderCommon {
528
- address: string;
529
- /** The senders network */
530
- chain: Chain | ChainId;
531
- }
532
- interface NewOrderByAccountId extends NewOrderCommon {
533
- accountId: string;
534
- }
761
+ /**
762
+ * @group Files
763
+ */
535
764
  interface SupportingDocMetadata {
536
765
  uploadedBy: string;
537
766
  createdAt: string;
538
767
  updatedAt: string;
539
768
  }
540
- interface SupportingDoc {
769
+ /**
770
+ * @group Files
771
+ */
772
+ interface FilesResponse {
541
773
  id: string;
542
774
  name: string;
543
775
  type: string;
@@ -545,7 +777,10 @@ interface SupportingDoc {
545
777
  hash: string;
546
778
  meta: SupportingDocMetadata;
547
779
  }
548
- interface LinkAddress {
780
+ /**
781
+ * @group Addresses
782
+ */
783
+ interface LinkAddressInput {
549
784
  /** Profile ID that owns the address. */
550
785
  profile?: string;
551
786
  /** The public key of the blockchain account. */
@@ -564,7 +799,10 @@ interface LinkAddress {
564
799
  signature: string;
565
800
  chain: Chain | ChainId;
566
801
  }
567
- interface LinkedAddress {
802
+ /**
803
+ * @group Addresses
804
+ */
805
+ interface LinkAddressResponse {
568
806
  profile: string;
569
807
  address: string;
570
808
  state: string;
@@ -573,103 +811,79 @@ interface LinkedAddress {
573
811
  linkedAt: string;
574
812
  };
575
813
  }
576
- interface RequestIbanPayload {
814
+ type LinkAddress = LinkAddressResponse;
815
+ /**
816
+ * @group IBANs
817
+ */
818
+ type IBANState = 'requested' | 'approved' | 'pending' | 'rejected' | 'closed';
819
+ /**
820
+ * @group IBANs
821
+ */
822
+ interface RequestIbanInput {
577
823
  /** the address to request the IBAN. */
578
824
  address: string;
579
825
  /** the chain to request the IBAN. */
580
826
  chain: Chain | ChainId;
581
827
  /** payment email notifications sent to customers, `true` by default. */
582
- emailNotifications: boolean;
828
+ emailNotifications?: boolean;
583
829
  }
584
- interface IbansQueryParams {
830
+ /**
831
+ * @group IBANs
832
+ */
833
+ interface IbansParams {
585
834
  profile?: string;
586
835
  chain?: Chain | ChainId;
587
836
  }
837
+ /**
838
+ * @group IBANs
839
+ */
588
840
  interface IBAN {
841
+ /** The IBAN is a unique identifier for a bank account across different countries and includes a two-letter country code, two check digits, and a number of alphanumeric characters. It may include spaces for readability but should be stored without spaces. */
589
842
  iban: string;
843
+ /** Bank Identifier Code (BIC) of the bank associated with this IBAN. */
590
844
  bic: string;
845
+ /** The profile id that owns the IBAN */
591
846
  profile: string;
847
+ /** The address that this IBAN is connected to */
592
848
  address: string;
849
+ /** The chain that this IBAN is connected to */
593
850
  chain: Chain;
594
- state: AccountState;
851
+ name: string;
852
+ state: IBANState;
595
853
  emailNotifications: boolean;
596
854
  }
855
+ /**
856
+ * @group IBANs
857
+ */
597
858
  interface IBANsResponse {
598
859
  ibans: IBAN[];
599
860
  }
600
- interface MoveIbanPayload {
861
+ /**
862
+ * @group IBANs
863
+ */
864
+ interface MoveIbanInput {
865
+ iban: string;
601
866
  /** the address to move iban to */
602
867
  address: string;
603
868
  /** the chain to move iban to */
604
869
  chain: Chain | ChainId;
605
870
  }
606
- interface OrderNotificationQueryParams {
607
- state?: OrderState;
608
- profile?: string;
609
- }
610
871
  /**
611
- * @deprecated Will be removed in v4 in favour of 'MoneriumClientOptions'
872
+ * @group Primitives
873
+ * @internal
612
874
  */
613
- type ClassOptions = {
614
- environment?: ENV;
615
- debug?: boolean;
616
- } & BearerTokenCredentials;
617
- interface AuthFlowOptionsShared {
618
- /** the state oauth parameter */
619
- state?: string;
620
- }
621
- /**
622
- * @deprecated Will be removed in v4 in favour of 'BuildAuthorizationUrlOptions'
623
- */
624
- interface AuthFlowOptions extends AuthFlowOptionsShared {
625
- /** the email of the user to prefill the login form */
626
- email?: string;
627
- /**
628
- * skip account creation in auth flow
629
- * @deprecated: acccount creation is no longer offered in the auth flow
630
- */
631
- skipCreateAccount?: boolean;
632
- /** skip KYC in auth flow */
633
- skipKyc?: boolean;
634
- /** the address your customer should link in auth flow */
635
- address?: string;
636
- /** the signature of the address */
637
- signature?: string;
638
- /** the chain of the address */
639
- chain?: Chain | ChainId;
640
- }
641
- /**
642
- * @deprecated Will be removed in v4 in favour of 'BuildSiweAuthorizationUrlOptions'
643
- */
644
- interface AuthFlowSIWEOptions extends AuthFlowOptionsShared {
645
- /** Signature for the SIWE message. Must include the 0x prefix. */
646
- signature: string;
647
- /**
648
- * An EIP-4361 compatible message. https://eips.ethereum.org/EIPS/eip-4361
649
- *
650
- * https://monerium.com/siwe
651
- * */
652
- message: string;
653
- }
654
- interface ClientCredentials {
655
- clientId: string;
656
- clientSecret: string;
657
- }
658
- interface AuthorizationCodeCredentials {
659
- clientId: string;
660
- redirectUri: string;
661
- }
662
- type BearerTokenCredentials = ClientCredentials | AuthorizationCodeCredentials;
663
- type ResponseStatus = {
664
- status: number;
665
- statusText: string;
875
+ type AcceptedResponse = {
876
+ code: 202;
877
+ status: 'Accepted';
666
878
  };
667
879
  /**
668
880
  * Type of pending signature
881
+ * @group Signatures
669
882
  */
670
883
  type PendingSignatureKind = 'linkAddress' | 'order';
671
884
  /**
672
885
  * Base interface for pending signatures
886
+ * @group Signatures
673
887
  */
674
888
  interface PendingSignatureBase {
675
889
  kind: PendingSignatureKind;
@@ -679,6 +893,7 @@ interface PendingSignatureBase {
679
893
  }
680
894
  /**
681
895
  * Pending signature for an order
896
+ * @group Signatures
682
897
  */
683
898
  interface PendingOrderSignature extends PendingSignatureBase {
684
899
  id: string;
@@ -689,18 +904,21 @@ interface PendingOrderSignature extends PendingSignatureBase {
689
904
  }
690
905
  /**
691
906
  * Pending signature for linking an address
907
+ * @group Signatures
692
908
  */
693
909
  interface PendingLinkAddressSignature extends PendingSignatureBase {
694
910
  kind: 'linkAddress';
695
911
  }
696
912
  /**
697
913
  * Union type for all pending signature types
914
+ * @group Signatures
698
915
  */
699
916
  type PendingSignature = PendingOrderSignature | PendingLinkAddressSignature;
700
917
  /**
701
918
  * Query parameters for fetching pending signatures
919
+ * @group Signatures
702
920
  */
703
- interface SignaturesQueryParams {
921
+ interface SignaturesParams {
704
922
  /** Filter by blockchain address */
705
923
  address?: string;
706
924
  /** Filter by blockchain network */
@@ -712,6 +930,7 @@ interface SignaturesQueryParams {
712
930
  }
713
931
  /**
714
932
  * Response from the signatures endpoint
933
+ * @group Signatures
715
934
  */
716
935
  interface SignaturesResponse {
717
936
  /** Array of pending signatures */
@@ -719,193 +938,61 @@ interface SignaturesResponse {
719
938
  /** Total number of pending signatures */
720
939
  total: number;
721
940
  }
722
-
723
- type MoneriumClientOptions = {
724
- environment?: ENV;
725
- getAccessToken: () => string | Promise<string>;
726
- accessToken?: never;
727
- transport?: Transport;
728
- } | {
729
- environment?: ENV;
730
- accessToken: string;
731
- getAccessToken?: never;
732
- transport?: Transport;
733
- } | {
734
- environment?: ENV;
735
- accessToken?: never;
736
- getAccessToken?: never;
737
- transport?: Transport;
738
- };
739
941
  /**
740
- * Creates a Monerium client instance.
741
- * @beta
742
- * @group v4
743
- * @category v4 - Client instance.
942
+ * @group Webhooks
744
943
  */
745
- declare function createMoneriumClient(options: MoneriumClientOptions): {
746
- /**
747
- * @group Authentication
748
- * @see {@link https://docs.monerium.com/api#tag/auth/operation/auth-context | API Documentation}
749
- */
750
- getAuthContext: () => Promise<AuthContext>;
751
- /**
752
- * @group Profiles
753
- * @param {string} profile - the id of the profile to fetch.
754
- * @see {@link https://docs.monerium.com/api#tag/profiles/operation/profile | API Documentation}
755
- */
756
- getProfile: (id: string) => Promise<Profile>;
757
- /**
758
- * @group Profiles
759
- * @see {@link https://docs.monerium.com/api#tag/profiles/operation/profiles | API Documentation}
760
- */
761
- getProfiles: (params?: ProfilesQueryParams) => Promise<ProfilesResponse>;
762
- /**
763
- * @group Profiles
764
- * @see {@link https://docs.monerium.com/api#tag/profiles/operation/patch-profile-details | API Documentation}
765
- */
766
- submitProfileDetails: (profileId: string, body: SubmitProfileDetailsPayload) => Promise<ResponseStatus>;
767
- /**
768
- * Get details for a single address by using the address public key after the
769
- * address has been successfully linked to Monerium.
770
- *
771
- * @group Addresses
772
- * @param {string} address - The public key of the blockchain account.
773
- * @see {@link https://docs.monerium.com/api#tag/addresses/operation/address | API Documentation}
774
- */
775
- getAddress: (address: string) => Promise<Address>;
776
- /**
777
- * @group Addresses
778
- * @param {AddressesQueryParams} [params] - No required parameters.
779
- * @see {@link https://docs.monerium.com/api#tag/addresses/operation/addresses | API Documentation}
780
- */
781
- getAddresses: (params?: AddressesQueryParams) => Promise<AddressesResponse>;
782
- /**
783
- * @group Addresses
784
- * @see {@link https://docs.monerium.com/api#tag/addresses/operation/balances | API Documentation}
785
- */
786
- getBalances: (address: string, chain: Chain | ChainId, currencies?: Currency | Currency[]) => Promise<Balances>;
787
- /**
788
- * Add a new address to the profile.
789
- *
790
- * @group Addresses
791
- * @see {@link https://docs.monerium.com/api#tag/addresses/operation/link-address | API Documentation}
792
- */
793
- linkAddress: (payload: LinkAddress) => Promise<LinkedAddress>;
794
- /**
795
- * Fetch details about a single IBAN.
796
- *
797
- * @group IBANs
798
- * @param {string} iban - the IBAN to fetch.
799
- * @see {@link https://docs.monerium.com/api#tag/ibans/operation/iban | API Documentation}
800
- */
801
- getIban: (iban: string) => Promise<IBAN>;
802
- /**
803
- * Fetch all IBANs for the profile.
804
- *
805
- * @group IBANs
806
- * @see {@link https://docs.monerium.com/api#tag/ibans/operation/ibans | API Documentation}
807
- */
808
- getIbans: (params?: IbansQueryParams) => Promise<IBANsResponse>;
809
- /**
810
- * @group IBANs
811
- * @param {RequestIbanPayload} payload
812
- * @see {@link https://docs.monerium.com/api#tag/ibans/operation/request-iban | API Documentation}
813
- */
814
- requestIban: ({ address, chain, emailNotifications, }: RequestIbanPayload) => Promise<ResponseStatus>;
815
- /**
816
- * @group IBANs
817
- * @param {string} iban - the IBAN to move.
818
- * @param {MoveIbanPayload} payload - the payload to move the IBAN.
819
- * @see {@link https://docs.monerium.com/api#tag/ibans/operation/move-iban | API Documentation}
820
- */
821
- moveIban: (iban: string, { address, chain }: MoveIbanPayload) => Promise<ResponseStatus>;
822
- /**
823
- * @group Orders
824
- * @see {@link https://docs.monerium.com/api/#tag/orders/operation/order | API Documentation}
825
- */
826
- getOrder: (orderId: string) => Promise<Order>;
827
- /**
828
- * @group Orders
829
- * @see {@link https://docs.monerium.com/api/#tag/orders/operation/orders | API Documentation}
830
- */
831
- getOrders: (filter?: OrderFilter) => Promise<OrdersResponse>;
832
- /**
833
- * Place a new order.
834
- *
835
- * **Note:** For multi-signature orders, the API returns a 202 Accepted response
836
- * with `{status: 202, statusText: "Accepted"}` instead of the full Order object.
837
- *
838
- * @returns Promise that resolves to either:
839
- * - `Order` - Full order object for regular orders
840
- * - `ResponseStatus` - Status object for multi-sig orders
841
- *
842
- * @group Orders
843
- * @see {@link https://docs.monerium.com/api#tag/orders/operation/post-orders | API Documentation}
844
- */
845
- placeOrder: (order: NewOrder) => Promise<Order | ResponseStatus>;
846
- /**
847
- * @group Tokens
848
- * @see {@link https://docs.monerium.com/api#tag/tokens | API Documentation}
849
- */
850
- getTokens: () => Promise<Token[]>;
851
- /**
852
- * Get pending signatures for the authenticated user.
853
- *
854
- * @group Signatures
855
- * @param {SignaturesQueryParams} [params] - Optional query parameters to filter signatures.
856
- * @see {@link https://docs.monerium.com/api#tag/signatures/operation/get-signatures | API Documentation}
857
- */
858
- getSignatures: (params?: SignaturesQueryParams) => Promise<SignaturesResponse>;
859
- /**
860
- * @group Files
861
- * @see {@link https://docs.monerium.com/api/#tag/files | API Documentation}
862
- */
863
- /**
864
- * Upload a supporting document for KYC onboarding or order support.
865
- *
866
- * Requires `Blob` and `FormData` support — available in Node.js 18+,
867
- * browsers, and Cloudflare Workers. Not available in all environments.
868
- *
869
- * @param document - File content as a `Blob`, `Uint8Array`, or `ArrayBuffer`.
870
- * Node.js `Buffer` is a `Uint8Array` and works directly.
871
- * @param filename - Optional filename sent to the API (e.g. `'kyc.pdf'`).
872
- */
873
- uploadSupportingDocument: (document: Blob | Uint8Array | ArrayBuffer, filename?: string) => Promise<SupportingDoc>;
874
- };
875
-
944
+ type WebhookSubscriptionState = 'active' | 'inactive';
945
+ /**
946
+ * @group Webhooks
947
+ */
948
+ type WebhookEventType = 'iban.updated' | 'order.created' | 'order.updated' | 'profile.updated';
876
949
  /**
877
- * @group v4
878
- * @category v4 - Authorization
879
- * @beta
950
+ * @group Webhooks
951
+ */
952
+ interface WebhookSubscription {
953
+ id: string;
954
+ url: string;
955
+ types: WebhookEventType[];
956
+ state: WebhookSubscriptionState;
957
+ }
958
+ /**
959
+ * @group Webhooks
960
+ */
961
+ interface WebhookSubscriptionsResponse {
962
+ subscriptions: WebhookSubscription[];
963
+ }
964
+ /**
965
+ * @group Webhooks
966
+ */
967
+ interface CreateWebhookSubscriptionInput {
968
+ url: string;
969
+ secret: string;
970
+ types?: WebhookEventType[];
971
+ }
972
+ /**
973
+ * @group Webhooks
974
+ */
975
+ interface UpdateWebhookSubscriptionInput {
976
+ subscription: string;
977
+ state?: WebhookSubscriptionState;
978
+ types?: WebhookEventType[];
979
+ }
980
+ /**
981
+ * @category Types
880
982
  */
881
983
  interface BuildAuthorizationUrlOptions {
882
- environment?: ENV;
883
984
  clientId: string;
884
985
  redirectUri: string;
885
986
  codeChallenge: string;
886
987
  state?: string;
887
988
  email?: string;
888
989
  skipKyc?: boolean;
889
- address?: string;
890
- signature?: string;
891
- chain?: string;
990
+ authMode?: 'login' | 'signup';
892
991
  }
893
992
  /**
894
- * Build the authorization redirect URL.
895
- * Returns a URL string — the caller navigates to it.
896
- * The SDK does not redirect.
897
- * @group v4
898
- * @category v4 - Authorization
899
- * @beta
900
- */
901
- declare const buildAuthorizationUrl: (options: BuildAuthorizationUrlOptions) => string;
902
- /**
903
- * @group v4
904
- * @category v4 - Authorization
905
- * @beta
993
+ * @category Types
906
994
  */
907
995
  interface BuildSiweAuthorizationUrlOptions {
908
- environment?: ENV;
909
996
  clientId: string;
910
997
  redirectUri: string;
911
998
  codeChallenge: string;
@@ -914,490 +1001,390 @@ interface BuildSiweAuthorizationUrlOptions {
914
1001
  state?: string;
915
1002
  }
916
1003
  /**
917
- * Build the SIWE authorization redirect URL.
918
- * Returns a URL string — the caller navigates to it.
919
- * The SDK does not redirect.
920
- *
921
- * @group v4
922
- * @category v4 - Authorization
923
- * @beta
924
- */
925
- declare const buildSiweAuthorizationUrl: (options: BuildSiweAuthorizationUrlOptions) => string;
926
- /**
927
- * @group v4
928
- * @category v4 - Authorization
929
- * @beta
1004
+ * @category Types
930
1005
  */
931
1006
  interface AuthorizationCodeGrantOptions {
932
- environment?: ENV;
933
1007
  clientId: string;
934
1008
  redirectUri: string;
935
1009
  code: string;
936
1010
  codeVerifier: string;
937
- transport?: Transport;
938
1011
  }
939
1012
  /**
940
- * Exchange an authorization code for tokens.
941
- * The caller stores the returned BearerProfile — the SDK does not write to any storage.
942
- *
943
- * @group v4
944
- * @category v4 - Authorization
945
- * @beta
1013
+ * @category Types
946
1014
  */
947
- declare const authorizationCodeGrant: (options: AuthorizationCodeGrantOptions) => Promise<BearerProfile>;
948
1015
  interface RefreshTokenGrantOptions {
949
- environment?: ENV;
950
1016
  clientId: string;
951
1017
  refreshToken: string;
952
- transport?: Transport;
953
1018
  }
954
1019
  /**
955
- * Get a new access token using a refresh token.
956
- * The caller stores the returned BearerProfile — the SDK does not write to any storage.
957
- * @beta
1020
+ * @category Types
958
1021
  */
959
- declare const refreshTokenGrant: (options: RefreshTokenGrantOptions) => Promise<BearerProfile>;
960
1022
  interface ClientCredentialsGrantOptions {
961
- environment?: ENV;
962
1023
  clientId: string;
963
1024
  clientSecret: string;
964
- transport?: Transport;
965
- }
966
- /**
967
- * Get an access token using client credentials. Server-side only.
968
- * clientSecret must never be used in a browser context.
969
- *
970
- * @group v4
971
- * @category v4 - Authorization
972
- * @beta
973
- */
974
- declare const clientCredentialsGrant: (options: ClientCredentialsGrantOptions) => Promise<BearerProfile>;
975
- /**
976
- * @group v4
977
- * @category v4 - Authorization
978
- * @beta
979
- */
980
- interface ParsedAuthorizationResponse {
981
- code?: string;
982
- state?: string;
983
- error?: string;
984
- errorDescription?: string;
985
1025
  }
986
- /**
987
- * Parse a callback URL or query string into structured fields.
988
- *
989
- * - No globals. No side effects. Never throws.
990
- * - Returns an empty object if none of the expected parameters are present.
991
- * - Check for the presence of `code` or `error` to determine if the URL
992
- * contains an OAuth2 authorization response.
993
- *
994
- * @example
995
- * const { code, error } = parseAuthorizationResponse(req.url);
996
- * const { code, error } = parseAuthorizationResponse('?code=abc&state=xyz');
997
- * @experimental may not be included in v4
998
- * @group v4
999
- * @category v4 - Helpers
1000
- */
1001
- declare const parseAuthorizationResponse: (input: string) => ParsedAuthorizationResponse;
1002
1026
 
1003
1027
  /**
1004
- * Generate a cryptographically random PKCE code verifier (RFC 7636).
1005
- * Returns a base64url-encoded string of 32 random bytes (256 bits of entropy).
1006
- * The caller is responsible for storing this until the callback.
1007
- * @group v4
1008
- * @category v4 - PKCE
1028
+ * Get Environment configuration for the given environment. Defaults to 'sandbox' if not specified.
1029
+ * @param env - The target environment (`'sandbox'` or `'production'`). Defaults to `'sandbox'`.
1030
+ * @returns Environment configuration
1009
1031
  */
1010
- declare const randomPKCECodeVerifier: () => string;
1032
+ declare function getEnv(env?: ENV): Environment;
1033
+
1011
1034
  /**
1012
- * Derive the S256 code challenge from a code verifier.
1013
- * Synchronous. Returns a base64url-encoded SHA-256 hash.
1014
- * @group v4
1015
- * @category v4 - PKCE
1035
+ * @group Client
1036
+ * @category Types
1016
1037
  */
1017
- declare const calculatePKCECodeChallenge: (codeVerifier: string) => string;
1018
-
1038
+ type TransportRequest = {
1039
+ method: string;
1040
+ url: string;
1041
+ headers: Record<string, string>;
1042
+ body?: BodyInit | string;
1043
+ signal?: AbortSignal;
1044
+ };
1019
1045
  /**
1020
- * Thrown when the Monerium API returns a non-2xx response.
1021
- * Fields map directly to the API response body — nothing is translated or normalised.
1022
- *
1023
- * @example
1024
- * try {
1025
- * await client.getProfiles();
1026
- * } catch (err) {
1027
- * if (err instanceof MoneriumApiError) {
1028
- * console.log(err.code); // 401
1029
- * console.log(err.status); // "Unauthorized"
1030
- * console.log(err.message); // "Not authenticated"
1031
- * console.log(err.errors); // field-level validation errors, if present
1032
- * }
1033
- * }
1034
- * @group v4
1035
- * @category v4 - Errors
1046
+ * @group Client
1047
+ * @category Types
1036
1048
  */
1037
- declare class MoneriumApiError extends Error {
1038
- code: number;
1039
- status: string;
1040
- errors?: Record<string, string>;
1041
- details?: unknown;
1042
- constructor(body: {
1043
- code: number;
1044
- status: string;
1045
- message: string;
1046
- errors?: Record<string, string>;
1047
- details?: unknown;
1048
- });
1049
- }
1050
- type MoneriumSdkErrorType = 'network_error' | 'authentication_required' | 'invalid_configuration';
1049
+ type TransportResponse = {
1050
+ status: number;
1051
+ headers?: Record<string, string>;
1052
+ bodyText: string;
1053
+ };
1051
1054
  /**
1052
- * Thrown for SDK-level failures no HTTP response involved.
1053
- *
1054
- * @example
1055
- * try {
1056
- * await client.getProfiles();
1057
- * } catch (err) {
1058
- * if (err instanceof MoneriumSdkError) {
1059
- * console.log(err.type); // 'network_error' | 'authentication_required' | ...
1060
- * console.log(err.cause); // underlying fetch error, if type === 'network_error'
1061
- * }
1062
- * }
1063
- * @group v4
1064
- * @category v4 - Errors
1055
+ * Replaces the internal `fetch` call. Headers (`Authorization`, `Content-Type`,
1056
+ * `Accept`) are pre-populated. Must return a `Promise` resolving with the raw
1057
+ * response `status` and `bodyText`. Throw on network-level failures.
1058
+ * The SDK owns JSON parsing and error normalisation.
1059
+ * @group Client
1060
+ * @category Types
1065
1061
  */
1066
- declare class MoneriumSdkError extends Error {
1067
- type: MoneriumSdkErrorType;
1068
- cause?: unknown;
1069
- constructor(type: MoneriumSdkErrorType, message: string, cause?: unknown);
1070
- }
1062
+ type Transport = (request: TransportRequest) => Promise<TransportResponse>;
1071
1063
 
1064
+ interface MoneriumApiClientOptions {
1065
+ environment?: ENV;
1066
+ getAccessToken: () => Promise<string | undefined> | string | undefined;
1067
+ transport?: Transport;
1068
+ }
1072
1069
  /**
1073
- * @deprecated Class will be removed in v4 in favour of 'createMoneriumClient' function.
1074
- *
1075
- * In the [Monerium UI](https://monerium.app/), create an application to get the `clientId` and register your `redirectUri`.
1076
- * ```ts
1077
- * import { MoneriumClient } from '@monerium/sdk';
1078
- *
1079
- * const monerium = new MoneriumClient() // defaults to `sandbox`
1080
- *
1081
- * // or
1082
- * new MoneriumClient('production')
1083
- *
1084
- * // or
1085
- * new MoneriumClient({
1086
- * environment: 'sandbox',
1087
- * clientId: 'your-client-id',
1088
- * redirectUri: 'http://your-redirect-url.com/monerium'
1089
- * });
1090
- *
1091
- *```
1070
+ * Base abstract client containing the shared configuration and request logic.
1092
1071
  */
1093
- declare class MoneriumClient {
1094
- #private;
1095
- /**
1096
- * The bearer profile will be available after authentication, it includes the `access_token` and `refresh_token`
1097
- * */
1098
- bearerProfile?: BearerProfile;
1099
- /**
1100
- * The client is authorized if the bearer profile is available
1101
- */
1102
- isAuthorized: boolean;
1103
- /**
1104
- * The state parameter is used to maintain state between the request and the callback.
1105
- * */
1106
- state: string | undefined;
1107
- /**
1108
- * @deprecated Class will be removed in v4 in favour of 'createMoneriumClient' function.
1109
- *
1110
- * @defaultValue `sandbox`
1111
- * */
1112
- constructor(envOrOptions?: ENV | ClassOptions);
1113
- /**
1114
- * @deprecated will be removed in v4 - in favour of `buildAuthorizationUrl`
1115
- * Constructs the url to the authorization code flow and redirects,
1116
- * Code Verifier needed for the code challenge is stored in local storage
1117
- * For automatic wallet link, add the following properties: `address`, `signature` & `chain`
1118
- *
1119
- * This authorization code is then used to request an access token via the token endpoint. (https://docs.monerium.com/api#operation/auth-token)
1120
- *
1121
- * @group Authentication
1122
- * @see {@link https://docs.monerium.com/api#tag/auth/operation/auth | API Documentation}
1123
- * @param {AuthFlowOptions} [params] - the auth flow params
1124
- * @returns void
1125
- *
1126
- */
1127
- authorize(params?: AuthFlowOptions): Promise<void>;
1072
+ declare abstract class MoneriumBaseClient {
1073
+ protected options: MoneriumApiClientOptions;
1074
+ protected env: ReturnType<typeof getEnv>;
1075
+ protected transport: Transport;
1076
+ constructor(options: MoneriumApiClientOptions);
1077
+ protected getToken(): Promise<string | undefined>;
1078
+ protected request<T>(method: string, path: string, body?: unknown, contentType?: string): Promise<T>;
1079
+ protected requestFormData<T>(method: string, path: string, form: FormData): Promise<T>;
1128
1080
  /**
1129
- * @deprecated will be removed in v4 - in favour of `buildSiweAuthorizationUrl`
1130
- * Constructs the url to the authorization code flow and redirects,
1131
- * Code Verifier needed for the code challenge is stored in local storage
1132
- *
1133
- * "Sign in with Ethereum" (SIWE) flow can be used for existing Monerium customers.
1134
- * In this case the payload must include a valid EIP-4361 (https://eips.ethereum.org/EIPS/eip-4361) message and signature.
1135
- * On successful authorization the authorization code is returned at once.
1136
- *
1137
- * This authorization code is then used to request an access token via the token endpoint.
1138
- *
1139
- * https://monerium.com/siwe
1140
- *
1141
- * @group Authentication
1142
- * @see {@link https://docs.monerium.com/api#tag/auth/operation/auth | API Documentation}
1143
- * @param {AuthFlowSIWEOptions} [params] - the auth flow SIWE params
1144
- * @returns void
1145
- *
1146
- */
1147
- siwe(params: AuthFlowSIWEOptions): Promise<void>;
1148
- /**
1149
- * @deprecated Will be removed in v4 in favour of 'authorizationCodeGrant', 'refreshTokenGrant' and 'clientCredentialsGrant'
1150
- * Will use the authorization code flow code to get access token
1151
- *
1152
- * @group Authentication
1153
- *
1154
- * @param {string} refreshToken - provide the refresh token to get a new access token
1155
- *
1156
- * @returns boolean to indicate if access has been granted
1157
- *
1158
- * @example
1159
- * ```ts
1160
- * import { MoneriumClient } from '@monerium/sdk';
1161
- * // Initialize the client with credentials
1162
- * const monerium = new MoneriumClient({
1163
- * environment: 'sandbox',
1164
- * clientId: 'your_client_credentials_uuid', // replace with your client ID
1165
- * clientSecret: 'your_client_secret', // replace with your client secret
1166
- * });
1167
- *
1168
- * await monerium.getAccess();
1169
- *
1170
- * const refreshToken = monerium.bearerProfile?.refresh_token;
1171
- *
1172
- * // TODO: store the refresh token securely
1081
+ * Get the current auth context.
1173
1082
  *
1174
- * // reconnect...
1175
- * await monerium.getAccess(refreshToken);
1176
- * ```
1177
- */
1178
- getAccess(refreshToken?: string): Promise<boolean>;
1179
- /**
1180
- * @group Authentication
1181
1083
  * @see {@link https://docs.monerium.com/api#tag/auth/operation/auth-context | API Documentation}
1182
1084
  */
1183
1085
  getAuthContext(): Promise<AuthContext>;
1184
1086
  /**
1185
- * @group Profiles
1186
- * @param {string} profile - the id of the profile to fetch.
1087
+ * Get a profile by its id.
1088
+ *
1089
+ * @param profileId - The id of the profile to fetch.
1187
1090
  * @see {@link https://docs.monerium.com/api#tag/profiles/operation/profile | API Documentation}
1188
1091
  */
1189
- getProfile(profile: string): Promise<Profile>;
1092
+ getProfile(profileId: string): Promise<Profile>;
1190
1093
  /**
1191
- * @group Profiles
1094
+ * Get all profiles.
1095
+ *
1192
1096
  * @see {@link https://docs.monerium.com/api#tag/profiles/operation/profiles | API Documentation}
1193
1097
  */
1194
- getProfiles(params?: ProfilesQueryParams): Promise<ProfilesResponse>;
1098
+ getProfiles(params?: GetProfilesParams): Promise<ProfilesResponse>;
1195
1099
  /**
1196
- *
1197
- * Get details for a single address by using the address public key after the address has been successfully linked to Monerium.
1198
- *
1199
- * @group Addresses
1200
- * @param {string} address - The public key of the blockchain account.
1100
+ * Get details for a single address after it has been linked to Monerium.
1101
+ * @param address - The public key of the blockchain account.
1201
1102
  *
1202
1103
  * @see {@link https://docs.monerium.com/api#tag/addresses/operation/address | API Documentation}
1203
- *
1204
- * @example
1205
- * ```ts
1206
- * monerium.getAddress('0x1234567890abcdef1234567890abcdef12345678')
1207
- * ```
1208
1104
  */
1209
1105
  getAddress(address: string): Promise<Address>;
1210
1106
  /**
1211
- * @group Addresses
1212
- * @param {AddressesQueryParams} [params] - No required parameters.
1107
+ * Get a list of all addresses linked to the profile.
1108
+ *
1213
1109
  * @see {@link https://docs.monerium.com/api#tag/addresses/operation/addresses | API Documentation}
1214
1110
  */
1215
1111
  getAddresses(params?: AddressesQueryParams): Promise<AddressesResponse>;
1216
1112
  /**
1217
- * @group Addresses
1218
- * @see {@link https://docs.monerium.com/api#tag/addresses/operation/balances| API Documentation}
1113
+ * Add a new address to the profile.
1114
+ *
1115
+ * @see {@link https://docs.monerium.com/api#tag/addresses/operation/link-address | API Documentation}
1116
+ * @returns {LinkAddressResponse | AcceptedResponse} - The address was linked successfully or an accepted response if the address is being processed asynchronously.
1117
+ */
1118
+ linkAddress(body: LinkAddressInput): Promise<LinkAddressResponse | AcceptedResponse>;
1119
+ /**
1120
+ * Get the balances for a given address on a specific chain.
1121
+ *
1122
+ * @see {@link https://docs.monerium.com/api#tag/addresses/operation/balances | API Documentation}
1219
1123
  */
1220
- getBalances(address: string, chain: Chain | ChainId, currencies?: Currency | Currency[]): Promise<Balances>;
1124
+ getBalances(params: GetBalancesParams): Promise<Balances>;
1221
1125
  /**
1222
- * Fetch details about a single IBAN
1126
+ * Fetch details about a single IBAN.
1127
+ * @param iban - The IBAN to fetch.
1223
1128
  *
1224
- * @group IBANs
1225
- * @param {string} iban - the IBAN to fetch.
1226
1129
  * @see {@link https://docs.monerium.com/api#tag/ibans/operation/iban | API Documentation}
1227
1130
  */
1228
1131
  getIban(iban: string): Promise<IBAN>;
1229
1132
  /**
1230
- * Fetch all IBANs for the profile
1231
- * @group IBANs
1133
+ * Fetch all IBANs for the profile.
1134
+ *
1232
1135
  * @see {@link https://docs.monerium.com/api#tag/ibans/operation/ibans | API Documentation}
1233
1136
  */
1234
- getIbans(queryParameters?: IbansQueryParams): Promise<IBANsResponse>;
1137
+ getIbans(params?: IbansParams): Promise<IBANsResponse>;
1235
1138
  /**
1236
- * @group Orders
1237
- * @see {@link https://docs.monerium.com/api/#tag/orders/operation/orders | API Documentation}
1139
+ * Request an IBAN for the profile.
1140
+ *
1141
+ * @see {@link https://docs.monerium.com/api#tag/ibans/operation/request-iban | API Documentation}
1142
+ */
1143
+ requestIban(input: RequestIbanInput): Promise<AcceptedResponse>;
1144
+ /**
1145
+ * Move an IBAN to a different address and chain.
1146
+ *
1147
+ * @see {@link https://docs.monerium.com/api#tag/ibans/operation/move-iban | API Documentation}
1238
1148
  */
1239
- getOrders(filter?: OrderFilter): Promise<OrdersResponse>;
1149
+ moveIban(input: MoveIbanInput): Promise<AcceptedResponse>;
1240
1150
  /**
1241
- * @group Orders
1151
+ * Get an order by its ID.
1152
+ *
1242
1153
  * @see {@link https://docs.monerium.com/api/#tag/orders/operation/order | API Documentation}
1243
1154
  */
1244
1155
  getOrder(orderId: string): Promise<Order>;
1245
1156
  /**
1246
- * @group Tokens
1157
+ * Get a list of orders.
1158
+ *
1159
+ * @see {@link https://docs.monerium.com/api/#tag/orders/operation/orders | API Documentation}
1160
+ */
1161
+ getOrders(params?: OrderParams): Promise<OrdersResponse>;
1162
+ /**
1163
+ * Place a new order.
1164
+ *
1165
+ * **Note:** For multi-signature orders, the API returns a 202 Accepted response
1166
+ * with `{ status: 202, statusText: "Accepted" }` instead of the full Order object.
1167
+ *
1168
+ * @returns `Order` for regular orders; `AcceptedResponse` for multi-sig orders.
1169
+ * @see {@link https://docs.monerium.com/api#tag/orders/operation/post-orders | API Documentation}
1170
+ */
1171
+ placeOrder(input: PlaceOrderInput): Promise<Order | AcceptedResponse>;
1172
+ /**
1173
+ * Get Monerium tokens with contract addresses and chain details.
1174
+ *
1247
1175
  * @see {@link https://docs.monerium.com/api#tag/tokens | API Documentation}
1248
1176
  */
1249
1177
  getTokens(): Promise<Token[]>;
1250
1178
  /**
1251
1179
  * Get pending signatures for the authenticated user.
1252
1180
  *
1253
- * Returns pending signatures that require user action, such as order signatures
1254
- * or link address signatures. Accepts filtering by address, chain, kind, and profile.
1255
- *
1256
- * @group Signatures
1257
- * @param {SignaturesQueryParams} [params] - Optional query parameters to filter signatures
1258
1181
  * @see {@link https://docs.monerium.com/api#tag/signatures/operation/get-signatures | API Documentation}
1182
+ */
1183
+ getSignatures(params?: SignaturesParams): Promise<SignaturesResponse>;
1184
+ /**
1185
+ * Upload a supporting document for KYC onboarding or order support using `multipart/form-data`.
1259
1186
  *
1260
- * @example
1261
- * ```ts
1262
- * // Get all pending signatures
1263
- * const signatures = await monerium.getSignatures();
1264
- *
1265
- * // Get pending order signatures for a specific address
1266
- * const orderSignatures = await monerium.getSignatures({
1267
- * address: '0x1234...',
1268
- * kind: 'order'
1269
- * });
1187
+ * Accepts binary data in multiple formats and normalizes it to a {@link Blob}
1188
+ * internally before sending the request.
1270
1189
  *
1271
- * // Get pending signatures on a specific chain
1272
- * const polygonSignatures = await monerium.getSignatures({
1273
- * chain: 'polygon'
1274
- * });
1275
- * ```
1190
+ * @param file - The document to upload. Can be a {@link Blob}, {@link Uint8Array}, or {@link ArrayBuffer}.
1191
+ * @param filename - Optional filename to associate with the uploaded file.
1192
+ * If not provided, a default name will be inferred when possible, otherwise `"document"` is used.
1193
+ * @see {@link https://docs.monerium.com/api/#tag/files | API Documentation}
1194
+ * @remarks
1195
+ * This method constructs a {@link FormData} payload internally and sends it to the `POST /files` endpoint.
1196
+ * Consumers do not need to manually create or manage multipart form data.
1276
1197
  */
1277
- getSignatures(params?: SignaturesQueryParams): Promise<SignaturesResponse>;
1198
+ uploadSupportingDocument(file: Blob | Uint8Array | ArrayBuffer, filename?: string): Promise<FilesResponse>;
1199
+ }
1200
+ /**
1201
+ * Server-side client containing operations that require client secrets.
1202
+ * Must never be used in a browser context.
1203
+ */
1204
+ declare abstract class MoneriumServerClient extends MoneriumBaseClient {
1278
1205
  /**
1279
- * Add a new address to the profile
1280
- * @group Addresses
1281
- * @see {@link https://docs.monerium.com/api#tag/addresses/operation/link-address | API Documentation}
1206
+ * Get an access token using client credentials. Server-side only.
1207
+ * clientSecret must never be used in a browser context.
1208
+ *
1282
1209
  */
1283
- linkAddress(payload: LinkAddress): Promise<LinkedAddress>;
1210
+ clientCredentialsGrant(clientId: string, clientSecret: string): Promise<BearerProfile>;
1284
1211
  /**
1285
- * Place a new order.
1212
+ * List all webhook subscriptions for the authenticated user.
1286
1213
  *
1287
- * **Note:** For multi-signature orders, the API returns a 202 Accepted response
1288
- * with `{status: 202, statusText: "Accepted"}` instead of the full Order object.
1289
- *
1290
- * @returns Promise that resolves to either:
1291
- * - `Order` - Full order object for regular orders
1292
- * - `ResponseStatus` - Status object with `{status: 202, statusText: "Accepted"}` for multi-sig orders
1214
+ * @see {@link https://docs.monerium.com/api#tag/webhooks/operation/list-subscriptions | API Documentation}
1215
+ */
1216
+ getSubscriptions(): Promise<WebhookSubscriptionsResponse>;
1217
+ /**
1218
+ * Create webhook subscription.
1293
1219
  *
1294
- * @see {@link https://docs.monerium.com/api#tag/orders/operation/post-orders | API Documentation}
1220
+ * @see {@link https://docs.monerium.com/api#tag/webhooks/operation/create-subscription | API Documentation}
1221
+ */
1222
+ createSubscription(input: CreateWebhookSubscriptionInput): Promise<WebhookSubscription>;
1223
+ /**
1224
+ * Update an existing webhook subscription.
1295
1225
  *
1296
- * @group Orders
1226
+ * @see {@link https://docs.monerium.com/api#tag/webhooks/operation/update-subscription | API Documentation}
1297
1227
  */
1298
- placeOrder(order: NewOrder): Promise<Order | ResponseStatus>;
1228
+ updateSubscription(input: UpdateWebhookSubscriptionInput): Promise<WebhookSubscription>;
1229
+ }
1230
+ declare class MoneriumPrivateClient extends MoneriumServerClient {
1231
+ }
1232
+ declare class MoneriumOAuthClient extends MoneriumBaseClient {
1299
1233
  /**
1300
- * @group IBANs
1301
- * @param {string} iban - the IBAN to move.
1302
- * @param {MoveIbanPayload} payload - the payload to move the IBAN.
1303
- * @see {@link https://docs.monerium.com/api#tag/ibans/operation/move-iban | API Documentation}
1234
+ * Build the authorization redirect URL.
1235
+ * Returns a URL string the caller navigates to it.
1236
+ * The SDK does not redirect.
1304
1237
  */
1305
- moveIban(iban: string, { address, chain }: MoveIbanPayload): Promise<ResponseStatus>;
1238
+ buildAuthorizationUrl(options: Omit<BuildAuthorizationUrlOptions, 'environment'>): string;
1306
1239
  /**
1307
- * @group IBANs
1308
- * @param {RequestIbanPayload} payload
1309
- * @see {@link https://docs.monerium.com/api#tag/ibans/operation/request-iban | API Documentation}
1240
+ * Build the SIWE authorization redirect URL.
1241
+ * Returns a URL string — the caller navigates to it.
1242
+ * The SDK does not redirect.
1243
+ *
1310
1244
  */
1311
- requestIban({ address, chain, emailNotifications, }: RequestIbanPayload): Promise<ResponseStatus>;
1245
+ buildSiweAuthorizationUrl(options: Omit<BuildSiweAuthorizationUrlOptions, 'environment'>): string;
1312
1246
  /**
1313
- * @deprecated There is no longer a PUT endpoint for profile details. Use PATCH instead.
1314
- * @group Profiles
1315
- * @see {@link https://docs.monerium.com/api#tag/profiles/operation/profile-details | API Documentation}
1247
+ * Exchange an authorization code for tokens.
1248
+ * The caller stores the returned BearerProfile — the SDK does not write to any storage.
1249
+ *
1316
1250
  */
1317
- submitProfileDetails(profile: string, body: SubmitProfileDetailsPayload): Promise<ResponseStatus>;
1251
+ authorizationCodeGrant(options: Omit<AuthorizationCodeGrantOptions, 'environment' | 'transport'>): Promise<BearerProfile>;
1318
1252
  /**
1319
- * @group Files
1320
- * @see {@link https://docs.monerium.com/api/#tag/files | API Documentation}
1253
+ * Get a new access token using a refresh token.
1254
+ * The caller stores the returned BearerProfile — the SDK does not write to any storage.
1321
1255
  */
1322
- uploadSupportingDocument(document: File): Promise<SupportingDoc>;
1256
+ refreshTokenGrant(options: Omit<RefreshTokenGrantOptions, 'environment' | 'transport'>): Promise<BearerProfile>;
1323
1257
  /**
1324
- * @deprecated Web sockets will be removed in v4 - use webhooks instead.
1325
- * Connects to the order notifications socket
1258
+ * Parse a callback URL or query string into structured fields.
1326
1259
  *
1327
- * @group Orders
1328
- * @param {OrderNotificationQueryParams} [params]
1329
- * @see {@link https://docs.monerium.com/api#tag/orders/operation/orders-notifications | API Document - Websocket}
1330
-
1260
+ * - Returns an empty object if none of the expected parameters are present.
1261
+ * - Check for the presence of `code` or `error` to determine if the URL
1262
+ * contains an OAuth2 authorization response.
1263
+ *
1264
+ * @example
1265
+ * const { code, error } = client.parseAuthorizationResponse(req.url);
1266
+ * const { code, error } = client.parseAuthorizationResponse('?code=abc&state=xyz');
1331
1267
  */
1332
- subscribeOrderNotifications({ filter, onMessage, onError, }?: {
1333
- /** specify which type of orders to listen to */
1334
- filter?: OrderNotificationQueryParams;
1335
- onMessage?: (data: Order) => void;
1336
- onError?: (err: Event) => void;
1337
- }): WebSocket | undefined;
1268
+ parseAuthorizationResponse(input: string): ParsedAuthorizationResponse;
1269
+ }
1270
+ declare class MoneriumWhitelabelClient extends MoneriumServerClient {
1338
1271
  /**
1339
- * @deprecated Web sockets will be removed in v4 - use webhooks instead.
1272
+ * Creates a new profile.
1340
1273
  *
1341
- * Closes the order notifications sockets
1274
+ * @see {@link https://docs.monerium.com/api#tag/profiles/operation/create-profile | API Documentation}
1275
+ */
1276
+ createProfile(input: CreateProfileInput): Promise<Profile>;
1277
+ /**
1278
+ * Share KYC data
1342
1279
  *
1343
- * @group Orders
1344
- * @param {OrderNotificationQueryParams} [params] - specify which socket to close or close all if not provided
1345
- * @see {@link https://docs.monerium.com/api#tag/orders/operation/orders-notifications | API Document - Websocket}
1280
+ * @returns {Promise<AcceptedResponse>} The KYC data import has been initiated. Subscribe to `profile.update` webhook to monitor the progress.
1281
+ * @see {@link https://docs.monerium.com/api#tag/profiles/operation/share-profile-kyc | API Documentation}
1282
+ *
1283
+ * @ignore NOT YET LIVE
1346
1284
  */
1347
- unsubscribeOrderNotifications(params?: OrderNotificationQueryParams): void;
1285
+ shareProfileKYC(input: ShareProfileKYCInput): Promise<AcceptedResponse>;
1348
1286
  /**
1349
- * @deprecated will be removed in v4, caller will manage state
1287
+ * Submit the compliance details for a profile. Updates only the `details` section without affecting other sections.
1350
1288
  *
1351
- * Cleanups the localstorage and websocket connections
1289
+ * > **KYC reliance model only.** Most integrations should use `shareProfileKYC()` to populate details via Sumsub instead.
1352
1290
  *
1353
- * @group Authentication
1291
+ * @see {@link https://docs.monerium.com/api#tag/profiles/operation/patch-profile-details | API Documentation}
1292
+ * @returns {Promise<AcceptedResponse>} The applicant details have been received and will be processed by Monerium.
1354
1293
  */
1355
- disconnect(): Promise<void>;
1294
+ updateProfileDetails(input: UpdateProfileDetailsInput): Promise<AcceptedResponse>;
1356
1295
  /**
1357
- * @deprecated will be removed in v4, caller will manage state
1358
- * Revokes access
1296
+ * Submit additional data for a profile used for risk calculations (e.g. purpose of account, source of funds). Updates only the `form` section without affecting other sections.
1359
1297
  *
1360
- * @group Authentication
1298
+ * @see {@link https://docs.monerium.com/api#tag/profiles/operation/patch-profile-form | API Documentation}
1299
+ * @returns {Promise<AcceptedResponse>} The profile form has been received and will be processed by Monerium.
1361
1300
  */
1362
- revokeAccess(): Promise<void>;
1301
+ updateProfileForm(input: UpdateProfileFormInput): Promise<AcceptedResponse>;
1363
1302
  /**
1303
+ * Submit verifications for a profile. Only the verifications provided are updated. `sourceOfFunds` is submitted here by all partners when required; other verification kinds are populated automatically when using the Sumsub share flow.
1364
1304
  *
1365
- * @hidden
1305
+ * @see {@link https://docs.monerium.com/api#tag/profiles/operation/patch-profile-verifications | API Documentation}
1306
+ * @returns {Promise<AcceptedResponse>} The verification data has been received and will be processed by Monerium.
1366
1307
  */
1367
- getEnvironment: () => Environment;
1308
+ updateProfileVerifications(input: UpdateProfileVerificationsInput): Promise<AcceptedResponse>;
1309
+ }
1310
+
1311
+ /**
1312
+ * Thrown when the Monerium API returns a non-2xx response.
1313
+ * Fields map directly to the API response body — nothing is translated or normalised.
1314
+ *
1315
+ * @example
1316
+ * try {
1317
+ * await client.getProfiles();
1318
+ * } catch (err) {
1319
+ * if (err instanceof MoneriumApiError) {
1320
+ * console.log(err.code); // 401
1321
+ * console.log(err.status); // "Unauthorized"
1322
+ * console.log(err.message); // "Not authenticated"
1323
+ * console.log(err.errors); // field-level validation errors, if present
1324
+ * }
1325
+ * }
1326
+ * @group Errors
1327
+ */
1328
+ declare class MoneriumApiError extends Error {
1329
+ code: number;
1330
+ status: string;
1331
+ errors?: Record<string, string>;
1332
+ details?: unknown;
1333
+ constructor(body: {
1334
+ code: number;
1335
+ status: string;
1336
+ message: string;
1337
+ errors?: Record<string, string>;
1338
+ details?: unknown;
1339
+ });
1340
+ }
1341
+ /**
1342
+ * @group Errors
1343
+ */
1344
+ type MoneriumSdkErrorType = 'network_error' | 'authentication_required' | 'invalid_configuration';
1345
+ /**
1346
+ * Thrown for SDK-level failures — no HTTP response involved.
1347
+ *
1348
+ * @example
1349
+ * try {
1350
+ * await client.getProfiles();
1351
+ * } catch (err) {
1352
+ * if (err instanceof MoneriumSdkError) {
1353
+ * console.log(err.type); // 'network_error' | 'authentication_required' | ...
1354
+ * console.log(err.cause); // underlying fetch error, if type === 'network_error'
1355
+ * }
1356
+ * }
1357
+ * @group Errors
1358
+ */
1359
+ declare class MoneriumSdkError extends Error {
1360
+ type: MoneriumSdkErrorType;
1361
+ cause?: unknown;
1362
+ constructor(type: MoneriumSdkErrorType, message: string, cause?: unknown);
1368
1363
  }
1369
1364
 
1365
+ /**
1366
+ * @group Utilities
1367
+ */
1370
1368
  declare const _default: {
1371
1369
  /**
1372
1370
  * The message used to link addresses.
1373
1371
  */
1374
1372
  LINK_MESSAGE: string;
1375
- /**
1376
- * The key used to store the code verifier in the local storage.
1377
- */
1378
- STORAGE_CODE_VERIFIER: string;
1379
- /**
1380
- * The key used to store the access token in the local storage.
1381
- */
1382
- STORAGE_ACCESS_TOKEN: string;
1383
- /**
1384
- * The unix timestamp used to calculate the expiration time of the access token.
1385
- */
1386
- STORAGE_ACCESS_EXPIRY: string;
1387
1373
  };
1388
1374
 
1389
1375
  /**
1390
- *
1391
1376
  * @param d Date to be formatted
1392
1377
  * @returns RFC3339 date format.
1393
1378
  * @example 2023-04-30T12:00:00+01:00
1394
1379
  * @example 2023-04-30T02:08:15Z
1380
+ * @group Utilities
1395
1381
  */
1396
1382
  declare const rfc3339: (d: Date) => string;
1397
1383
  /**
1398
1384
  * This will resolve the chainId number to the corresponding chain name.
1399
1385
  * @param chain The chainId of the network
1400
1386
  * @returns chain name, 'ethereum', 'polygon', 'gnosis', etc.
1387
+ * @group Utilities
1401
1388
  */
1402
1389
  declare const parseChain: (chain: Chain | ChainId) => Chain;
1403
1390
  /**
@@ -1419,10 +1406,13 @@ declare const parseChain: (chain: Chain | ChainId) => Chain;
1419
1406
  * @example `Send EUR 1 to 0x1234123412341234123412341234123412341234 on ethereum at 2023-04-30T12:00:00+01:00`
1420
1407
  *
1421
1408
  * @example `Send EUR 1 to IS1234123412341234 at 2023-04-30T12:00:00+01:00`
1409
+ * @group Utilities
1422
1410
  */
1423
1411
  declare const placeOrderMessage: (amount: string | number, currency: Currency, receiver: string, chain?: ChainId | Chain) => string;
1424
1412
  /**
1425
- * https://monerium.com/siwe
1413
+ * Construct an EIP-4361 SIWE message for use with {@link buildSiweAuthorizationUrl}.
1414
+ * @see https://monerium.com/siwe
1415
+ * @group Utilities
1426
1416
  */
1427
1417
  declare const siweMessage: ({ domain, address, appName, redirectUri, chainId, issuedAt, expiryAt, privacyPolicyUrl, termsOfServiceUrl, }: {
1428
1418
  domain: string;
@@ -1450,108 +1440,18 @@ declare const siweMessage: ({ domain, address, appName, redirectUri, chainId, is
1450
1440
  * getChain(137) // 'polygon'
1451
1441
  * getChain(80002) // 'amoy'
1452
1442
  * ```
1443
+ * @group Utilities
1453
1444
  */
1454
1445
  declare const getChain: (chainId: number) => Chain;
1446
+ /**
1447
+ * Shorten an IBAN for display: `GB29...2917`
1448
+ * @group Utilities
1449
+ */
1455
1450
  declare const shortenIban: (iban?: string) => string | undefined;
1456
- declare const shortenAddress: (address?: string) => string | undefined;
1457
-
1458
1451
  /**
1459
- * @packageDocumentation
1460
- * A library to interact with Monerium API.
1461
- *
1462
- * ![npm version](https://img.shields.io/npm/v/@monerium/sdk)
1463
- *
1464
- * ## Installation
1465
- *
1466
- * ```bash
1467
- * pnpm add @monerium/sdk
1468
- * ```
1469
- *
1470
- * @example
1471
- * ```ts
1472
- * // Current version - Deprecated in v4
1473
- * import { MoneriumClient } from '@monerium/sdk';
1474
- * const monerium = new MoneriumClient({
1475
- * clientId: '...',
1476
- * redirectUri: '...',
1477
- * environment: 'sandbox',
1478
- * });
1479
- *
1480
- * // Will redirect the user to Monerium's authentication code flow.
1481
- * await monerium.authorize();
1482
- *
1483
- * // Will use the authorization code flow code to get access token
1484
- * await monerium.getAccess();
1485
- *
1486
- * // or use refresh token to get access token if provided.
1487
- * await monerium.getAccess(refreshToken);
1488
- *
1489
- * // Retrieve profiles the client has access to.
1490
- * await monerium.getProfiles();
1491
- * ```
1492
- * ```ts
1493
- * // Upcoming v4 — factory function
1494
- * import {
1495
- * randomPKCECodeVerifier,
1496
- * calculatePKCECodeChallenge,
1497
- * buildAuthorizationUrl,
1498
- * authorizationCodeGrant,
1499
- * refreshTokenGrant,
1500
- * createMoneriumClient,
1501
- * } from '@monerium/sdk';
1502
- *
1503
- * // --- Initiate login ---
1504
- * const codeVerifier = randomPKCECodeVerifier();
1505
- * const codeChallenge = calculatePKCECodeChallenge(codeVerifier);
1506
- * session.set('pkce_verifier', codeVerifier); // server-side session
1507
- *
1508
- * const url = buildAuthorizationUrl({
1509
- * environment: 'sandbox',
1510
- * clientId: 'your-client-id',
1511
- * redirectUri: 'https://your-app.com/callback',
1512
- * codeChallenge,
1513
- * });
1514
- * res.redirect(url);
1515
- *
1516
- * // --- On the callback page ---
1517
- * const { code } = parseAuthorizationResponse(
1518
- * new URL(req.url, 'https://your-app.com')
1519
- * );
1520
- * const codeVerifier = session.get('pkce_verifier');
1521
- * session.delete('pkce_verifier');
1522
- *
1523
- * const bearerProfile = await authorizationCodeGrant({
1524
- * environment: 'sandbox',
1525
- * clientId: 'your-client-id',
1526
- * redirectUri: 'https://your-app.com/callback',
1527
- * code,
1528
- * codeVerifier,
1529
- * });
1530
- *
1531
- * req.session.accessToken = bearerProfile.access_token;
1532
- * req.session.refreshToken = bearerProfile.refresh_token;
1533
- * req.session.accessExpiry = Date.now() + bearerProfile.expires_in * 1000;
1534
- *
1535
- * // --- Use the API ---
1536
- * const client = createMoneriumClient({
1537
- * environment: 'sandbox',
1538
- * getAccessToken: async () => {
1539
- * if (Date.now() > session.accessExpiry) {
1540
- * const newProfile = await refreshTokenGrant({
1541
- * environment: 'sandbox',
1542
- * clientId: 'your-client-id',
1543
- * refreshToken: session.refreshToken,
1544
- * });
1545
- * session.accessToken = newProfile.access_token;
1546
- * session.accessExpiry = Date.now() + newProfile.expires_in * 1000;
1547
- * return newProfile.access_token;
1548
- * }
1549
- * return session.accessToken;
1550
- * },
1551
- * });
1552
- *
1553
- * const profiles = await client.getProfiles();
1554
- * ```
1452
+ * Shorten a blockchain address for display: `0x1234...abcd`
1453
+ * @group Utilities
1555
1454
  */
1455
+ declare const shortenAddress: (address?: string) => string | undefined;
1556
1456
 
1557
- export { AccountState, type Address, type AddressesQueryParams, type AddressesResponse, type AuthArgs, type AuthCodePayload, type AuthContext, type AuthFlowOptions, type AuthFlowOptionsShared, type AuthFlowSIWEOptions, type AuthorizationCodeCredentials, type AuthorizationCodeGrantOptions, type Balances, type BankAccountIdentifier, type BearerProfile, type BearerTokenCredentials, type Beneficiary, type BuildAuthorizationUrlOptions, type BuildSiweAuthorizationUrlOptions, type Chain, type ChainId, type ClassOptions, type ClientCredentials, type ClientCredentialsGrantOptions, type ClientCredentialsPayload, type Config, type CorporateProfileDetails, type CorporateProfileDetailsRequest, type Corporation, type CosmosChainId, type Counterpart, type CounterpartBank, type CounterpartDetails, type CrossChainIdentifier, Currency, type CurrencyBalance, type CurrencyCode, type Director, type ENV, type Environment, type EvmChainId, type Fee, type IBAN, type IBANIdentifier, type IBANsResponse, type IbansQueryParams, IdDocumentKind, type Identifier, type Individual, type Issuer, type KYC, KYCOutcome, KYCState, type LinkAddress, type LinkedAddress, Method, MoneriumApiError, MoneriumClient, type MoneriumClientOptions, MoneriumSdkError, type MoneriumSdkErrorType, type MoveIbanPayload, type NewOrder, type NewOrderByAccountId, type NewOrderByAddress, type NewOrderCommon, type Order, type OrderFilter, OrderKind, type OrderMetadata, type OrderNotificationQueryParams, OrderState, type OrdersResponse, type PKCERSIWERequestArgs, type PKCERequest, type PKCERequestArgs, type PKCERequestShared, type PKCESIWERequest, type ParsedAuthorizationResponse, PaymentStandard, type PendingLinkAddressSignature, type PendingOrderSignature, type PendingSignature, type PendingSignatureKind, Permission, type PersonalProfileDetails, type PersonalProfileDetailsRequest, type ProductionChain, type Profile, type ProfilePermissions, ProfileState, ProfileType, type ProfilesQueryParams, type ProfilesResponse, type RefreshTokenGrantOptions, type RefreshTokenPayload, type Representative, type RequestIbanPayload, type ResponseStatus, type SCANIdentifier, type SandboxChain, type SignaturesQueryParams, type SignaturesResponse, type SubmitProfileDetailsPayload, type SupportingDoc, type SupportingDocMetadata, type Ticker, type Token, type TokenSymbol, type Transport, type TransportRequest, type TransportResponse, authorizationCodeGrant, buildAuthorizationUrl, buildSiweAuthorizationUrl, calculatePKCECodeChallenge, clientCredentialsGrant, _default as constants, createMoneriumClient, MoneriumClient as default, getChain, parseAuthorizationResponse, parseChain, placeOrderMessage, randomPKCECodeVerifier, refreshTokenGrant, rfc3339, shortenAddress, shortenIban, siweMessage };
1457
+ export { type AcceptedResponse, type Address, type AddressesQueryParams, type AddressesResponse, type AuthContext, type AuthorizationCodeGrantOptions, type Balances, type BankAccountIdentifier, type BearerProfile, type Beneficiary, type BuildAuthorizationUrlOptions, type BuildSiweAuthorizationUrlOptions, type Chain, type ChainId, type ClientCredentialsGrantOptions, type Config, type CorporateProfileDetails, type CorporateProfileForm, type CorporateProfileVerification, type CorporateVerificationKind, type Corporation, type Counterpart, type CounterpartBank, type CounterpartDetails, type CreateProfileInput, type CreateWebhookSubscriptionInput, type CrossChainIdentifier, Currency, type CurrencyBalance, type CurrencyCode, type Director, type ENV, type Environment, type Fee, type FilesResponse, type GetBalancesParams, type GetProfilesParams, type IBAN, type IBANIdentifier, type IBANState, type IBANsResponse, type IbansParams, type IdDocumentKind, type Identifier, type Individual, type Issuer, type KYCProvider, type LinkAddress, type LinkAddressInput, type LinkAddressResponse, type Method, type MoneriumApiClientOptions, MoneriumApiError, MoneriumBaseClient, MoneriumOAuthClient, MoneriumPrivateClient, MoneriumSdkError, type MoneriumSdkErrorType, MoneriumServerClient, MoneriumWhitelabelClient, type MoveIbanInput, type Order, type OrderKind, type OrderMetadata, type OrderParams, type OrderState, type OrdersResponse, type ParsedAuthorizationResponse, type PaymentStandard, type PendingLinkAddressSignature, type PendingOrderSignature, type PendingSignature, type PendingSignatureKind, type Permission, type PersonalProfileDetails, type PersonalProfileForm, type PersonalProfileVerification, type PersonalVerificationKind, type PlaceOrderInput, type ProductionChain, type Profile, type ProfileDetailsState, type ProfileFormState, type ProfileKind, type ProfileState, ProfileType, type ProfileVerificationState, type ProfilesResponse, type RefreshTokenGrantOptions, type Representative, type RequestIbanInput, type SCANIdentifier, type SandboxChain, type ShareProfileKYCInput, type SignaturesParams, type SignaturesResponse, type SupportingDocMetadata, type Ticker, type Token, type TokenSymbol, type Transport, type TransportRequest, type TransportResponse, type UpdateProfileDetailsInput, type UpdateProfileFormInput, type UpdateProfileVerificationsInput, type UpdateWebhookSubscriptionInput, type WebhookEventType, type WebhookSubscription, type WebhookSubscriptionState, type WebhookSubscriptionsResponse, calculatePKCECodeChallenge, _default as constants, generatePKCE, getChain, parseAuthorizationResponse, parseChain, placeOrderMessage, randomPKCECodeVerifier, rfc3339, shortenAddress, shortenIban, siweMessage };