@monerium/sdk 2.13.3 → 2.15.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/README.md +47 -22
- package/dist/index.d.ts +51 -62
- package/dist/index.js +16 -17
- package/dist/index.mjs +4 -4
- package/package.json +4 -6
package/README.md
CHANGED
|
@@ -3,17 +3,43 @@
|
|
|
3
3
|
|
|
4
4
|
# Monerium SDK Documentation
|
|
5
5
|
|
|
6
|
+
<a href="https://monerium.dev/">
|
|
7
|
+
<picture>
|
|
8
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/badge/Developer_portal-2c6ca7">
|
|
9
|
+
<img src="https://img.shields.io/badge/Developer_portal-2c6ca7" alt="Static Badge">
|
|
10
|
+
</picture>
|
|
11
|
+
</a>
|
|
12
|
+
<a href="https://monerium.dev/api-docs">
|
|
13
|
+
<picture>
|
|
14
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/badge/API_documentation-2c6ca7">
|
|
15
|
+
<img src="https://img.shields.io/badge/API_documentation-2c6ca7" alt="Static Badge">
|
|
16
|
+
</picture>
|
|
17
|
+
</a>
|
|
18
|
+
</br>
|
|
19
|
+
<a href="https://www.npmjs.com/package/@monerium/sdk">
|
|
20
|
+
<picture>
|
|
21
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/v/%40monerium%2Fsdk?colorA=2c6ca7&colorB=21262d">
|
|
22
|
+
<img src="https://img.shields.io/npm/v/%40monerium%2Fsdk?colorA=f6f8fa&colorB=f6f8fa" alt="Version">
|
|
23
|
+
</picture>
|
|
24
|
+
</a>
|
|
25
|
+
<a href="https://github.com/monerium/js-monorepo/issues>
|
|
26
|
+
<picture>
|
|
27
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/github/issues/monerium/js-monorepo?colorA=2c6ca7&colorB=21262d">
|
|
28
|
+
<img src="https://img.shields.io/github/issues/monerium/js-monorepo?colorA=2c6ca7&colorB=21262d" alt="Version">
|
|
29
|
+
</picture>
|
|
30
|
+
</a>
|
|
31
|
+
|
|
32
|
+
## Introduction
|
|
33
|
+
|
|
6
34
|
Monerium connects your web3 wallet to any euro bank account with your personal IBAN.
|
|
7
35
|
All incoming euro payments are automatically minted as EURe tokens to your wallet.
|
|
8
36
|
Sending EURe to traditional bank accounts is just as easy.
|
|
9
37
|
With a single signature from your wallet, your EURe is burned and sent as Euros to any bank account.
|
|
10
38
|
|
|
11
|
-
##
|
|
39
|
+
## Documentation
|
|
12
40
|
|
|
13
41
|
- [Documentation](./docs/generated/README.md)
|
|
14
|
-
- [
|
|
15
|
-
- [Developer portal](https://monerium.dev/')
|
|
16
|
-
- [NPM](https://www.npmjs.com/package/@monerium/sdk)
|
|
42
|
+
- [Documentation - MoneriumClient](./docs/generated/classes/MoneriumClient.md)
|
|
17
43
|
|
|
18
44
|
## Table of Contents
|
|
19
45
|
|
|
@@ -85,8 +111,8 @@ const { access_token, refresh_token } = monerium.bearerProfile as BearerProfile;
|
|
|
85
111
|
|
|
86
112
|
Interfaces:
|
|
87
113
|
|
|
88
|
-
-
|
|
89
|
-
-
|
|
114
|
+
- [MoneriumClient](./docs/generated/classes/MoneriumClient.md)
|
|
115
|
+
- [BearerProfile](./docs/generated/interfaces/BearerProfile.md)
|
|
90
116
|
|
|
91
117
|
API documentation:
|
|
92
118
|
|
|
@@ -111,7 +137,7 @@ export function App() {
|
|
|
111
137
|
const sdk = new MoneriumClient({
|
|
112
138
|
environment: 'sandbox',
|
|
113
139
|
clientId: 'f99e629b-6dca-11ee-8aa6-5273f65ed05b',
|
|
114
|
-
|
|
140
|
+
redirectUri: 'http://localhost:4200',
|
|
115
141
|
});
|
|
116
142
|
setMonerium(sdk);
|
|
117
143
|
}, []);
|
|
@@ -157,8 +183,8 @@ export function App() {
|
|
|
157
183
|
|
|
158
184
|
Interfaces:
|
|
159
185
|
|
|
160
|
-
-
|
|
161
|
-
-
|
|
186
|
+
- [AuthCodeRequest](./docs/generated/interfaces/AuthCodeRequest.md)
|
|
187
|
+
- [BearerProfile](./docs/generated/interfaces/BearerProfile.md)
|
|
162
188
|
|
|
163
189
|
API documentation:
|
|
164
190
|
|
|
@@ -183,9 +209,9 @@ const balances: Balances = await monerium.getBalances(profileId);
|
|
|
183
209
|
|
|
184
210
|
Interfaces:
|
|
185
211
|
|
|
186
|
-
-
|
|
187
|
-
-
|
|
188
|
-
-
|
|
212
|
+
- [AuthContext](./docs/generated/interfaces/AuthContext.md)
|
|
213
|
+
- [Profile](./docs/generated/interfaces/Profile.md)
|
|
214
|
+
- [Balances](./docs/generated/interfaces/Balances.md)
|
|
189
215
|
|
|
190
216
|
API documentation:
|
|
191
217
|
|
|
@@ -203,7 +229,7 @@ const tokens: Token[] = await monerium.getTokens();
|
|
|
203
229
|
|
|
204
230
|
Interfaces:
|
|
205
231
|
|
|
206
|
-
-
|
|
232
|
+
- [Token](./docs/generated/interfaces/Token.md)
|
|
207
233
|
|
|
208
234
|
API documentation:
|
|
209
235
|
|
|
@@ -234,15 +260,15 @@ await monerium.linkAddress(profileId, {
|
|
|
234
260
|
message: LINK_MESSAGE
|
|
235
261
|
signature,
|
|
236
262
|
accounts: [
|
|
237
|
-
{"currency":"eur","chain":"ethereum"
|
|
238
|
-
{"currency":"eur","chain":"gnosis"
|
|
263
|
+
{"currency":"eur","chain":"ethereum"},
|
|
264
|
+
{"currency":"eur","chain":"gnosis"}
|
|
239
265
|
],
|
|
240
266
|
} as LinkAddress);
|
|
241
267
|
```
|
|
242
268
|
|
|
243
269
|
Interfaces:
|
|
244
270
|
|
|
245
|
-
-
|
|
271
|
+
- [LinkAddress](./docs/generated/interfaces/LinkAddress.md)
|
|
246
272
|
|
|
247
273
|
API documentation:
|
|
248
274
|
|
|
@@ -264,7 +290,7 @@ const amount = '100'; // replace with the amount in EUR
|
|
|
264
290
|
const iban = 'EE12341234123412341234'; // replace with requested IBAN
|
|
265
291
|
|
|
266
292
|
// First you have to form the message that will be signed by the user
|
|
267
|
-
const message = placeOrderMessage(amount, iban);
|
|
293
|
+
const message = placeOrderMessage(amount, 'eur', iban);
|
|
268
294
|
|
|
269
295
|
// The message should look like this, with the current date and time in RFC3339 format:
|
|
270
296
|
// Send EUR 100 to EE12341234123412341234 at Thu, 29 Dec 2022 14:58:29Z
|
|
@@ -278,6 +304,7 @@ const signature = await walletClient.signMessage({
|
|
|
278
304
|
const order = await monerium.placeOrder({
|
|
279
305
|
amount,
|
|
280
306
|
signature,
|
|
307
|
+
currency: 'eur',
|
|
281
308
|
address: '0xUserAddress72413Fa92980B889A1eCE84dD', // user wallet address
|
|
282
309
|
counterpart: {
|
|
283
310
|
identifier: {
|
|
@@ -300,8 +327,8 @@ const order = await monerium.placeOrder({
|
|
|
300
327
|
|
|
301
328
|
Interfaces:
|
|
302
329
|
|
|
303
|
-
-
|
|
304
|
-
-
|
|
330
|
+
- [Order](./docs/generated/interfaces/Order.md)
|
|
331
|
+
- [PaymentStandard](./docs/generated/enumerations/PaymentStandard.md)
|
|
305
332
|
|
|
306
333
|
API documentation:
|
|
307
334
|
|
|
@@ -320,7 +347,7 @@ const supportingDocumentId: SupportingDoc =
|
|
|
320
347
|
|
|
321
348
|
Interfaces:
|
|
322
349
|
|
|
323
|
-
-
|
|
350
|
+
- [SupportingDoc](./docs/generated/interfaces/SupportingDoc.md)
|
|
324
351
|
|
|
325
352
|
API documentation:
|
|
326
353
|
|
|
@@ -383,8 +410,6 @@ pnpm build
|
|
|
383
410
|
|
|
384
411
|
Refer to [Typedocs](https://typedoc.org/) syntaxes to use for this [documentation](https://monerium.github.io/js-monorepo/).
|
|
385
412
|
|
|
386
|
-
There is a Github action that will automatically run on the successful release of the SDK. It will generate a static output of the documentation and push it to the `gh-pages` branch. The documentation is then available at https://monerium.github.io/js-monorepo/.
|
|
387
|
-
|
|
388
413
|
#### Publishing
|
|
389
414
|
|
|
390
415
|
When changes are merged to the `main` branch that follows the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) standard, [release-please](https://github.com/googleapis/release-please) workflow creates a pull request, preparing for the next release. If kept open, the following commits will also be added to the PR. Merging that PR will create a new release, a workflow will publish it on NPM and tag it on Github.
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ type ENV = 'sandbox' | 'production';
|
|
|
13
13
|
type EthereumTestnet = 'sepolia';
|
|
14
14
|
type GnosisTestnet = 'chiado';
|
|
15
15
|
type PolygonTestnet = 'amoy';
|
|
16
|
-
type Chain = 'ethereum' | 'gnosis' | 'polygon';
|
|
16
|
+
type Chain = 'ethereum' | 'gnosis' | 'polygon' | 'gnosismainnet';
|
|
17
17
|
type Networks = EthereumTestnet | GnosisTestnet | PolygonTestnet | 'mainnet';
|
|
18
18
|
type NetworkSemiStrict<C extends Chain> = C extends 'ethereum' ? EthereumTestnet | 'mainnet' : C extends 'gnosis' ? GnosisTestnet | 'mainnet' : C extends 'polygon' ? PolygonTestnet | 'mainnet' : never;
|
|
19
19
|
type NetworkStrict<C extends Chain, E extends ENV> = E extends 'production' ? 'mainnet' : E extends 'sandbox' ? C extends 'ethereum' ? EthereumTestnet : C extends 'gnosis' ? GnosisTestnet : C extends 'polygon' ? PolygonTestnet : never : never;
|
|
@@ -92,12 +92,8 @@ type PKCERequest = {
|
|
|
92
92
|
address?: string;
|
|
93
93
|
/** the signature of the wallet to automatically link */
|
|
94
94
|
signature?: string;
|
|
95
|
-
/** @deprecated - Use chainId */
|
|
96
|
-
network?: Network;
|
|
97
|
-
/** @deprecated - Use chainId */
|
|
98
|
-
chain?: Chain;
|
|
99
95
|
/** The network of the wallet to automatically link */
|
|
100
|
-
|
|
96
|
+
chain?: Chain | ChainId;
|
|
101
97
|
};
|
|
102
98
|
declare enum Method {
|
|
103
99
|
password = "password",
|
|
@@ -211,12 +207,10 @@ interface IBAN extends Identifier {
|
|
|
211
207
|
}
|
|
212
208
|
interface CrossChain extends Identifier {
|
|
213
209
|
standard: PaymentStandard.chain;
|
|
210
|
+
/** The receivers address */
|
|
214
211
|
address: string;
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
chain?: Chain;
|
|
218
|
-
/** @deprecated - Use chainId */
|
|
219
|
-
network?: Network;
|
|
212
|
+
/** The receivers network */
|
|
213
|
+
chain: Chain | ChainId;
|
|
220
214
|
}
|
|
221
215
|
interface SCAN extends Identifier {
|
|
222
216
|
standard: PaymentStandard.scan;
|
|
@@ -288,7 +282,7 @@ type NewOrder = NewOrderByAddress | NewOrderByAccountId;
|
|
|
288
282
|
interface NewOrderCommon {
|
|
289
283
|
amount: string;
|
|
290
284
|
signature: string;
|
|
291
|
-
currency
|
|
285
|
+
currency: Currency;
|
|
292
286
|
counterpart: Counterpart;
|
|
293
287
|
message: string;
|
|
294
288
|
memo?: string;
|
|
@@ -296,11 +290,8 @@ interface NewOrderCommon {
|
|
|
296
290
|
}
|
|
297
291
|
interface NewOrderByAddress extends NewOrderCommon {
|
|
298
292
|
address: string;
|
|
299
|
-
/**
|
|
300
|
-
chain
|
|
301
|
-
/** @deprecated - Use 'chainId' */
|
|
302
|
-
network?: Network;
|
|
303
|
-
chainId: ChainId;
|
|
293
|
+
/** The senders network */
|
|
294
|
+
chain: Chain | ChainId;
|
|
304
295
|
}
|
|
305
296
|
interface NewOrderByAccountId extends NewOrderCommon {
|
|
306
297
|
accountId: string;
|
|
@@ -319,11 +310,8 @@ interface SupportingDoc {
|
|
|
319
310
|
meta: SupportingDocMetadata;
|
|
320
311
|
}
|
|
321
312
|
interface CurrencyAccounts {
|
|
322
|
-
/**
|
|
323
|
-
|
|
324
|
-
/** @deprecated - Use 'chainId' */
|
|
325
|
-
chain?: Chain;
|
|
326
|
-
chainId: ChainId;
|
|
313
|
+
/** The accounts network */
|
|
314
|
+
chain: Chain | ChainId;
|
|
327
315
|
currency: Currency;
|
|
328
316
|
}
|
|
329
317
|
interface LinkAddress {
|
|
@@ -331,11 +319,17 @@ interface LinkAddress {
|
|
|
331
319
|
message: string;
|
|
332
320
|
signature: string;
|
|
333
321
|
accounts: CurrencyAccounts[];
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
322
|
+
chain?: Chain | ChainId;
|
|
323
|
+
}
|
|
324
|
+
interface LinkedAddress {
|
|
325
|
+
id: string;
|
|
326
|
+
profile: string;
|
|
327
|
+
address: string;
|
|
328
|
+
message: string;
|
|
329
|
+
meta: {
|
|
330
|
+
linkedBy: string;
|
|
331
|
+
linkedAt: string;
|
|
332
|
+
};
|
|
339
333
|
}
|
|
340
334
|
interface OrderNotification {
|
|
341
335
|
id: string;
|
|
@@ -360,11 +354,14 @@ type ClassOptions = {
|
|
|
360
354
|
} & BearerTokenCredentials;
|
|
361
355
|
interface AuthFlowOptions {
|
|
362
356
|
clientId?: string;
|
|
357
|
+
redirectUri?: string;
|
|
358
|
+
/** @deprecated use redirectUri */
|
|
363
359
|
redirectUrl?: string;
|
|
364
360
|
address?: string;
|
|
365
361
|
signature?: string;
|
|
366
|
-
|
|
362
|
+
chain?: Chain | ChainId;
|
|
367
363
|
state?: string;
|
|
364
|
+
scope?: string;
|
|
368
365
|
}
|
|
369
366
|
interface ClientCredentials {
|
|
370
367
|
clientId: string;
|
|
@@ -372,9 +369,15 @@ interface ClientCredentials {
|
|
|
372
369
|
}
|
|
373
370
|
interface AuthorizationCodeCredentials {
|
|
374
371
|
clientId: string;
|
|
375
|
-
|
|
372
|
+
redirectUri: string;
|
|
376
373
|
}
|
|
377
|
-
|
|
374
|
+
/** @deprecated use redirectUri */
|
|
375
|
+
interface DeprecatedAuthorizationCodeCredentials {
|
|
376
|
+
clientId?: string;
|
|
377
|
+
/** @deprecated use redirectUri */
|
|
378
|
+
redirectUrl?: string;
|
|
379
|
+
}
|
|
380
|
+
type BearerTokenCredentials = ClientCredentials | AuthorizationCodeCredentials | DeprecatedAuthorizationCodeCredentials;
|
|
378
381
|
|
|
379
382
|
declare class MoneriumClient {
|
|
380
383
|
#private;
|
|
@@ -403,14 +406,14 @@ declare class MoneriumClient {
|
|
|
403
406
|
* new MoneriumClient({
|
|
404
407
|
* environment: 'sandbox',
|
|
405
408
|
* clientId: 'your-client-id',
|
|
406
|
-
*
|
|
409
|
+
* redirectUri: 'your-redirect-url'
|
|
407
410
|
* })
|
|
408
411
|
* */
|
|
409
412
|
constructor(envOrOptions?: ENV | ClassOptions);
|
|
410
413
|
/**
|
|
411
|
-
* Construct the url to the authorization code flow,
|
|
414
|
+
* Construct the url to the authorization code flow and redirects,
|
|
412
415
|
* Code Verifier needed for the code challenge is stored in local storage
|
|
413
|
-
* For automatic wallet link, add the following properties: `address`, `signature` & `
|
|
416
|
+
* For automatic wallet link, add the following properties: `address`, `signature` & `chain`
|
|
414
417
|
* @returns string
|
|
415
418
|
* {@link https://monerium.dev/api-docs#operation/auth}
|
|
416
419
|
* @category Auth
|
|
@@ -422,7 +425,7 @@ declare class MoneriumClient {
|
|
|
422
425
|
* @returns boolean to indicate if access has been granted
|
|
423
426
|
* @category Auth
|
|
424
427
|
*/
|
|
425
|
-
getAccess(client?: AuthorizationCodeCredentials | ClientCredentials): Promise<boolean>;
|
|
428
|
+
getAccess(client?: AuthorizationCodeCredentials | ClientCredentials | DeprecatedAuthorizationCodeCredentials): Promise<boolean>;
|
|
426
429
|
/**
|
|
427
430
|
* {@link https://monerium.dev/api-docs#operation/auth-context}
|
|
428
431
|
* @category Auth
|
|
@@ -434,6 +437,11 @@ declare class MoneriumClient {
|
|
|
434
437
|
* @category Profiles
|
|
435
438
|
*/
|
|
436
439
|
getProfile(profileId: string): Promise<Profile>;
|
|
440
|
+
/**
|
|
441
|
+
* {@link https://monerium.dev/api-docs#operation/profiles}
|
|
442
|
+
* @category Profiles
|
|
443
|
+
*/
|
|
444
|
+
getProfiles(): Promise<Profile[]>;
|
|
437
445
|
/**
|
|
438
446
|
* {@link https://monerium.dev/api-docs#operation/profile-balances}
|
|
439
447
|
* @param {string=} profileId - the id of the profile to fetch balances.
|
|
@@ -459,12 +467,12 @@ declare class MoneriumClient {
|
|
|
459
467
|
* {@link https://monerium.dev/api-docs#operation/profile-addresses}
|
|
460
468
|
* @category Accounts
|
|
461
469
|
*/
|
|
462
|
-
linkAddress(profileId: string, body: LinkAddress): Promise<
|
|
470
|
+
linkAddress(profileId: string, body: LinkAddress): Promise<LinkedAddress>;
|
|
463
471
|
/**
|
|
464
472
|
* {@link https://monerium.dev/api-docs#operation/post-orders}
|
|
465
473
|
* @category Orders
|
|
466
474
|
*/
|
|
467
|
-
placeOrder(order: NewOrder
|
|
475
|
+
placeOrder(order: NewOrder): Promise<Order>;
|
|
468
476
|
/**
|
|
469
477
|
* {@link https://monerium.dev/api-docs#operation/supporting-document}
|
|
470
478
|
* @category Orders
|
|
@@ -506,29 +514,13 @@ declare class MoneriumClient {
|
|
|
506
514
|
*/
|
|
507
515
|
unsubscribeOrders(event: MoneriumEvent): void;
|
|
508
516
|
/**
|
|
509
|
-
* @deprecated since v2.6.4, will be removed in 2.7.2+, use {@link getAccess} instead.
|
|
510
|
-
* @hidden
|
|
511
|
-
*/
|
|
512
|
-
auth: (args: AuthArgs) => Promise<BearerProfile>;
|
|
513
|
-
/**
|
|
514
|
-
* @deprecated since v2.7.1, will be removed in 2.7.2+, use {@link getAccess} instead.
|
|
515
517
|
* @hidden
|
|
516
518
|
*/
|
|
517
|
-
|
|
519
|
+
getEnvironment: () => Environment;
|
|
518
520
|
/**
|
|
519
|
-
* @deprecated since v2.6.4, will be removed in 2.7.2+, use {@link authorize} instead.
|
|
520
521
|
* @hidden
|
|
521
522
|
*/
|
|
522
523
|
getAuthFlowURI: (args: PKCERequestArgs) => string;
|
|
523
|
-
/**
|
|
524
|
-
* @deprecated since v2.0.7, will be removed in 2.7.2+, use {@link getAuthFlowURI} instead.
|
|
525
|
-
* @hidden
|
|
526
|
-
*/
|
|
527
|
-
pkceRequest: (args: PKCERequestArgs) => string;
|
|
528
|
-
/**
|
|
529
|
-
* @hidden
|
|
530
|
-
*/
|
|
531
|
-
getEnvironment: () => Environment;
|
|
532
524
|
}
|
|
533
525
|
|
|
534
526
|
declare const _default: {
|
|
@@ -549,20 +541,17 @@ declare const _default: {
|
|
|
549
541
|
declare const rfc3339: (d: Date) => string;
|
|
550
542
|
/**
|
|
551
543
|
* The message to be signed when placing an order.
|
|
552
|
-
*
|
|
544
|
+
* @param amount The amount to be sent
|
|
545
|
+
* @param currency The currency to be sent
|
|
546
|
+
* @param receiver The receiver of the funds
|
|
547
|
+
* @param chain The chainId of the network if it's a cross-chain transaction
|
|
553
548
|
* @returns string
|
|
554
549
|
*/
|
|
555
|
-
declare const placeOrderMessage: (amount: string | number,
|
|
550
|
+
declare const placeOrderMessage: (amount: string | number, currency: Currency, receiver: string, chain?: ChainId | Chain) => string;
|
|
556
551
|
/**
|
|
557
552
|
* Get the corresponding Monerium SDK Chain from the current chain id
|
|
558
553
|
* @returns The Chain
|
|
559
554
|
*/
|
|
560
555
|
declare const getChain: (chainId: number) => Chain;
|
|
561
|
-
/**
|
|
562
|
-
* Get the corresponding Monerium SDK Network from the current chain id
|
|
563
|
-
* @returns The Network
|
|
564
|
-
* @deprecated network will be removed from Monerium API in the near future.
|
|
565
|
-
*/
|
|
566
|
-
declare const getNetwork: (chainId: number) => Networks;
|
|
567
556
|
|
|
568
|
-
export { type Account, AccountState, type AuthArgs, type AuthCodeRequest, type AuthContext, type AuthFlowOptions, type AuthProfile, type AuthorizationCodeCredentials, type Balance, type Balances, type BearerProfile, type BearerTokenCredentials, type Chain, type ChainId, type ClassOptions, type ClientCredentials, type ClientCredentialsRequest, type Config, type Corporation, type Counterpart, type CrossChain, Currency, type CurrencyAccounts, type ENV, type Environment, type EthereumTestnet, type Fee, type GnosisTestnet, type IBAN, type Identifier, type Individual, type KYC, KYCOutcome, KYCState, type LinkAddress, Method, MoneriumClient, type MoneriumEvent, type MoneriumEventListener, type Network, type NetworkSemiStrict, type NetworkStrict, type Networks, type NewOrder, type NewOrderByAccountId, type NewOrderByAddress, type NewOrderCommon, type OpenArgs, type Order, type OrderFilter, OrderKind, type OrderMetadata, type OrderNotification, OrderState, type PKCERequest, type PKCERequestArgs, PaymentStandard, Permission, type PolygonTestnet, type Profile, ProfileType, type RefreshTokenRequest, type SCAN, type SupportingDoc, type SupportingDocMetadata, type Ticker, type Token, type TokenSymbol, _default as constants, MoneriumClient as default, getChain,
|
|
557
|
+
export { type Account, AccountState, type AuthArgs, type AuthCodeRequest, type AuthContext, type AuthFlowOptions, type AuthProfile, type AuthorizationCodeCredentials, type Balance, type Balances, type BearerProfile, type BearerTokenCredentials, type Chain, type ChainId, type ClassOptions, type ClientCredentials, type ClientCredentialsRequest, type Config, type Corporation, type Counterpart, type CrossChain, Currency, type CurrencyAccounts, type DeprecatedAuthorizationCodeCredentials, type ENV, type Environment, type EthereumTestnet, type Fee, type GnosisTestnet, type IBAN, type Identifier, type Individual, type KYC, KYCOutcome, KYCState, type LinkAddress, type LinkedAddress, Method, MoneriumClient, type MoneriumEvent, type MoneriumEventListener, type Network, type NetworkSemiStrict, type NetworkStrict, type Networks, type NewOrder, type NewOrderByAccountId, type NewOrderByAddress, type NewOrderCommon, type OpenArgs, type Order, type OrderFilter, OrderKind, type OrderMetadata, type OrderNotification, OrderState, type PKCERequest, type PKCERequestArgs, PaymentStandard, Permission, type PolygonTestnet, type Profile, ProfileType, type RefreshTokenRequest, type SCAN, type SupportingDoc, type SupportingDocMetadata, type Ticker, type Token, type TokenSymbol, _default as constants, MoneriumClient as default, getChain, placeOrderMessage, rfc3339 };
|
package/dist/index.js
CHANGED
|
@@ -2,30 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
5
|
+
var $ = require('crypto-js/enc-base64url.js');
|
|
6
|
+
var D = require('crypto-js/sha256.js');
|
|
7
7
|
|
|
8
8
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
|
|
10
|
-
var
|
|
11
|
-
var
|
|
10
|
+
var $__default = /*#__PURE__*/_interopDefault($);
|
|
11
|
+
var D__default = /*#__PURE__*/_interopDefault(D);
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var l={environments:{production:{api:"https://api.monerium.app",web:"https://monerium.app",wss:"wss://api.monerium.app"},sandbox:{api:"https://api.monerium.dev",web:"https://sandbox.monerium.dev",wss:"wss://api.monerium.dev"}}};var c={LINK_MESSAGE:"I hereby declare that I am the address owner.",STORAGE_CODE_VERIFIER:"monerium.sdk.code_verifier",STORAGE_REFRESH_TOKEN:"monerium.sdk.refresh_token"};var E=(i=>(i.eur="eur",i.usd="usd",i.gbp="gbp",i.isk="isk",i))(E||{}),b=(i=>(i.password="password",i.resource="resource",i.jwt="jwt",i.apiKey="apiKey",i))(b||{}),P=(t=>(t.corporate="corporate",t.personal="personal",t))(P||{}),O=(t=>(t.read="read",t.write="write",t))(O||{}),T=(i=>(i.absent="absent",i.submitted="submitted",i.pending="pending",i.confirmed="confirmed",i))(T||{}),v=(r=>(r.approved="approved",r.rejected="rejected",r.unknown="unknown",r))(v||{}),N=(r=>(r.requested="requested",r.approved="approved",r.pending="pending",r))(N||{}),q=(r=>(r.iban="iban",r.scan="scan",r.chain="chain",r))(q||{}),B=(t=>(t.redeem="redeem",t.issue="issue",t))(B||{}),U=(i=>(i.placed="placed",i.pending="pending",i.processed="processed",i.rejected="rejected",i))(U||{});var C=n=>{if(n.toString()==="Invalid Date")throw n;let e=r=>r<10?"0"+r:r,t=r=>{if(r===0)return "Z";let i=r>0?"-":"+";return r=Math.abs(r),i+e(Math.floor(r/60))+":"+e(r%60)};return n.getFullYear()+"-"+e(n.getMonth()+1)+"-"+e(n.getDate())+"T"+e(n.getHours())+":"+e(n.getMinutes())+":"+e(n.getSeconds())+t(n.getTimezoneOffset())},h=n=>typeof n=="number"?R(n):n,z=(n,e,t,r)=>{let i=`${e?.toUpperCase()||"EUR"}`;return r?`Send ${i} ${n} to ${t} on ${h(r)} at ${C(new Date)}`:`Send ${i} ${n} to ${t} at ${C(new Date)}`},u=n=>n&&Object.entries(n)?.length>0?Object.entries(n).map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join("&"):"",R=n=>{switch(n){case 1:case 11155111:return "ethereum";case 100:case 10200:return "gnosis";case 137:case 80002:return "polygon";default:throw new Error(`Chain not supported: ${n}`)}};var p=n=>{if(n?.chain){let{chain:e,...t}=n;return {...t,chain:h(e)}}return n};var M=(n,e)=>{let{client_id:t,redirect_uri:r,scope:i,state:s,address:o,signature:d,chain:k}=n,S=o?{address:o,...d!==void 0?{signature:d}:{},...k!==void 0?{chain:h(k)}:{}}:{};return u({client_id:t,redirect_uri:r,...i!==void 0?{scope:i}:{},...s!==void 0?{state:s}:{},code_challenge:e,code_challenge_method:"S256",response_type:"code",...S})},F=()=>{let n="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=e.length,r=0;for(;r<128;)n+=e.charAt(Math.floor(Math.random()*t)),r+=1;return n},L=n=>$__default.default.stringify(D__default.default(n)),x=(n,e)=>{let t=F(),r=L(t);return localStorage.setItem(c.STORAGE_CODE_VERIFIER,t||""),`${n}/auth?${M(e,r)}`},y=()=>{let n=window.location.href;if(!n||!n?.includes("?"))return;let[e,t]=n.split("?");t&&window.history.replaceState(null,"",e);},w=n=>n.code!=null,I=n=>n.refresh_token!=null,_=n=>n.client_secret!=null;var A=async(n,e,t,r)=>{let i=await fetch(`${n}`,{method:e,headers:r,body:t}),s,o=await i.text();try{s=JSON.parse(o);}catch{throw o}if(!i.ok)throw s;return s};var {STORAGE_CODE_VERIFIER:g,STORAGE_REFRESH_TOKEN:m}=c,a=typeof window>"u",f=class{#t;#i;codeVerifier;bearerProfile;#s;#n=new Map;isAuthorized=!!this.bearerProfile;#r;state;constructor(e){if(!e){this.#t=l.environments.sandbox;return}if(typeof e=="string")this.#t=l.environments[e];else if(this.#t=l.environments[e.environment||"sandbox"],a){let{clientId:t,clientSecret:r}=e;this.#r={clientId:t,clientSecret:r};}else {let{clientId:t,redirectUri:r}=e,{redirectUrl:i}=e;this.#r={clientId:t,redirectUri:r||i};}}async authorize(e){let t=e?.clientId||this.#r?.clientId,r=e?.redirectUri||e?.redirectUrl||this.#r?.redirectUri;if(!t)throw new Error("Missing ClientId");if(!r)throw new Error("Missing RedirectUri");let i=x(this.#t.api,{client_id:t,redirect_uri:r,address:e?.address,signature:e?.signature,chain:e?.chain,state:e?.state,scope:e?.scope});window.location.assign(i);}async getAccess(e){let t=e?.clientId||this.#r?.clientId;if(e?.clientSecret||this.#r?.clientSecret){if(!a)throw new Error("Only use client credentials on server side");return await this.#d(this.#r),!!this.bearerProfile}let i=e?.redirectUri||e?.redirectUrl||this.#r?.redirectUri;if(!t)throw new Error("Missing ClientId");if(a)throw new Error("This only works client side");let s=new URLSearchParams(window.location.search).get("code")||void 0,o=new URLSearchParams(window.location.search).get("state")||void 0,d=localStorage.getItem(m)||void 0;return d?await this.#c(t,d):s&&await this.#a(t,i,s,o),!!this.bearerProfile}async#o(e){let t;if(w(e))t={...e,grant_type:"authorization_code"};else if(I(e))t={...e,grant_type:"refresh_token"};else if(_(e))t={...e,grant_type:"client_credentials"};else throw new Error("Authorization grant type could not be detected.");return await this.#e("post","auth/token",t,!0).then(r=>{this.bearerProfile=r,this.isAuthorized=!!r,this.#i=`Bearer ${r?.access_token}`,a||window.localStorage.setItem(m,this.bearerProfile?.refresh_token||"");}).catch(r=>{throw a||(localStorage.removeItem(g),localStorage.removeItem(m),y()),new Error(r?.message)}),w(e)&&y(),this.bearerProfile}getAuthContext(){return this.#e("get","auth/context")}getProfile(e){return this.#e("get",`profiles/${e}`)}getProfiles(){return this.#e("get","profiles")}getBalances(e){return e?this.#e("get",`profiles/${e}/balances`):this.#e("get","balances")}getOrders(e){let t=u(e),r=t?`orders?${t}`:"orders";return this.#e("get",r)}getOrder(e){return this.#e("get",`orders/${e}`)}getTokens(){return this.#e("get","tokens")}linkAddress(e,t){return t=p(t),t.accounts=t.accounts.map(r=>p(r)),this.#e("post",`profiles/${e}/addresses`,JSON.stringify(t))}placeOrder(e){let t={kind:"redeem",...p(e),counterpart:{...e.counterpart,identifier:p(e.counterpart.identifier)}};return this.#e("post","orders",JSON.stringify(t))}uploadSupportingDocument(e){let t=new FormData;return t.append("file",e),A(`${this.#t.api}/files`,"post",t,{Authorization:this.#i||""})}async#e(e,t,r,i){return A(`${this.#t.api}/${t}`,e,i?u(r):r,{Authorization:this.#i||"","Content-Type":`application/${i?"x-www-form-urlencoded":"json"}`})}#a=async(e,t,r,i)=>{let s=localStorage.getItem(g)||"";if(!s)throw new Error("Code verifier not found");return this.codeVerifier=s,this.state=i,localStorage.removeItem(g),await this.#o({code:r,redirect_uri:t,client_id:e,code_verifier:s})};#d=async({clientId:e,clientSecret:t})=>await this.#o({client_id:e,client_secret:t});#c=async(e,t)=>await this.#o({refresh_token:t,client_id:e});async connectOrderSocket(){this.bearerProfile?.access_token&&this.#n.size>0&&(this.#s=this.subscribeToOrderNotifications());}subscribeToOrderNotifications=()=>{let e=`${this.#t.wss}/profiles/${this.bearerProfile?.profile}/orders?access_token=${this.bearerProfile?.access_token}`,t=new WebSocket(e);return t.addEventListener("open",()=>{console.info(`Socket connected: ${e}`);}),t.addEventListener("error",r=>{throw console.error(r),new Error(`Socket error: ${e}`)}),t.addEventListener("message",r=>{let i=JSON.parse(r.data);this.#n.get(i.meta.state)?.(i);}),t.addEventListener("close",()=>{console.info(`Socket connection closed: ${e}`);}),t};async disconnect(){a||localStorage.removeItem(g),this.#n.clear(),this.#s?.close(),this.#i=void 0,this.bearerProfile=void 0;}async revokeAccess(){a||localStorage.removeItem(m),this.disconnect();}subscribeOrders(e,t){this.#n.set(e,t);}unsubscribeOrders(e){this.#n.delete(e),this.#n.size===0&&(this.#s?.close(),this.#s=void 0);}getEnvironment=()=>this.#t;getAuthFlowURI=e=>{let t=x(this.#t.api,e);return this.codeVerifier=localStorage.getItem(g),t}};var le=f;
|
|
14
14
|
|
|
15
|
-
exports.AccountState =
|
|
16
|
-
exports.Currency =
|
|
17
|
-
exports.KYCOutcome =
|
|
18
|
-
exports.KYCState =
|
|
15
|
+
exports.AccountState = N;
|
|
16
|
+
exports.Currency = E;
|
|
17
|
+
exports.KYCOutcome = v;
|
|
18
|
+
exports.KYCState = T;
|
|
19
19
|
exports.Method = b;
|
|
20
20
|
exports.MoneriumClient = f;
|
|
21
21
|
exports.OrderKind = B;
|
|
22
|
-
exports.OrderState =
|
|
22
|
+
exports.OrderState = U;
|
|
23
23
|
exports.PaymentStandard = q;
|
|
24
|
-
exports.Permission =
|
|
25
|
-
exports.ProfileType =
|
|
26
|
-
exports.constants =
|
|
27
|
-
exports.default =
|
|
28
|
-
exports.getChain =
|
|
29
|
-
exports.
|
|
30
|
-
exports.placeOrderMessage = U;
|
|
24
|
+
exports.Permission = O;
|
|
25
|
+
exports.ProfileType = P;
|
|
26
|
+
exports.constants = c;
|
|
27
|
+
exports.default = le;
|
|
28
|
+
exports.getChain = R;
|
|
29
|
+
exports.placeOrderMessage = z;
|
|
31
30
|
exports.rfc3339 = C;
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import $ from 'crypto-js/enc-base64url.js';
|
|
2
|
+
import D from 'crypto-js/sha256.js';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var l={environments:{production:{api:"https://api.monerium.app",web:"https://monerium.app",wss:"wss://api.monerium.app"},sandbox:{api:"https://api.monerium.dev",web:"https://sandbox.monerium.dev",wss:"wss://api.monerium.dev"}}};var c={LINK_MESSAGE:"I hereby declare that I am the address owner.",STORAGE_CODE_VERIFIER:"monerium.sdk.code_verifier",STORAGE_REFRESH_TOKEN:"monerium.sdk.refresh_token"};var E=(i=>(i.eur="eur",i.usd="usd",i.gbp="gbp",i.isk="isk",i))(E||{}),b=(i=>(i.password="password",i.resource="resource",i.jwt="jwt",i.apiKey="apiKey",i))(b||{}),P=(t=>(t.corporate="corporate",t.personal="personal",t))(P||{}),O=(t=>(t.read="read",t.write="write",t))(O||{}),T=(i=>(i.absent="absent",i.submitted="submitted",i.pending="pending",i.confirmed="confirmed",i))(T||{}),v=(r=>(r.approved="approved",r.rejected="rejected",r.unknown="unknown",r))(v||{}),N=(r=>(r.requested="requested",r.approved="approved",r.pending="pending",r))(N||{}),q=(r=>(r.iban="iban",r.scan="scan",r.chain="chain",r))(q||{}),B=(t=>(t.redeem="redeem",t.issue="issue",t))(B||{}),U=(i=>(i.placed="placed",i.pending="pending",i.processed="processed",i.rejected="rejected",i))(U||{});var C=n=>{if(n.toString()==="Invalid Date")throw n;let e=r=>r<10?"0"+r:r,t=r=>{if(r===0)return "Z";let i=r>0?"-":"+";return r=Math.abs(r),i+e(Math.floor(r/60))+":"+e(r%60)};return n.getFullYear()+"-"+e(n.getMonth()+1)+"-"+e(n.getDate())+"T"+e(n.getHours())+":"+e(n.getMinutes())+":"+e(n.getSeconds())+t(n.getTimezoneOffset())},h=n=>typeof n=="number"?R(n):n,z=(n,e,t,r)=>{let i=`${e?.toUpperCase()||"EUR"}`;return r?`Send ${i} ${n} to ${t} on ${h(r)} at ${C(new Date)}`:`Send ${i} ${n} to ${t} at ${C(new Date)}`},u=n=>n&&Object.entries(n)?.length>0?Object.entries(n).map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join("&"):"",R=n=>{switch(n){case 1:case 11155111:return "ethereum";case 100:case 10200:return "gnosis";case 137:case 80002:return "polygon";default:throw new Error(`Chain not supported: ${n}`)}};var p=n=>{if(n?.chain){let{chain:e,...t}=n;return {...t,chain:h(e)}}return n};var M=(n,e)=>{let{client_id:t,redirect_uri:r,scope:i,state:s,address:o,signature:d,chain:k}=n,S=o?{address:o,...d!==void 0?{signature:d}:{},...k!==void 0?{chain:h(k)}:{}}:{};return u({client_id:t,redirect_uri:r,...i!==void 0?{scope:i}:{},...s!==void 0?{state:s}:{},code_challenge:e,code_challenge_method:"S256",response_type:"code",...S})},F=()=>{let n="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=e.length,r=0;for(;r<128;)n+=e.charAt(Math.floor(Math.random()*t)),r+=1;return n},L=n=>$.stringify(D(n)),x=(n,e)=>{let t=F(),r=L(t);return localStorage.setItem(c.STORAGE_CODE_VERIFIER,t||""),`${n}/auth?${M(e,r)}`},y=()=>{let n=window.location.href;if(!n||!n?.includes("?"))return;let[e,t]=n.split("?");t&&window.history.replaceState(null,"",e);},w=n=>n.code!=null,I=n=>n.refresh_token!=null,_=n=>n.client_secret!=null;var A=async(n,e,t,r)=>{let i=await fetch(`${n}`,{method:e,headers:r,body:t}),s,o=await i.text();try{s=JSON.parse(o);}catch{throw o}if(!i.ok)throw s;return s};var {STORAGE_CODE_VERIFIER:g,STORAGE_REFRESH_TOKEN:m}=c,a=typeof window>"u",f=class{#t;#i;codeVerifier;bearerProfile;#s;#n=new Map;isAuthorized=!!this.bearerProfile;#r;state;constructor(e){if(!e){this.#t=l.environments.sandbox;return}if(typeof e=="string")this.#t=l.environments[e];else if(this.#t=l.environments[e.environment||"sandbox"],a){let{clientId:t,clientSecret:r}=e;this.#r={clientId:t,clientSecret:r};}else {let{clientId:t,redirectUri:r}=e,{redirectUrl:i}=e;this.#r={clientId:t,redirectUri:r||i};}}async authorize(e){let t=e?.clientId||this.#r?.clientId,r=e?.redirectUri||e?.redirectUrl||this.#r?.redirectUri;if(!t)throw new Error("Missing ClientId");if(!r)throw new Error("Missing RedirectUri");let i=x(this.#t.api,{client_id:t,redirect_uri:r,address:e?.address,signature:e?.signature,chain:e?.chain,state:e?.state,scope:e?.scope});window.location.assign(i);}async getAccess(e){let t=e?.clientId||this.#r?.clientId;if(e?.clientSecret||this.#r?.clientSecret){if(!a)throw new Error("Only use client credentials on server side");return await this.#d(this.#r),!!this.bearerProfile}let i=e?.redirectUri||e?.redirectUrl||this.#r?.redirectUri;if(!t)throw new Error("Missing ClientId");if(a)throw new Error("This only works client side");let s=new URLSearchParams(window.location.search).get("code")||void 0,o=new URLSearchParams(window.location.search).get("state")||void 0,d=localStorage.getItem(m)||void 0;return d?await this.#c(t,d):s&&await this.#a(t,i,s,o),!!this.bearerProfile}async#o(e){let t;if(w(e))t={...e,grant_type:"authorization_code"};else if(I(e))t={...e,grant_type:"refresh_token"};else if(_(e))t={...e,grant_type:"client_credentials"};else throw new Error("Authorization grant type could not be detected.");return await this.#e("post","auth/token",t,!0).then(r=>{this.bearerProfile=r,this.isAuthorized=!!r,this.#i=`Bearer ${r?.access_token}`,a||window.localStorage.setItem(m,this.bearerProfile?.refresh_token||"");}).catch(r=>{throw a||(localStorage.removeItem(g),localStorage.removeItem(m),y()),new Error(r?.message)}),w(e)&&y(),this.bearerProfile}getAuthContext(){return this.#e("get","auth/context")}getProfile(e){return this.#e("get",`profiles/${e}`)}getProfiles(){return this.#e("get","profiles")}getBalances(e){return e?this.#e("get",`profiles/${e}/balances`):this.#e("get","balances")}getOrders(e){let t=u(e),r=t?`orders?${t}`:"orders";return this.#e("get",r)}getOrder(e){return this.#e("get",`orders/${e}`)}getTokens(){return this.#e("get","tokens")}linkAddress(e,t){return t=p(t),t.accounts=t.accounts.map(r=>p(r)),this.#e("post",`profiles/${e}/addresses`,JSON.stringify(t))}placeOrder(e){let t={kind:"redeem",...p(e),counterpart:{...e.counterpart,identifier:p(e.counterpart.identifier)}};return this.#e("post","orders",JSON.stringify(t))}uploadSupportingDocument(e){let t=new FormData;return t.append("file",e),A(`${this.#t.api}/files`,"post",t,{Authorization:this.#i||""})}async#e(e,t,r,i){return A(`${this.#t.api}/${t}`,e,i?u(r):r,{Authorization:this.#i||"","Content-Type":`application/${i?"x-www-form-urlencoded":"json"}`})}#a=async(e,t,r,i)=>{let s=localStorage.getItem(g)||"";if(!s)throw new Error("Code verifier not found");return this.codeVerifier=s,this.state=i,localStorage.removeItem(g),await this.#o({code:r,redirect_uri:t,client_id:e,code_verifier:s})};#d=async({clientId:e,clientSecret:t})=>await this.#o({client_id:e,client_secret:t});#c=async(e,t)=>await this.#o({refresh_token:t,client_id:e});async connectOrderSocket(){this.bearerProfile?.access_token&&this.#n.size>0&&(this.#s=this.subscribeToOrderNotifications());}subscribeToOrderNotifications=()=>{let e=`${this.#t.wss}/profiles/${this.bearerProfile?.profile}/orders?access_token=${this.bearerProfile?.access_token}`,t=new WebSocket(e);return t.addEventListener("open",()=>{console.info(`Socket connected: ${e}`);}),t.addEventListener("error",r=>{throw console.error(r),new Error(`Socket error: ${e}`)}),t.addEventListener("message",r=>{let i=JSON.parse(r.data);this.#n.get(i.meta.state)?.(i);}),t.addEventListener("close",()=>{console.info(`Socket connection closed: ${e}`);}),t};async disconnect(){a||localStorage.removeItem(g),this.#n.clear(),this.#s?.close(),this.#i=void 0,this.bearerProfile=void 0;}async revokeAccess(){a||localStorage.removeItem(m),this.disconnect();}subscribeOrders(e,t){this.#n.set(e,t);}unsubscribeOrders(e){this.#n.delete(e),this.#n.size===0&&(this.#s?.close(),this.#s=void 0);}getEnvironment=()=>this.#t;getAuthFlowURI=e=>{let t=x(this.#t.api,e);return this.codeVerifier=localStorage.getItem(g),t}};var le=f;
|
|
5
5
|
|
|
6
|
-
export {
|
|
6
|
+
export { N as AccountState, E as Currency, v as KYCOutcome, T as KYCState, b as Method, f as MoneriumClient, B as OrderKind, U as OrderState, q as PaymentStandard, O as Permission, P as ProfileType, c as constants, le as default, R as getChain, z as placeOrderMessage, C as rfc3339 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monerium/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.0",
|
|
4
4
|
"description": "Essential tools to interact with the Monerium API, an electronic money issuer.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,22 +33,20 @@
|
|
|
33
33
|
"jest-fetch-mock": "^3.0.3",
|
|
34
34
|
"jest-localstorage-mock": "^2.4.26",
|
|
35
35
|
"timezone-mock": "^1.3.6",
|
|
36
|
-
"typedoc": "^0.25.13",
|
|
37
|
-
"typedoc-plugin-markdown": "^4.0.3",
|
|
38
36
|
"typescript": "latest"
|
|
39
37
|
},
|
|
40
38
|
"engines": {
|
|
41
39
|
"node": ">= 16.15"
|
|
42
40
|
},
|
|
43
41
|
"scripts": {
|
|
44
|
-
"dev": "tsup --watch --onSuccess 'pnpm
|
|
42
|
+
"dev": "tsup --watch --onSuccess 'pnpm run docs'",
|
|
45
43
|
"build": "tsup",
|
|
46
44
|
"docs": "typedoc",
|
|
47
45
|
"docs:watch": "typedoc --watch",
|
|
48
46
|
"type-map": "tsc --emitDeclarationOnly --declaration",
|
|
49
47
|
"lint": "eslint . --fix",
|
|
50
48
|
"pub:pre": "pnpm publish --no-git-checks --dry-run",
|
|
51
|
-
"test": "jest",
|
|
52
|
-
"test:watch": "jest --watch"
|
|
49
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
|
|
50
|
+
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
|
|
53
51
|
}
|
|
54
52
|
}
|