@monerium/sdk 2.2.3 → 2.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.3.0](https://github.com/monerium/sdk/compare/v2.2.3...v2.3.0) (2023-04-30)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * '@monerium/sdk' now exports Network and Chain as types, previously enums </br> Enums are now exported under 'constants' </br> import { constants } from '@monerium/sdk'; </br> const { Network } = constants; </br></br> new Network type takes two optional params for Chain and Environmant</br> import { Network } from '@monerium/sdk'</br></br> // is valid </br> const network: Network<'gnosis','production> = 'mainnet';</br> const network: Network<'gnosis','sandbox> = 'chiado';</br> const network: Network<'gnosis',> = 'chiado';</br> const network: Network = 'chiado';</br></br> // is invalid </br> const network: Network<'gnosis','sandbox> = 'mainnet';</br> const network: Network<'gnosis'> = 'goerli';</br>
9
+
10
+ ### Features
11
+
12
+ * expose helper to create place order message ([#85](https://github.com/monerium/sdk/issues/85)) ([b124370](https://github.com/monerium/sdk/commit/b1243702c534a6d40e0ce657ff8db9a6f55546a5))
13
+ * network types with optional chain and env type params ([#82](https://github.com/monerium/sdk/issues/82)) ([154d626](https://github.com/monerium/sdk/commit/154d626798150640ac2ed331b98029a18984555c))
14
+ * refactor, improve and test fetch ([#86](https://github.com/monerium/sdk/issues/86)) ([26a8ceb](https://github.com/monerium/sdk/commit/26a8ceb78ec38553709afa2add0108ee3e10e125))
15
+
16
+
17
+ ### Miscellaneous
18
+
19
+ * release 2.3.0 ([bff6ece](https://github.com/monerium/sdk/commit/bff6ece14c0b7b7a362b21df0b024b0a6a8f6678))
20
+
3
21
  ## [2.2.3](https://github.com/monerium/sdk/compare/v2.2.2...v2.2.3) (2023-04-28)
4
22
 
5
23
 
package/dist/index.d.ts CHANGED
@@ -10,14 +10,15 @@ export type Config = {
10
10
  sandbox: Environment;
11
11
  };
12
12
  };
13
- export interface BearerProfile {
14
- access_token: string;
15
- token_type: string;
16
- expires_in: number;
17
- refresh_token: string;
18
- profile: string;
19
- userId: string;
20
- }
13
+ export type ENV = "sandbox" | "production";
14
+ export type EthereumTestnet = "goerli";
15
+ export type GnosisTestnet = "chiado";
16
+ export type PolygonTestnet = "mumbai";
17
+ export type Chain = "ethereum" | "gnosis" | "polygon";
18
+ export type Networks = EthereumTestnet | GnosisTestnet | PolygonTestnet | "mainnet";
19
+ export type NetworkSemiStrict<C extends Chain> = C extends "ethereum" ? EthereumTestnet | "mainnet" : C extends "gnosis" ? GnosisTestnet | "mainnet" : C extends "polygon" ? PolygonTestnet | "mainnet" : never;
20
+ export 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;
21
+ export type Network<C extends Chain = Chain, E extends ENV = ENV> = C extends Chain ? E extends ENV ? NetworkStrict<C, E> & NetworkSemiStrict<C> : never : never;
21
22
  export declare enum Currency {
22
23
  eur = "eur",
23
24
  usd = "usd",
@@ -33,6 +34,14 @@ export interface AuthCode {
33
34
  redirect_uri: string;
34
35
  scope?: string;
35
36
  }
37
+ export interface BearerProfile {
38
+ access_token: string;
39
+ token_type: string;
40
+ expires_in: number;
41
+ refresh_token: string;
42
+ profile: string;
43
+ userId: string;
44
+ }
36
45
  export interface RefreshToken {
37
46
  grant_type: "refresh_token";
38
47
  client_id: string;
@@ -142,17 +151,6 @@ export interface Profile {
142
151
  kyc: KYC;
143
152
  accounts: Account[];
144
153
  }
145
- export declare enum Chain {
146
- polygon = "polygon",
147
- ethereum = "ethereum",
148
- gnosis = "gnosis"
149
- }
150
- export declare enum Network {
151
- mainnet = "mainnet",
152
- chiado = "chiado",
153
- goerli = "goerli",
154
- mumbai = "mumbai"
155
- }
156
154
  export interface Balance {
157
155
  currency: Currency;
158
156
  amount: string;
@@ -314,9 +312,19 @@ export declare class MoneriumClient {
314
312
  getOrders(filter?: OrderFilter): Promise<Order[]>;
315
313
  getOrder(orderId: string): Promise<Order>;
316
314
  getTokens(): Promise<Token[]>;
317
- linkAddress(profileId: string, body: LinkAddress): Promise<any>;
315
+ linkAddress(profileId: string, body: LinkAddress): Promise<unknown>;
318
316
  placeOrder(order: NewOrder, profileId?: string): Promise<Order>;
319
317
  uploadSupportingDocument(document: File): Promise<SupportingDoc>;
320
318
  }
319
+ /**
320
+ * The message to be signed when placing an order.
321
+ *
322
+ * @returns string
323
+ */
324
+ export declare const placeOrderMessage: ({ currency, amount, iban, }: {
325
+ currency: Currency | Uppercase<Currency> | string;
326
+ amount: string | number;
327
+ iban: string;
328
+ }) => string;
321
329
 
322
330
  export {};