@monerium/sdk 2.14.0 → 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 CHANGED
@@ -137,7 +137,7 @@ export function App() {
137
137
  const sdk = new MoneriumClient({
138
138
  environment: 'sandbox',
139
139
  clientId: 'f99e629b-6dca-11ee-8aa6-5273f65ed05b',
140
- redirectUrl: 'http://localhost:4200',
140
+ redirectUri: 'http://localhost:4200',
141
141
  });
142
142
  setMonerium(sdk);
143
143
  }, []);
package/dist/index.d.ts CHANGED
@@ -92,11 +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' or 'chain' */
96
- network?: Network;
97
- chain?: Chain;
98
95
  /** The network of the wallet to automatically link */
99
- chainId?: ChainId;
96
+ chain?: Chain | ChainId;
100
97
  };
101
98
  declare enum Method {
102
99
  password = "password",
@@ -210,11 +207,10 @@ interface IBAN extends Identifier {
210
207
  }
211
208
  interface CrossChain extends Identifier {
212
209
  standard: PaymentStandard.chain;
210
+ /** The receivers address */
213
211
  address: string;
214
- chainId?: ChainId;
215
- chain?: Chain;
216
- /** @deprecated - Use 'chainId' or 'chain' */
217
- network?: Network;
212
+ /** The receivers network */
213
+ chain: Chain | ChainId;
218
214
  }
219
215
  interface SCAN extends Identifier {
220
216
  standard: PaymentStandard.scan;
@@ -294,10 +290,8 @@ interface NewOrderCommon {
294
290
  }
295
291
  interface NewOrderByAddress extends NewOrderCommon {
296
292
  address: string;
297
- chain?: Chain;
298
- /** @deprecated - Use 'chainId' or 'chain' */
299
- network?: Network;
300
- chainId?: ChainId;
293
+ /** The senders network */
294
+ chain: Chain | ChainId;
301
295
  }
302
296
  interface NewOrderByAccountId extends NewOrderCommon {
303
297
  accountId: string;
@@ -316,10 +310,8 @@ interface SupportingDoc {
316
310
  meta: SupportingDocMetadata;
317
311
  }
318
312
  interface CurrencyAccounts {
319
- /** @deprecated - Use 'chainId' or 'chain' */
320
- network?: Network;
321
- chain?: Chain;
322
- chainId?: ChainId;
313
+ /** The accounts network */
314
+ chain: Chain | ChainId;
323
315
  currency: Currency;
324
316
  }
325
317
  interface LinkAddress {
@@ -327,10 +319,7 @@ interface LinkAddress {
327
319
  message: string;
328
320
  signature: string;
329
321
  accounts: CurrencyAccounts[];
330
- /** @deprecated - Use 'chainId' or 'chain' */
331
- network?: Network;
332
- chain?: Chain;
333
- chainId?: ChainId;
322
+ chain?: Chain | ChainId;
334
323
  }
335
324
  interface LinkedAddress {
336
325
  id: string;
@@ -365,10 +354,12 @@ type ClassOptions = {
365
354
  } & BearerTokenCredentials;
366
355
  interface AuthFlowOptions {
367
356
  clientId?: string;
357
+ redirectUri?: string;
358
+ /** @deprecated use redirectUri */
368
359
  redirectUrl?: string;
369
360
  address?: string;
370
361
  signature?: string;
371
- chainId?: ChainId;
362
+ chain?: Chain | ChainId;
372
363
  state?: string;
373
364
  scope?: string;
374
365
  }
@@ -378,9 +369,15 @@ interface ClientCredentials {
378
369
  }
379
370
  interface AuthorizationCodeCredentials {
380
371
  clientId: string;
381
- redirectUrl: string;
372
+ redirectUri: string;
373
+ }
374
+ /** @deprecated use redirectUri */
375
+ interface DeprecatedAuthorizationCodeCredentials {
376
+ clientId?: string;
377
+ /** @deprecated use redirectUri */
378
+ redirectUrl?: string;
382
379
  }
383
- type BearerTokenCredentials = ClientCredentials | AuthorizationCodeCredentials;
380
+ type BearerTokenCredentials = ClientCredentials | AuthorizationCodeCredentials | DeprecatedAuthorizationCodeCredentials;
384
381
 
385
382
  declare class MoneriumClient {
386
383
  #private;
@@ -409,14 +406,14 @@ declare class MoneriumClient {
409
406
  * new MoneriumClient({
410
407
  * environment: 'sandbox',
411
408
  * clientId: 'your-client-id',
412
- * redirectUrl: 'your-redirect-url'
409
+ * redirectUri: 'your-redirect-url'
413
410
  * })
414
411
  * */
415
412
  constructor(envOrOptions?: ENV | ClassOptions);
416
413
  /**
417
414
  * Construct the url to the authorization code flow and redirects,
418
415
  * Code Verifier needed for the code challenge is stored in local storage
419
- * For automatic wallet link, add the following properties: `address`, `signature` & `chainId`
416
+ * For automatic wallet link, add the following properties: `address`, `signature` & `chain`
420
417
  * @returns string
421
418
  * {@link https://monerium.dev/api-docs#operation/auth}
422
419
  * @category Auth
@@ -428,7 +425,7 @@ declare class MoneriumClient {
428
425
  * @returns boolean to indicate if access has been granted
429
426
  * @category Auth
430
427
  */
431
- getAccess(client?: AuthorizationCodeCredentials | ClientCredentials): Promise<boolean>;
428
+ getAccess(client?: AuthorizationCodeCredentials | ClientCredentials | DeprecatedAuthorizationCodeCredentials): Promise<boolean>;
432
429
  /**
433
430
  * {@link https://monerium.dev/api-docs#operation/auth-context}
434
431
  * @category Auth
@@ -557,4 +554,4 @@ declare const placeOrderMessage: (amount: string | number, currency: Currency, r
557
554
  */
558
555
  declare const getChain: (chainId: number) => Chain;
559
556
 
560
- 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, 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 };
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,29 +2,29 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var M = require('crypto-js/enc-base64url.js');
6
- var z = require('crypto-js/sha256.js');
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 M__default = /*#__PURE__*/_interopDefault(M);
11
- var z__default = /*#__PURE__*/_interopDefault(z);
10
+ var $__default = /*#__PURE__*/_interopDefault($);
11
+ var D__default = /*#__PURE__*/_interopDefault(D);
12
12
 
13
- var h={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 I=(i=>(i.eur="eur",i.usd="usd",i.gbp="gbp",i.isk="isk",i))(I||{}),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||{}),N=(r=>(r.approved="approved",r.rejected="rejected",r.unknown="unknown",r))(N||{}),v=(r=>(r.requested="requested",r.approved="approved",r.pending="pending",r))(v||{}),q=(r=>(r.iban="iban",r.scan="scan",r.chain="chain",r))(q||{}),B=(t=>(t.redeem="redeem",t.issue="issue",t))(B||{}),$=(i=>(i.placed="placed",i.pending="pending",i.processed="processed",i.rejected="rejected",i))($||{});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())},U=(n,e,t,r)=>{let i=`${e?.toUpperCase()||"EUR"}`,s=r;return typeof r=="number"&&(s=g(r)),s?`Send ${i} ${n} to ${t} on ${s} 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("&"):"",g=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?.chainId){let{chainId:e,...t}=n;return {...t,chain:g(e)}}return n};var F=(n,e)=>{let{client_id:t,redirect_uri:r,scope:i,state:s,chainId:o,address:d,signature:k,chain:E}=n,S=d?{address:d,...k!==void 0?{signature:k}:{},...o!==void 0||E!==void 0?{chain:o?g(o):E}:{}}:{};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})},D=()=>{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=>M__default.default.stringify(z__default.default(n)),x=(n,e)=>{let t=D(),r=L(t);return localStorage.setItem(c.STORAGE_CODE_VERIFIER,t||""),`${n}/auth?${F(e,r)}`},w=()=>{let n=window.location.href;if(!n||!n?.includes("?"))return;let[e,t]=n.split("?");t&&window.history.replaceState(null,"",e);},y=n=>n.code!=null,R=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:l,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=h.environments.sandbox;return}if(typeof e=="string")this.#t=h.environments[e];else if(this.#t=h.environments[e.environment||"sandbox"],a){let{clientId:t,clientSecret:r}=e;this.#r={clientId:t,clientSecret:r};}else {let{clientId:t,redirectUrl:r}=e;this.#r={clientId:t,redirectUrl:r};}}async authorize(e){let t=e?.clientId||this.#r?.clientId,r=e?.redirectUrl||this.#r?.redirectUrl;if(!t)throw new Error("Missing ClientId");if(!r)throw new Error("Missing RedirectUrl");let i=x(this.#t.api,{client_id:t,redirect_uri:r,address:e?.address,signature:e?.signature,chainId:e?.chainId,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?.redirectUrl||this.#r?.redirectUrl;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(y(e))t={...e,grant_type:"authorization_code"};else if(R(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(l),localStorage.removeItem(m),w()),new Error(r?.message)}),y(e)&&w(),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(l)||"";if(!s)throw new Error("Code verifier not found");return this.codeVerifier=s,this.state=i,localStorage.removeItem(l),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(l),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(l),t}};var he=f;
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 = v;
16
- exports.Currency = I;
17
- exports.KYCOutcome = N;
15
+ exports.AccountState = N;
16
+ exports.Currency = E;
17
+ exports.KYCOutcome = v;
18
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
24
  exports.Permission = O;
25
25
  exports.ProfileType = P;
26
26
  exports.constants = c;
27
- exports.default = he;
28
- exports.getChain = g;
29
- exports.placeOrderMessage = U;
27
+ exports.default = le;
28
+ exports.getChain = R;
29
+ exports.placeOrderMessage = z;
30
30
  exports.rfc3339 = C;
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import M from 'crypto-js/enc-base64url.js';
2
- import z from 'crypto-js/sha256.js';
1
+ import $ from 'crypto-js/enc-base64url.js';
2
+ import D from 'crypto-js/sha256.js';
3
3
 
4
- var h={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 I=(i=>(i.eur="eur",i.usd="usd",i.gbp="gbp",i.isk="isk",i))(I||{}),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||{}),N=(r=>(r.approved="approved",r.rejected="rejected",r.unknown="unknown",r))(N||{}),v=(r=>(r.requested="requested",r.approved="approved",r.pending="pending",r))(v||{}),q=(r=>(r.iban="iban",r.scan="scan",r.chain="chain",r))(q||{}),B=(t=>(t.redeem="redeem",t.issue="issue",t))(B||{}),$=(i=>(i.placed="placed",i.pending="pending",i.processed="processed",i.rejected="rejected",i))($||{});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())},U=(n,e,t,r)=>{let i=`${e?.toUpperCase()||"EUR"}`,s=r;return typeof r=="number"&&(s=g(r)),s?`Send ${i} ${n} to ${t} on ${s} 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("&"):"",g=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?.chainId){let{chainId:e,...t}=n;return {...t,chain:g(e)}}return n};var F=(n,e)=>{let{client_id:t,redirect_uri:r,scope:i,state:s,chainId:o,address:d,signature:k,chain:E}=n,S=d?{address:d,...k!==void 0?{signature:k}:{},...o!==void 0||E!==void 0?{chain:o?g(o):E}:{}}:{};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})},D=()=>{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=>M.stringify(z(n)),x=(n,e)=>{let t=D(),r=L(t);return localStorage.setItem(c.STORAGE_CODE_VERIFIER,t||""),`${n}/auth?${F(e,r)}`},w=()=>{let n=window.location.href;if(!n||!n?.includes("?"))return;let[e,t]=n.split("?");t&&window.history.replaceState(null,"",e);},y=n=>n.code!=null,R=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:l,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=h.environments.sandbox;return}if(typeof e=="string")this.#t=h.environments[e];else if(this.#t=h.environments[e.environment||"sandbox"],a){let{clientId:t,clientSecret:r}=e;this.#r={clientId:t,clientSecret:r};}else {let{clientId:t,redirectUrl:r}=e;this.#r={clientId:t,redirectUrl:r};}}async authorize(e){let t=e?.clientId||this.#r?.clientId,r=e?.redirectUrl||this.#r?.redirectUrl;if(!t)throw new Error("Missing ClientId");if(!r)throw new Error("Missing RedirectUrl");let i=x(this.#t.api,{client_id:t,redirect_uri:r,address:e?.address,signature:e?.signature,chainId:e?.chainId,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?.redirectUrl||this.#r?.redirectUrl;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(y(e))t={...e,grant_type:"authorization_code"};else if(R(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(l),localStorage.removeItem(m),w()),new Error(r?.message)}),y(e)&&w(),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(l)||"";if(!s)throw new Error("Code verifier not found");return this.codeVerifier=s,this.state=i,localStorage.removeItem(l),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(l),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(l),t}};var he=f;
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 { v as AccountState, I as Currency, N as KYCOutcome, T as KYCState, b as Method, f as MoneriumClient, B as OrderKind, $ as OrderState, q as PaymentStandard, O as Permission, P as ProfileType, c as constants, he as default, g as getChain, U as placeOrderMessage, C as rfc3339 };
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.14.0",
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",
@@ -39,14 +39,14 @@
39
39
  "node": ">= 16.15"
40
40
  },
41
41
  "scripts": {
42
- "dev": "tsup --watch --onSuccess 'pnpm type-map && pnpm run docs'",
42
+ "dev": "tsup --watch --onSuccess 'pnpm run docs'",
43
43
  "build": "tsup",
44
44
  "docs": "typedoc",
45
45
  "docs:watch": "typedoc --watch",
46
46
  "type-map": "tsc --emitDeclarationOnly --declaration",
47
47
  "lint": "eslint . --fix",
48
48
  "pub:pre": "pnpm publish --no-git-checks --dry-run",
49
- "test": "jest",
50
- "test:watch": "jest --watch"
49
+ "test": "NODE_OPTIONS=--experimental-vm-modules jest",
50
+ "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
51
51
  }
52
52
  }