@monerium/sdk 3.4.1 → 3.4.2

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
@@ -156,7 +156,9 @@ declare enum KYCOutcome {
156
156
  declare enum AccountState {
157
157
  requested = "requested",
158
158
  approved = "approved",
159
- pending = "pending"
159
+ pending = "pending",
160
+ rejected = "rejected",
161
+ closed = "closed"
160
162
  }
161
163
  interface KYC {
162
164
  state: KYCState;
@@ -165,7 +167,8 @@ interface KYC {
165
167
  declare enum PaymentStandard {
166
168
  iban = "iban",
167
169
  scan = "scan",
168
- chain = "chain"
170
+ chain = "chain",
171
+ account = "account"
169
172
  }
170
173
  /**
171
174
  * The type of ID document. Passports, National ID cards, and driving licenses are supported.
@@ -312,33 +315,51 @@ interface CrossChainIdentifier extends Identifier {
312
315
  /** The receivers network */
313
316
  chain: Chain | ChainId;
314
317
  }
318
+ interface BankAccountIdentifier extends Identifier {
319
+ /** The standard of the bank account. This is used to identify generic bank account. */
320
+ standard: PaymentStandard.account;
321
+ /** The account number of the bank account. */
322
+ accountNumber: number;
323
+ /** The address of the bank account holder. */
324
+ address: string;
325
+ }
315
326
  interface SCANIdentifier extends Identifier {
316
327
  standard: PaymentStandard.scan;
317
328
  sortCode: string;
318
329
  accountNumber: string;
319
330
  }
320
- interface Individual {
321
- firstName: string;
322
- lastName: string;
323
- country?: string;
331
+ interface Individual extends CounterpartDetails {
332
+ firstName?: string;
333
+ lastName?: string;
334
+ address?: string;
324
335
  }
325
- interface Corporation {
336
+ interface Corporation extends CounterpartDetails {
326
337
  companyName: string;
327
- country: string;
338
+ }
339
+ interface Issuer {
340
+ /** The sender name. This can be a corporate or an individual. */
341
+ name: string;
328
342
  }
329
343
  interface Counterpart {
330
- identifier: IBANIdentifier | SCANIdentifier | CrossChainIdentifier;
331
- details: Individual | Corporation;
344
+ identifier: IBANIdentifier | SCANIdentifier | CrossChainIdentifier | BankAccountIdentifier;
345
+ details: Individual | Corporation | Issuer;
346
+ }
347
+ interface CounterpartDetails {
348
+ name?: string;
349
+ bank?: CounterpartBank;
350
+ country?: string;
351
+ }
352
+ interface CounterpartBank {
353
+ name?: string;
354
+ address?: string;
355
+ bic?: string;
332
356
  }
333
357
  interface OrderMetadata {
334
- approvedAt: string;
335
- processedAt: string;
336
- rejectedAt: string;
337
- state: OrderState;
338
- placedBy: string;
339
358
  placedAt: string;
340
- receivedAmount: string;
341
- sentAmount: string;
359
+ processedAt?: string;
360
+ rejectedReason?: string;
361
+ txHashes?: string[];
362
+ supportingDocumentId?: string;
342
363
  }
343
364
  interface OrderFilter {
344
365
  address?: string;
@@ -351,19 +372,15 @@ interface OrderFilter {
351
372
  interface Order {
352
373
  id: string;
353
374
  profile: string;
354
- accountId: string;
355
375
  address: string;
356
376
  kind: OrderKind;
357
377
  chain: Chain;
358
378
  amount: string;
359
379
  currency: Currency;
360
- totalFee: string;
361
- fees: Fee[];
362
380
  counterpart: Counterpart;
363
381
  memo: string;
364
- rejectedReason: string;
365
- supportingDocumentId: string;
366
382
  meta: OrderMetadata;
383
+ state: OrderState;
367
384
  }
368
385
  interface OrdersResponse {
369
386
  orders: Order[];
@@ -458,6 +475,8 @@ interface IBAN {
458
475
  profile: string;
459
476
  address: string;
460
477
  chain: Chain;
478
+ state: AccountState;
479
+ emailNotifications: boolean;
461
480
  }
462
481
  interface IBANsResponse {
463
482
  ibans: IBAN[];
@@ -888,4 +907,4 @@ declare const shortenAddress: (address?: string) => string | undefined;
888
907
  * ```
889
908
  */
890
909
 
891
- export { AccountState, type Address, type AddressesQueryParams, type AddressesResponse, type AuthArgs, type AuthCodePayload, type AuthContext, type AuthFlowOptions, type AuthFlowOptionsShared, type AuthFlowSIWEOptions, type AuthorizationCodeCredentials, type Balances, type BearerProfile, type BearerTokenCredentials, type Beneficiary, type Chain, type ChainId, type ClassOptions, type ClientCredentials, type ClientCredentialsPayload, type Config, type CorporateProfileDetails, type CorporateProfileDetailsRequest, type Corporation, type CosmosChainId, type Counterpart, 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 KYC, KYCOutcome, KYCState, type LinkAddress, type LinkedAddress, Method, MoneriumClient, 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, PaymentStandard, Permission, type PersonalProfileDetails, type PersonalProfileDetailsRequest, type ProductionChain, type Profile, type ProfilePermissions, ProfileState, ProfileType, type ProfilesQueryParams, type ProfilesResponse, type RefreshTokenPayload, type Representative, type RequestIbanPayload, type ResponseStatus, type SCANIdentifier, type SandboxChain, type SubmitProfileDetailsPayload, type SupportingDoc, type SupportingDocMetadata, type Ticker, type Token, type TokenSymbol, _default as constants, MoneriumClient as default, getChain, parseChain, placeOrderMessage, rfc3339, shortenAddress, shortenIban, siweMessage };
910
+ export { AccountState, type Address, type AddressesQueryParams, type AddressesResponse, type AuthArgs, type AuthCodePayload, type AuthContext, type AuthFlowOptions, type AuthFlowOptionsShared, type AuthFlowSIWEOptions, type AuthorizationCodeCredentials, type Balances, type BankAccountIdentifier, type BearerProfile, type BearerTokenCredentials, type Beneficiary, type Chain, type ChainId, type ClassOptions, type ClientCredentials, 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, MoneriumClient, 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, PaymentStandard, Permission, type PersonalProfileDetails, type PersonalProfileDetailsRequest, type ProductionChain, type Profile, type ProfilePermissions, ProfileState, ProfileType, type ProfilesQueryParams, type ProfilesResponse, type RefreshTokenPayload, type Representative, type RequestIbanPayload, type ResponseStatus, type SCANIdentifier, type SandboxChain, type SubmitProfileDetailsPayload, type SupportingDoc, type SupportingDocMetadata, type Ticker, type Token, type TokenSymbol, _default as constants, MoneriumClient as default, getChain, parseChain, placeOrderMessage, rfc3339, shortenAddress, shortenIban, siweMessage };
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var U=require('crypto-js/enc-base64url.js'),z=require('crypto-js/sha256.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var U__default=/*#__PURE__*/_interopDefault(U);var z__default=/*#__PURE__*/_interopDefault(z);var y={environments:{production:{name:"production",api:"https://api.monerium.app",web:"https://monerium.app",wss:"wss://api.monerium.app"},sandbox:{name:"sandbox",api:"https://api.monerium.dev",web:"https://sandbox.monerium.dev",wss:"wss://api.monerium.dev"}}};var h={LINK_MESSAGE:"I hereby declare that I am the address owner.",STORAGE_CODE_VERIFIER:"monerium.sdk.code_verifier",STORAGE_ACCESS_TOKEN:"monerium.sdk.access_token",STORAGE_ACCESS_EXPIRY:"monerium.sdk.access_expiry"};var I=()=>{let r="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=e.length,t=0;for(;t<128;)r+=e.charAt(Math.floor(Math.random()*n)),t+=1;return r},q=r=>U__default.default.stringify(z__default.default(r)),A=()=>{let r=I(),e=q(r);return localStorage.setItem(h.STORAGE_CODE_VERIFIER,r||""),e},S=()=>{let r=window.location.href;if(!r||!r?.includes("?"))return;let[e,n]=r.split("?");n&&window.history.replaceState(null,"",e);},k=r=>r.code!=null,v=r=>r.refresh_token!=null,$=r=>r.client_secret!=null;var R=async(r,e,n,t)=>{let s=await fetch(`${r}`,{method:e,headers:t,body:n}),i,a=await s.text();try{if(i=JSON.parse(a),Object.keys(i).length===0&&i.constructor===Object)switch(s.status){case 201:case 202:return {status:s.status,statusText:s.statusText}}}catch{throw a}if(!s.ok)throw i;return i};var m=r=>{if(!r)return "";let e=Object.entries(r).filter(([n,t])=>t!==""&&t!==undefined&&t!==null).map(([n,t])=>`${encodeURIComponent(n)}=${encodeURIComponent(t)}`).join("&");return e?"?"+e:""};var N=r=>r?e=>{console.log("%c [MONERIUM:DEBUG]:","color:orange;",e);}:()=>{};var _=r=>Object.entries(r).filter(([n,t])=>t!=null).map(([n,t])=>`${n}-${t}`).join("-");var B=(s=>(s.eur="eur",s.usd="usd",s.gbp="gbp",s.isk="isk",s))(B||{}),j=(i=>(i.password="password",i.resource="resource",i.jwt="jwt",i.apiKey="apiKey",i.bearer="bearer",i))(j||{}),F=(n=>(n.corporate="corporate",n.personal="personal",n))(F||{}),M=(n=>(n.read="read",n.write="write",n))(M||{}),K=(i=>(i.created="created",i.pending="pending",i.approved="approved",i.rejected="rejected",i.blocked="blocked",i))(K||{}),W=(s=>(s.absent="absent",s.submitted="submitted",s.pending="pending",s.confirmed="confirmed",s))(W||{}),L=(t=>(t.approved="approved",t.rejected="rejected",t.unknown="unknown",t))(L||{}),Q=(t=>(t.requested="requested",t.approved="approved",t.pending="pending",t))(Q||{}),V=(t=>(t.iban="iban",t.scan="scan",t.chain="chain",t))(V||{}),G=(t=>(t.passport="passport",t.nationalIdentityCard="nationalIdentityCard",t.drivingLicense="drivingLicense",t))(G||{}),J=(n=>(n.redeem="redeem",n.issue="issue",n))(J||{}),H=(s=>(s.placed="placed",s.pending="pending",s.processed="processed",s.rejected="rejected",s))(H||{});var x=r=>{if(r.toString()==="Invalid Date")throw r;let e=t=>t<10?"0"+t:t,n=t=>{if(t===0)return "Z";let s=t>0?"-":"+";return t=Math.abs(t),s+e(Math.floor(t/60))+":"+e(t%60)};return r.getFullYear()+"-"+e(r.getMonth()+1)+"-"+e(r.getDate())+"T"+e(r.getHours())+":"+e(r.getMinutes())+":"+e(r.getSeconds())+n(r.getTimezoneOffset())},X=r=>{switch(r){case "noble":case "noble-1":case "grand":case "grand-1":return true;default:return false}},Z=r=>{switch(r){case "ethereum":case "sepolia":case "polygon":case "amoy":case "gnosis":case "chiado":case "arbitrum":case "arbitrumsepolia":case "linea":case "lineasepolia":case "scroll":case "scrollsepolia":case "camino":case "columbus":return true;default:return false}},P=r=>{if(typeof r=="number")return E(r);if(X(r))return r.split("-")[0];if(Z(r))return r;try{return E(parseInt(r))}catch{throw new Error(`Chain not supported: ${r}`)}},u=(r,e)=>P(D(e,r)),Y=(r,e,n,t)=>{let s=`${e?.toUpperCase()||"EUR"}`;return t?`Send ${s} ${r} to ${n} on ${P(t)} at ${x(new Date)}`:s==="EUR"?`Send ${s} ${r} to ${T(n)} at ${x(new Date)}`:`Send ${s} ${r} to ${n} at ${x(new Date)}`},ee=({domain:r,address:e,appName:n,redirectUri:t,chainId:s,issuedAt:i=new Date().toISOString(),expiryAt:a=new Date(Date.now()+1e3*60*5).toISOString(),privacyPolicyUrl:o,termsOfServiceUrl:c})=>`${r} wants you to sign in with your Ethereum account:
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var z=require('crypto-js/enc-base64url.js'),q=require('crypto-js/sha256.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var z__default=/*#__PURE__*/_interopDefault(z);var q__default=/*#__PURE__*/_interopDefault(q);var x={environments:{production:{name:"production",api:"https://api.monerium.app",web:"https://monerium.app",wss:"wss://api.monerium.app"},sandbox:{name:"sandbox",api:"https://api.monerium.dev",web:"https://sandbox.monerium.dev",wss:"wss://api.monerium.dev"}}};var h={LINK_MESSAGE:"I hereby declare that I am the address owner.",STORAGE_CODE_VERIFIER:"monerium.sdk.code_verifier",STORAGE_ACCESS_TOKEN:"monerium.sdk.access_token",STORAGE_ACCESS_EXPIRY:"monerium.sdk.access_expiry"};var A=()=>{let t="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=e.length,n=0;for(;n<128;)t+=e.charAt(Math.floor(Math.random()*r)),n+=1;return t},j=t=>z__default.default.stringify(q__default.default(t)),S=()=>{let t=A(),e=j(t);return localStorage.setItem(h.STORAGE_CODE_VERIFIER,t||""),e},k=()=>{let t=window.location.href;if(!t||!t?.includes("?"))return;let[e,r]=t.split("?");r&&window.history.replaceState(null,"",e);},R=t=>t.code!=null,v=t=>t.refresh_token!=null,$=t=>t.client_secret!=null;var _=async(t,e,r,n)=>{let s=await fetch(`${t}`,{method:e,headers:n,body:r}),i,a=await s.text();try{if(i=JSON.parse(a),Object.keys(i).length===0&&i.constructor===Object)switch(s.status){case 201:case 202:return {status:s.status,statusText:s.statusText}}}catch{throw a}if(!s.ok)throw i;return i};var m=t=>{if(!t)return "";let e=Object.entries(t).filter(([r,n])=>n!==""&&n!==undefined&&n!==null).map(([r,n])=>`${encodeURIComponent(r)}=${encodeURIComponent(n)}`).join("&");return e?"?"+e:""};var N=t=>t?e=>{console.log("%c [MONERIUM:DEBUG]:","color:orange;",e);}:()=>{};var E=t=>Object.entries(t).filter(([r,n])=>n!=null).map(([r,n])=>`${r}-${n}`).join("-");var B=(s=>(s.eur="eur",s.usd="usd",s.gbp="gbp",s.isk="isk",s))(B||{}),M=(i=>(i.password="password",i.resource="resource",i.jwt="jwt",i.apiKey="apiKey",i.bearer="bearer",i))(M||{}),F=(r=>(r.corporate="corporate",r.personal="personal",r))(F||{}),K=(r=>(r.read="read",r.write="write",r))(K||{}),L=(i=>(i.created="created",i.pending="pending",i.approved="approved",i.rejected="rejected",i.blocked="blocked",i))(L||{}),W=(s=>(s.absent="absent",s.submitted="submitted",s.pending="pending",s.confirmed="confirmed",s))(W||{}),Q=(n=>(n.approved="approved",n.rejected="rejected",n.unknown="unknown",n))(Q||{}),V=(i=>(i.requested="requested",i.approved="approved",i.pending="pending",i.rejected="rejected",i.closed="closed",i))(V||{}),G=(s=>(s.iban="iban",s.scan="scan",s.chain="chain",s.account="account",s))(G||{}),J=(n=>(n.passport="passport",n.nationalIdentityCard="nationalIdentityCard",n.drivingLicense="drivingLicense",n))(J||{}),H=(r=>(r.redeem="redeem",r.issue="issue",r))(H||{}),X=(s=>(s.placed="placed",s.pending="pending",s.processed="processed",s.rejected="rejected",s))(X||{});var b=t=>{if(t.toString()==="Invalid Date")throw t;let e=n=>n<10?"0"+n:n,r=n=>{if(n===0)return "Z";let s=n>0?"-":"+";return n=Math.abs(n),s+e(Math.floor(n/60))+":"+e(n%60)};return t.getFullYear()+"-"+e(t.getMonth()+1)+"-"+e(t.getDate())+"T"+e(t.getHours())+":"+e(t.getMinutes())+":"+e(t.getSeconds())+r(t.getTimezoneOffset())},Z=t=>{switch(t){case "noble":case "noble-1":case "grand":case "grand-1":return true;default:return false}},Y=t=>{switch(t){case "ethereum":case "sepolia":case "polygon":case "amoy":case "gnosis":case "chiado":case "arbitrum":case "arbitrumsepolia":case "linea":case "lineasepolia":case "scroll":case "scrollsepolia":case "camino":case "columbus":return true;default:return false}},P=t=>{if(typeof t=="number")return O(t);if(Z(t))return t.split("-")[0];if(Y(t))return t;try{return O(parseInt(t))}catch{throw new Error(`Chain not supported: ${t}`)}},u=(t,e)=>P(T(e,t)),ee=(t,e,r,n)=>{let s=`${e?.toUpperCase()||"EUR"}`;return n?`Send ${s} ${t} to ${r} on ${P(n)} at ${b(new Date)}`:s==="EUR"?`Send ${s} ${t} to ${D(r)} at ${b(new Date)}`:`Send ${s} ${t} to ${r} at ${b(new Date)}`},te=({domain:t,address:e,appName:r,redirectUri:n,chainId:s,issuedAt:i=new Date().toISOString(),expiryAt:a=new Date(Date.now()+1e3*60*5).toISOString(),privacyPolicyUrl:o,termsOfServiceUrl:l})=>`${t} wants you to sign in with your Ethereum account:
2
2
  ${e}
3
3
 
4
- Allow ${n} to access my data on Monerium
4
+ Allow ${r} to access my data on Monerium
5
5
 
6
- URI: ${t}
6
+ URI: ${n}
7
7
  Version: 1
8
8
  Chain ID: ${s}
9
- Nonce: ${I().slice(0,16)}
9
+ Nonce: ${A().slice(0,16)}
10
10
  Issued At: ${i}
11
11
  Expiration Time: ${a}
12
12
  Resources:
13
13
  - https://monerium.com/siwe
14
14
  - ${o}
15
- - ${c}`,f=r=>r&&Object.entries(r)?.length>0?Object.entries(r).filter(([e,n])=>n!==undefined).map(([e,n])=>`${encodeURIComponent(e)}=${encodeURIComponent(n)}`).join("&"):"",E=r=>{switch(r){case 1:return "ethereum";case 11155111:return "sepolia";case 100:return "gnosis";case 10200:return "chiado";case 137:return "polygon";case 80002:return "amoy";case 42161:return "arbitrum";case 421614:return "arbitrumsepolia";case 59144:return "linea";case 59141:return "lineasepolia";case 534352:return "scroll";case 534351:return "scrollsepolia";case 501:return "columbus";case 500:return "camino";default:throw new Error(`Chain not supported: ${r}`)}},T=r=>{if(typeof r!="string"||!r?.length)return r;let e=r.replace(/\s/g,"");return r?.length>11?`${e.substring(0,4)}...${e.substring(e.length-4)}`:r},te=r=>typeof r!="string"||!r?.length?r:r?.length>11?`${r.substring(0,7)}...${r.substring(r.length-5)}`:r;var D=(r,e)=>{if(e==="sandbox")switch(r){case "ethereum":return "sepolia";case "polygon":return "amoy";case "gnosis":return "chiado";case "arbitrum":return "arbitrumsepolia";case "linea":return "lineasepolia";case "scroll":return "scrollsepolia";case "camino":return "columbus";case "noble":return "noble";default:return r}return r},C=(r,e)=>{if(e?.chain){let{chain:n,...t}=e;return {...t,chain:P(D(n,r))}}return e};var {STORAGE_CODE_VERIFIER:b,STORAGE_ACCESS_TOKEN:p,STORAGE_ACCESS_EXPIRY:g}=h,l=typeof window>"u",w=class{#e;#i;bearerProfile;#s=new Map;isAuthorized=!!this.bearerProfile;#r=()=>{};#n;state;constructor(e){if(!e){this.#e=y.environments.sandbox;return}if(typeof e=="string")this.#e=y.environments[e];else if(this.#r=N(e.debug??false),this.#e=y.environments[e.environment||"sandbox"],!l&&!e?.clientSecret){let{clientId:n,redirectUri:t}=e;this.#n={clientId:n,redirectUri:t};}else if(l&&e?.clientSecret){this.#r("Client credentials detected"),console.error("\x1B[31m%s\x1B[0m","Use client credentials only on the server where the secret is secure!");let{clientId:n,clientSecret:t}=e;this.#n={clientId:n,clientSecret:t};}}async authorize(e){let n=A(),t=e?.address?{address:e?.address,signature:e?.signature,chain:e?.chain?u(this.#e.name,e?.chain):undefined}:{},s=f({client_id:this.#n?.clientId,redirect_uri:this.#n?.redirectUri,code_challenge:n,code_challenge_method:"S256",response_type:"code",state:e?.state,skip_create_account:e?.skipCreateAccount,skip_kyc:e?.skipKyc,email:e?.email,...t}),i=`${this.#e.api}/auth?${s}`;this.#r(`Auth flow URL: ${i}`),window.location.assign(i);}async siwe(e){let n=A(),t=f({client_id:this.#n?.clientId,redirect_uri:this.#n?.redirectUri,message:e.message,signature:e.signature,code_challenge:n,code_challenge_method:"S256",authentication_method:"siwe",state:e?.state}),s=`${this.#e.api}/auth?${t}`;this.#r(`Auth flow SIWE URL: ${s}`),window.location.assign(s);}async getAccess(e){let n=this.#n?.clientId;if(this.#n?.clientSecret){if(l)return await this.#c(this.#n),!!this?.bearerProfile;console.error("\x1B[31m%s\x1B[0m","Use client credentials only on the server where the secret is secure!");}let s=this.#n?.redirectUri;if(!n)throw new Error("Missing ClientId");if(l)throw new Error("This only works client side");let i=new URLSearchParams(window.location.search).get("code")||undefined,a=new URLSearchParams(window.location.search).get("state")||undefined,o=window.localStorage.getItem(p),c=window.localStorage.getItem(g);if(i)return this.#r("Using auth code from auth flow to authorize"),await this.#a(n,s,i,a),this.#r(this.bearerProfile?"Authorized":"Not authorized"),!!this.bearerProfile;if(e)return this.#r("Using refresh token to authorize"),await this.#d(n,e),this.#r(this.bearerProfile?"Authorized":"Not authorized"),!!this.bearerProfile;if(o&&c){let d=new Date;if(parseInt(c)<d.getTime())throw window.localStorage.removeItem(p),window.localStorage.removeItem(g),this.isAuthorized=false,this.bearerProfile=undefined,new Error("Access token has expired");this.#r("Access token should still be valid, checking if it is authorized...");try{return this.#i=`Bearer ${o}`,this.isAuthorized=!0,await this.getTokens(),this.#r("Authorized"),!0}catch{throw this.#r("Access token is invalid."),window.localStorage.removeItem(p),window.localStorage.removeItem(g),this.isAuthorized=false,this.bearerProfile=undefined,new Error("Access token is invalid.")}}return this.#r(this.bearerProfile?"Authorized":"Not authorized"),!!this.bearerProfile}async#o(e){let n;if(k(e))n={...e,grant_type:"authorization_code"};else if(v(e))n={...e,grant_type:"refresh_token"};else if($(e))n={...e,grant_type:"client_credentials"};else throw new Error("Authorization grant type could not be detected.");return await this.#t("post","auth/token",n,true).then(t=>{if(this.bearerProfile=t,this.isAuthorized=!!t,this.#i=`Bearer ${t?.access_token}`,!l){let i=new Date().getTime()+t?.expires_in*1e3;window.localStorage.setItem(p,t?.access_token||""),window.localStorage.setItem(g,i?.toString());}}).catch(t=>{throw l||(localStorage.removeItem(b),localStorage.removeItem(p),localStorage.removeItem(g),S()),new Error(t?.message)}),k(e)&&S(),this.bearerProfile}getAuthContext(){return this.#t("get","auth/context")}getProfile(e){return this.#t("get",`profiles/${e}`)}getProfiles(e){return this.#t("get",`profiles${m(e)}`)}getAddress(e){return this.#t("get",`addresses/${e}`)}getAddresses(e){e=C(this.#e.name,e);let n=e?f(e):undefined,t=n?`addresses?${n}`:"addresses";return this.#t("get",t)}getBalances(e,n,t){let s=Array.isArray(t)?t.map(a=>`currency=${a}`).join("&"):t?`currency=${t}`:"",i=u(this.#e.name,n);return this.#t("get",`balances/${i}/${e}${s?`?${s}`:""}`)}getIban(e){return this.#t("get",`ibans/${encodeURI(e)}`)}getIbans(e){let{profile:n,chain:t}=e||{},s=m({profile:n,chain:t?u(this.#e.name,t):""});return this.#t("get",`ibans${s}`)}getOrders(e){return this.#t("get",`orders${m(e)}`)}getOrder(e){return this.#t("get",`orders/${e}`)}getTokens(){return this.#t("get","tokens")}linkAddress(e){return e=C(this.#e.name,e),this.#t("post","addresses",JSON.stringify(e))}placeOrder(e){let n={kind:"redeem",...C(this.#e.name,e),counterpart:{...e.counterpart,identifier:C(this.#e.name,e.counterpart.identifier)}};return this.#t("post","orders",JSON.stringify(n))}moveIban(e,{address:n,chain:t}){return this.#t("patch",`ibans/${e}`,JSON.stringify({address:n,chain:u(this.#e.name,t)}))}requestIban({address:e,chain:n,emailNotifications:t=true}){return this.#t("post","ibans",JSON.stringify({address:e,chain:u(this.#e.name,n),emailNotifications:t}))}submitProfileDetails(e,n){return this.#t("put",`profiles/${e}/details`,JSON.stringify(n))}uploadSupportingDocument(e){let n=new FormData;return n.append("file",e),R(`${this.#e.api}/files`,"post",n,{Authorization:this.#i||""})}async#t(e,n,t,s){let i={Authorization:this.#i||"",Accept:"application/vnd.monerium.api-v2+json","Content-Type":`application/${s?"x-www-form-urlencoded":"json"}`};return R(`${this.#e.api}/${n}`,e.toUpperCase(),s?f(t):t,i)}#a=async(e,n,t,s)=>{let i=localStorage.getItem(b)||"";if(!i)throw new Error("Code verifier not found");return this.#r("Use code verifier to authorize"),this.state=s,localStorage.removeItem(b),await this.#o({code:t,redirect_uri:n,client_id:e,code_verifier:i})};#c=async({clientId:e,clientSecret:n})=>await this.#o({client_id:e,client_secret:n});#d=async(e,n)=>await this.#o({refresh_token:n,client_id:e});subscribeOrderNotifications({filter:e,onMessage:n,onError:t}={}){if(!this.bearerProfile?.access_token)return;let{profile:s,state:i}=e||{},a=m({access_token:this.bearerProfile?.access_token,profile:s,state:i}),o,c=_({profile:s,state:i});if(this.#s?.has(c))o=this.#s.get(c);else {let d=`${this.#e.wss}/orders${a}`;o=new WebSocket(d),this.#s?.set(c,o);}return o.onopen=()=>{console.log("Connected to WebSocket server");},o.onmessage=d=>{let O=JSON.parse(d.data);n&&n(O);},o.onclose=()=>{console.log("WebSocket connection closed"),this.#s?.delete(a);},o.onerror=d=>{t&&t(d),console.error("WebSocket error:",d);},o}unsubscribeOrderNotifications(e){if(e){let n=_({profile:e?.profile,state:e?.state}),t=this.#s?.get(n);t&&(t.close(),this.#s?.delete(n));}else this.#s?.forEach(n=>{n?.close();}),this.#s?.clear(),this.#s=undefined;}async disconnect(){l||localStorage.removeItem(b),this.unsubscribeOrderNotifications(),this.#i=undefined,this.bearerProfile=undefined;}async revokeAccess(){l||(localStorage.removeItem(p),localStorage.removeItem(g)),this.disconnect();}getEnvironment=()=>this.#e};var Be=w;exports.AccountState=Q;exports.Currency=B;exports.IdDocumentKind=G;exports.KYCOutcome=L;exports.KYCState=W;exports.Method=j;exports.MoneriumClient=w;exports.OrderKind=J;exports.OrderState=H;exports.PaymentStandard=V;exports.Permission=M;exports.ProfileState=K;exports.ProfileType=F;exports.constants=h;exports.default=Be;exports.getChain=E;exports.parseChain=P;exports.placeOrderMessage=Y;exports.rfc3339=x;exports.shortenAddress=te;exports.shortenIban=T;exports.siweMessage=ee;
15
+ - ${l}`,f=t=>t&&Object.entries(t)?.length>0?Object.entries(t).filter(([e,r])=>r!==undefined).map(([e,r])=>`${encodeURIComponent(e)}=${encodeURIComponent(r)}`).join("&"):"",O=t=>{switch(t){case 1:return "ethereum";case 11155111:return "sepolia";case 100:return "gnosis";case 10200:return "chiado";case 137:return "polygon";case 80002:return "amoy";case 42161:return "arbitrum";case 421614:return "arbitrumsepolia";case 59144:return "linea";case 59141:return "lineasepolia";case 534352:return "scroll";case 534351:return "scrollsepolia";case 501:return "columbus";case 500:return "camino";default:throw new Error(`Chain not supported: ${t}`)}},D=t=>{if(typeof t!="string"||!t?.length)return t;let e=t.replace(/\s/g,"");return t?.length>11?`${e.substring(0,4)}...${e.substring(e.length-4)}`:t},re=t=>typeof t!="string"||!t?.length?t:t?.length>11?`${t.substring(0,7)}...${t.substring(t.length-5)}`:t;var T=(t,e)=>{if(e==="sandbox")switch(t){case "ethereum":return "sepolia";case "polygon":return "amoy";case "gnosis":return "chiado";case "arbitrum":return "arbitrumsepolia";case "linea":return "lineasepolia";case "scroll":return "scrollsepolia";case "camino":return "columbus";case "noble":return "noble";default:return t}return t},C=(t,e)=>{if(e?.chain){let{chain:r,...n}=e;return {...n,chain:P(T(r,t))}}return e};var {STORAGE_CODE_VERIFIER:w,STORAGE_ACCESS_TOKEN:p,STORAGE_ACCESS_EXPIRY:g}=h,d=typeof window>"u",I=class{#e;#i;bearerProfile;#s=new Map;isAuthorized=!!this.bearerProfile;#r=()=>{};#n;state;constructor(e){if(!e){this.#e=x.environments.sandbox;return}if(typeof e=="string")this.#e=x.environments[e];else if(this.#r=N(e.debug??false),this.#e=x.environments[e.environment||"sandbox"],!d&&!e?.clientSecret){let{clientId:r,redirectUri:n}=e;this.#n={clientId:r,redirectUri:n};}else if(d&&e?.clientSecret){this.#r("Client credentials detected"),console.error("\x1B[31m%s\x1B[0m","Use client credentials only on the server where the secret is secure!");let{clientId:r,clientSecret:n}=e;this.#n={clientId:r,clientSecret:n};}}async authorize(e){let r=S(),n=e?.address?{address:e?.address,signature:e?.signature,chain:e?.chain?u(this.#e.name,e?.chain):undefined}:{},s=f({client_id:this.#n?.clientId,redirect_uri:this.#n?.redirectUri,code_challenge:r,code_challenge_method:"S256",response_type:"code",state:e?.state,skip_create_account:e?.skipCreateAccount,skip_kyc:e?.skipKyc,email:e?.email,...n}),i=`${this.#e.api}/auth?${s}`;this.#r(`Auth flow URL: ${i}`),window.location.assign(i);}async siwe(e){let r=S(),n=f({client_id:this.#n?.clientId,redirect_uri:this.#n?.redirectUri,message:e.message,signature:e.signature,code_challenge:r,code_challenge_method:"S256",authentication_method:"siwe",state:e?.state}),s=`${this.#e.api}/auth?${n}`;this.#r(`Auth flow SIWE URL: ${s}`),window.location.assign(s);}async getAccess(e){let r=this.#n?.clientId;if(this.#n?.clientSecret){if(d)return await this.#c(this.#n),!!this?.bearerProfile;console.error("\x1B[31m%s\x1B[0m","Use client credentials only on the server where the secret is secure!");}let s=this.#n?.redirectUri;if(!r)throw new Error("Missing ClientId");if(d)throw new Error("This only works client side");let i=new URLSearchParams(window.location.search).get("error")||undefined,a=new URLSearchParams(window.location.search).get("error_description")||undefined;if(i||a)throw new Error(a);let o=new URLSearchParams(window.location.search).get("code")||undefined,l=new URLSearchParams(window.location.search).get("state")||undefined,c=window.localStorage.getItem(p),y=window.localStorage.getItem(g);if(o)return this.#r("Using auth code from auth flow to authorize"),await this.#a(r,s,o,l),this.#r(this.bearerProfile?"Authorized":"Not authorized"),!!this.bearerProfile;if(e)return this.#r("Using refresh token to authorize"),await this.#d(r,e),this.#r(this.bearerProfile?"Authorized":"Not authorized"),!!this.bearerProfile;if(c&&y){let U=new Date;if(parseInt(y)<U.getTime())throw window.localStorage.removeItem(p),window.localStorage.removeItem(g),this.isAuthorized=false,this.bearerProfile=undefined,new Error("Access token has expired");this.#r("Access token should still be valid, checking if it is authorized...");try{return this.#i=`Bearer ${c}`,this.isAuthorized=!0,await this.getTokens(),this.#r("Authorized"),!0}catch{throw this.#r("Access token is invalid."),window.localStorage.removeItem(p),window.localStorage.removeItem(g),this.isAuthorized=false,this.bearerProfile=undefined,new Error("Access token is invalid.")}}return this.#r(this.bearerProfile?"Authorized":"Not authorized"),!!this.bearerProfile}async#o(e){let r;if(R(e))r={...e,grant_type:"authorization_code"};else if(v(e))r={...e,grant_type:"refresh_token"};else if($(e))r={...e,grant_type:"client_credentials"};else throw new Error("Authorization grant type could not be detected.");return await this.#t("post","auth/token",r,true).then(n=>{if(this.bearerProfile=n,this.isAuthorized=!!n,this.#i=`Bearer ${n?.access_token}`,!d){let i=new Date().getTime()+n?.expires_in*1e3;window.localStorage.setItem(p,n?.access_token||""),window.localStorage.setItem(g,i?.toString());}}).catch(n=>{throw d||(localStorage.removeItem(w),localStorage.removeItem(p),localStorage.removeItem(g),k()),new Error(n?.message)}),R(e)&&k(),this.bearerProfile}getAuthContext(){return this.#t("get","auth/context")}getProfile(e){return this.#t("get",`profiles/${e}`)}getProfiles(e){return this.#t("get",`profiles${m(e)}`)}getAddress(e){return this.#t("get",`addresses/${e}`)}getAddresses(e){e=C(this.#e.name,e);let r=e?f(e):undefined,n=r?`addresses?${r}`:"addresses";return this.#t("get",n)}getBalances(e,r,n){let s=Array.isArray(n)?n.map(a=>`currency=${a}`).join("&"):n?`currency=${n}`:"",i=u(this.#e.name,r);return this.#t("get",`balances/${i}/${e}${s?`?${s}`:""}`)}getIban(e){return this.#t("get",`ibans/${encodeURI(e)}`)}getIbans(e){let{profile:r,chain:n}=e||{},s=m({profile:r,chain:n?u(this.#e.name,n):""});return this.#t("get",`ibans${s}`)}getOrders(e){return this.#t("get",`orders${m(e)}`)}getOrder(e){return this.#t("get",`orders/${e}`)}getTokens(){return this.#t("get","tokens")}linkAddress(e){return e=C(this.#e.name,e),this.#t("post","addresses",JSON.stringify(e))}placeOrder(e){let r={kind:"redeem",...C(this.#e.name,e),counterpart:{...e.counterpart,identifier:C(this.#e.name,e.counterpart.identifier)}};return this.#t("post","orders",JSON.stringify(r))}moveIban(e,{address:r,chain:n}){return this.#t("patch",`ibans/${e}`,JSON.stringify({address:r,chain:u(this.#e.name,n)}))}requestIban({address:e,chain:r,emailNotifications:n=true}){return this.#t("post","ibans",JSON.stringify({address:e,chain:u(this.#e.name,r),emailNotifications:n}))}submitProfileDetails(e,r){return this.#t("put",`profiles/${e}/details`,JSON.stringify(r))}uploadSupportingDocument(e){let r=new FormData;return r.append("file",e),_(`${this.#e.api}/files`,"post",r,{Authorization:this.#i||""})}async#t(e,r,n,s){let i={Authorization:this.#i||"",Accept:"application/vnd.monerium.api-v2+json","Content-Type":`application/${s?"x-www-form-urlencoded":"json"}`};return _(`${this.#e.api}/${r}`,e.toUpperCase(),s?f(n):n,i)}#a=async(e,r,n,s)=>{let i=localStorage.getItem(w)||"";if(!i)throw new Error("Code verifier not found");return this.#r("Use code verifier to authorize"),this.state=s,localStorage.removeItem(w),await this.#o({code:n,redirect_uri:r,client_id:e,code_verifier:i})};#c=async({clientId:e,clientSecret:r})=>await this.#o({client_id:e,client_secret:r});#d=async(e,r)=>await this.#o({refresh_token:r,client_id:e});subscribeOrderNotifications({filter:e,onMessage:r,onError:n}={}){if(!this.bearerProfile?.access_token)return;let{profile:s,state:i}=e||{},a=m({access_token:this.bearerProfile?.access_token,profile:s,state:i}),o,l=E({profile:s,state:i});if(this.#s?.has(l))o=this.#s.get(l);else {let c=`${this.#e.wss}/orders${a}`;o=new WebSocket(c),this.#s?.set(l,o);}return o.onopen=()=>{console.log("Connected to WebSocket server");},o.onmessage=c=>{let y=JSON.parse(c.data);r&&r(y);},o.onclose=()=>{console.log("WebSocket connection closed"),this.#s?.delete(a);},o.onerror=c=>{n&&n(c),console.error("WebSocket error:",c);},o}unsubscribeOrderNotifications(e){if(e){let r=E({profile:e?.profile,state:e?.state}),n=this.#s?.get(r);n&&(n.close(),this.#s?.delete(r));}else this.#s?.forEach(r=>{r?.close();}),this.#s?.clear(),this.#s=undefined;}async disconnect(){d||localStorage.removeItem(w),this.unsubscribeOrderNotifications(),this.#i=undefined,this.bearerProfile=undefined;}async revokeAccess(){d||(localStorage.removeItem(p),localStorage.removeItem(g)),this.disconnect();}getEnvironment=()=>this.#e};var Te=I;exports.AccountState=V;exports.Currency=B;exports.IdDocumentKind=J;exports.KYCOutcome=Q;exports.KYCState=W;exports.Method=M;exports.MoneriumClient=I;exports.OrderKind=H;exports.OrderState=X;exports.PaymentStandard=G;exports.Permission=K;exports.ProfileState=L;exports.ProfileType=F;exports.constants=h;exports.default=Te;exports.getChain=O;exports.parseChain=P;exports.placeOrderMessage=ee;exports.rfc3339=b;exports.shortenAddress=re;exports.shortenIban=D;exports.siweMessage=te;
package/dist/index.mjs CHANGED
@@ -1,15 +1,15 @@
1
- import U from'crypto-js/enc-base64url.js';import z from'crypto-js/sha256.js';var y={environments:{production:{name:"production",api:"https://api.monerium.app",web:"https://monerium.app",wss:"wss://api.monerium.app"},sandbox:{name:"sandbox",api:"https://api.monerium.dev",web:"https://sandbox.monerium.dev",wss:"wss://api.monerium.dev"}}};var h={LINK_MESSAGE:"I hereby declare that I am the address owner.",STORAGE_CODE_VERIFIER:"monerium.sdk.code_verifier",STORAGE_ACCESS_TOKEN:"monerium.sdk.access_token",STORAGE_ACCESS_EXPIRY:"monerium.sdk.access_expiry"};var I=()=>{let r="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=e.length,t=0;for(;t<128;)r+=e.charAt(Math.floor(Math.random()*n)),t+=1;return r},q=r=>U.stringify(z(r)),A=()=>{let r=I(),e=q(r);return localStorage.setItem(h.STORAGE_CODE_VERIFIER,r||""),e},S=()=>{let r=window.location.href;if(!r||!r?.includes("?"))return;let[e,n]=r.split("?");n&&window.history.replaceState(null,"",e);},k=r=>r.code!=null,v=r=>r.refresh_token!=null,$=r=>r.client_secret!=null;var R=async(r,e,n,t)=>{let s=await fetch(`${r}`,{method:e,headers:t,body:n}),i,a=await s.text();try{if(i=JSON.parse(a),Object.keys(i).length===0&&i.constructor===Object)switch(s.status){case 201:case 202:return {status:s.status,statusText:s.statusText}}}catch{throw a}if(!s.ok)throw i;return i};var m=r=>{if(!r)return "";let e=Object.entries(r).filter(([n,t])=>t!==""&&t!==undefined&&t!==null).map(([n,t])=>`${encodeURIComponent(n)}=${encodeURIComponent(t)}`).join("&");return e?"?"+e:""};var N=r=>r?e=>{console.log("%c [MONERIUM:DEBUG]:","color:orange;",e);}:()=>{};var _=r=>Object.entries(r).filter(([n,t])=>t!=null).map(([n,t])=>`${n}-${t}`).join("-");var B=(s=>(s.eur="eur",s.usd="usd",s.gbp="gbp",s.isk="isk",s))(B||{}),j=(i=>(i.password="password",i.resource="resource",i.jwt="jwt",i.apiKey="apiKey",i.bearer="bearer",i))(j||{}),F=(n=>(n.corporate="corporate",n.personal="personal",n))(F||{}),M=(n=>(n.read="read",n.write="write",n))(M||{}),K=(i=>(i.created="created",i.pending="pending",i.approved="approved",i.rejected="rejected",i.blocked="blocked",i))(K||{}),W=(s=>(s.absent="absent",s.submitted="submitted",s.pending="pending",s.confirmed="confirmed",s))(W||{}),L=(t=>(t.approved="approved",t.rejected="rejected",t.unknown="unknown",t))(L||{}),Q=(t=>(t.requested="requested",t.approved="approved",t.pending="pending",t))(Q||{}),V=(t=>(t.iban="iban",t.scan="scan",t.chain="chain",t))(V||{}),G=(t=>(t.passport="passport",t.nationalIdentityCard="nationalIdentityCard",t.drivingLicense="drivingLicense",t))(G||{}),J=(n=>(n.redeem="redeem",n.issue="issue",n))(J||{}),H=(s=>(s.placed="placed",s.pending="pending",s.processed="processed",s.rejected="rejected",s))(H||{});var x=r=>{if(r.toString()==="Invalid Date")throw r;let e=t=>t<10?"0"+t:t,n=t=>{if(t===0)return "Z";let s=t>0?"-":"+";return t=Math.abs(t),s+e(Math.floor(t/60))+":"+e(t%60)};return r.getFullYear()+"-"+e(r.getMonth()+1)+"-"+e(r.getDate())+"T"+e(r.getHours())+":"+e(r.getMinutes())+":"+e(r.getSeconds())+n(r.getTimezoneOffset())},X=r=>{switch(r){case "noble":case "noble-1":case "grand":case "grand-1":return true;default:return false}},Z=r=>{switch(r){case "ethereum":case "sepolia":case "polygon":case "amoy":case "gnosis":case "chiado":case "arbitrum":case "arbitrumsepolia":case "linea":case "lineasepolia":case "scroll":case "scrollsepolia":case "camino":case "columbus":return true;default:return false}},P=r=>{if(typeof r=="number")return E(r);if(X(r))return r.split("-")[0];if(Z(r))return r;try{return E(parseInt(r))}catch{throw new Error(`Chain not supported: ${r}`)}},u=(r,e)=>P(D(e,r)),Y=(r,e,n,t)=>{let s=`${e?.toUpperCase()||"EUR"}`;return t?`Send ${s} ${r} to ${n} on ${P(t)} at ${x(new Date)}`:s==="EUR"?`Send ${s} ${r} to ${T(n)} at ${x(new Date)}`:`Send ${s} ${r} to ${n} at ${x(new Date)}`},ee=({domain:r,address:e,appName:n,redirectUri:t,chainId:s,issuedAt:i=new Date().toISOString(),expiryAt:a=new Date(Date.now()+1e3*60*5).toISOString(),privacyPolicyUrl:o,termsOfServiceUrl:c})=>`${r} wants you to sign in with your Ethereum account:
1
+ import z from'crypto-js/enc-base64url.js';import q from'crypto-js/sha256.js';var x={environments:{production:{name:"production",api:"https://api.monerium.app",web:"https://monerium.app",wss:"wss://api.monerium.app"},sandbox:{name:"sandbox",api:"https://api.monerium.dev",web:"https://sandbox.monerium.dev",wss:"wss://api.monerium.dev"}}};var h={LINK_MESSAGE:"I hereby declare that I am the address owner.",STORAGE_CODE_VERIFIER:"monerium.sdk.code_verifier",STORAGE_ACCESS_TOKEN:"monerium.sdk.access_token",STORAGE_ACCESS_EXPIRY:"monerium.sdk.access_expiry"};var A=()=>{let t="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=e.length,n=0;for(;n<128;)t+=e.charAt(Math.floor(Math.random()*r)),n+=1;return t},j=t=>z.stringify(q(t)),S=()=>{let t=A(),e=j(t);return localStorage.setItem(h.STORAGE_CODE_VERIFIER,t||""),e},k=()=>{let t=window.location.href;if(!t||!t?.includes("?"))return;let[e,r]=t.split("?");r&&window.history.replaceState(null,"",e);},R=t=>t.code!=null,v=t=>t.refresh_token!=null,$=t=>t.client_secret!=null;var _=async(t,e,r,n)=>{let s=await fetch(`${t}`,{method:e,headers:n,body:r}),i,a=await s.text();try{if(i=JSON.parse(a),Object.keys(i).length===0&&i.constructor===Object)switch(s.status){case 201:case 202:return {status:s.status,statusText:s.statusText}}}catch{throw a}if(!s.ok)throw i;return i};var m=t=>{if(!t)return "";let e=Object.entries(t).filter(([r,n])=>n!==""&&n!==undefined&&n!==null).map(([r,n])=>`${encodeURIComponent(r)}=${encodeURIComponent(n)}`).join("&");return e?"?"+e:""};var N=t=>t?e=>{console.log("%c [MONERIUM:DEBUG]:","color:orange;",e);}:()=>{};var E=t=>Object.entries(t).filter(([r,n])=>n!=null).map(([r,n])=>`${r}-${n}`).join("-");var B=(s=>(s.eur="eur",s.usd="usd",s.gbp="gbp",s.isk="isk",s))(B||{}),M=(i=>(i.password="password",i.resource="resource",i.jwt="jwt",i.apiKey="apiKey",i.bearer="bearer",i))(M||{}),F=(r=>(r.corporate="corporate",r.personal="personal",r))(F||{}),K=(r=>(r.read="read",r.write="write",r))(K||{}),L=(i=>(i.created="created",i.pending="pending",i.approved="approved",i.rejected="rejected",i.blocked="blocked",i))(L||{}),W=(s=>(s.absent="absent",s.submitted="submitted",s.pending="pending",s.confirmed="confirmed",s))(W||{}),Q=(n=>(n.approved="approved",n.rejected="rejected",n.unknown="unknown",n))(Q||{}),V=(i=>(i.requested="requested",i.approved="approved",i.pending="pending",i.rejected="rejected",i.closed="closed",i))(V||{}),G=(s=>(s.iban="iban",s.scan="scan",s.chain="chain",s.account="account",s))(G||{}),J=(n=>(n.passport="passport",n.nationalIdentityCard="nationalIdentityCard",n.drivingLicense="drivingLicense",n))(J||{}),H=(r=>(r.redeem="redeem",r.issue="issue",r))(H||{}),X=(s=>(s.placed="placed",s.pending="pending",s.processed="processed",s.rejected="rejected",s))(X||{});var b=t=>{if(t.toString()==="Invalid Date")throw t;let e=n=>n<10?"0"+n:n,r=n=>{if(n===0)return "Z";let s=n>0?"-":"+";return n=Math.abs(n),s+e(Math.floor(n/60))+":"+e(n%60)};return t.getFullYear()+"-"+e(t.getMonth()+1)+"-"+e(t.getDate())+"T"+e(t.getHours())+":"+e(t.getMinutes())+":"+e(t.getSeconds())+r(t.getTimezoneOffset())},Z=t=>{switch(t){case "noble":case "noble-1":case "grand":case "grand-1":return true;default:return false}},Y=t=>{switch(t){case "ethereum":case "sepolia":case "polygon":case "amoy":case "gnosis":case "chiado":case "arbitrum":case "arbitrumsepolia":case "linea":case "lineasepolia":case "scroll":case "scrollsepolia":case "camino":case "columbus":return true;default:return false}},P=t=>{if(typeof t=="number")return O(t);if(Z(t))return t.split("-")[0];if(Y(t))return t;try{return O(parseInt(t))}catch{throw new Error(`Chain not supported: ${t}`)}},u=(t,e)=>P(T(e,t)),ee=(t,e,r,n)=>{let s=`${e?.toUpperCase()||"EUR"}`;return n?`Send ${s} ${t} to ${r} on ${P(n)} at ${b(new Date)}`:s==="EUR"?`Send ${s} ${t} to ${D(r)} at ${b(new Date)}`:`Send ${s} ${t} to ${r} at ${b(new Date)}`},te=({domain:t,address:e,appName:r,redirectUri:n,chainId:s,issuedAt:i=new Date().toISOString(),expiryAt:a=new Date(Date.now()+1e3*60*5).toISOString(),privacyPolicyUrl:o,termsOfServiceUrl:l})=>`${t} wants you to sign in with your Ethereum account:
2
2
  ${e}
3
3
 
4
- Allow ${n} to access my data on Monerium
4
+ Allow ${r} to access my data on Monerium
5
5
 
6
- URI: ${t}
6
+ URI: ${n}
7
7
  Version: 1
8
8
  Chain ID: ${s}
9
- Nonce: ${I().slice(0,16)}
9
+ Nonce: ${A().slice(0,16)}
10
10
  Issued At: ${i}
11
11
  Expiration Time: ${a}
12
12
  Resources:
13
13
  - https://monerium.com/siwe
14
14
  - ${o}
15
- - ${c}`,f=r=>r&&Object.entries(r)?.length>0?Object.entries(r).filter(([e,n])=>n!==undefined).map(([e,n])=>`${encodeURIComponent(e)}=${encodeURIComponent(n)}`).join("&"):"",E=r=>{switch(r){case 1:return "ethereum";case 11155111:return "sepolia";case 100:return "gnosis";case 10200:return "chiado";case 137:return "polygon";case 80002:return "amoy";case 42161:return "arbitrum";case 421614:return "arbitrumsepolia";case 59144:return "linea";case 59141:return "lineasepolia";case 534352:return "scroll";case 534351:return "scrollsepolia";case 501:return "columbus";case 500:return "camino";default:throw new Error(`Chain not supported: ${r}`)}},T=r=>{if(typeof r!="string"||!r?.length)return r;let e=r.replace(/\s/g,"");return r?.length>11?`${e.substring(0,4)}...${e.substring(e.length-4)}`:r},te=r=>typeof r!="string"||!r?.length?r:r?.length>11?`${r.substring(0,7)}...${r.substring(r.length-5)}`:r;var D=(r,e)=>{if(e==="sandbox")switch(r){case "ethereum":return "sepolia";case "polygon":return "amoy";case "gnosis":return "chiado";case "arbitrum":return "arbitrumsepolia";case "linea":return "lineasepolia";case "scroll":return "scrollsepolia";case "camino":return "columbus";case "noble":return "noble";default:return r}return r},C=(r,e)=>{if(e?.chain){let{chain:n,...t}=e;return {...t,chain:P(D(n,r))}}return e};var {STORAGE_CODE_VERIFIER:b,STORAGE_ACCESS_TOKEN:p,STORAGE_ACCESS_EXPIRY:g}=h,l=typeof window>"u",w=class{#e;#i;bearerProfile;#s=new Map;isAuthorized=!!this.bearerProfile;#r=()=>{};#n;state;constructor(e){if(!e){this.#e=y.environments.sandbox;return}if(typeof e=="string")this.#e=y.environments[e];else if(this.#r=N(e.debug??false),this.#e=y.environments[e.environment||"sandbox"],!l&&!e?.clientSecret){let{clientId:n,redirectUri:t}=e;this.#n={clientId:n,redirectUri:t};}else if(l&&e?.clientSecret){this.#r("Client credentials detected"),console.error("\x1B[31m%s\x1B[0m","Use client credentials only on the server where the secret is secure!");let{clientId:n,clientSecret:t}=e;this.#n={clientId:n,clientSecret:t};}}async authorize(e){let n=A(),t=e?.address?{address:e?.address,signature:e?.signature,chain:e?.chain?u(this.#e.name,e?.chain):undefined}:{},s=f({client_id:this.#n?.clientId,redirect_uri:this.#n?.redirectUri,code_challenge:n,code_challenge_method:"S256",response_type:"code",state:e?.state,skip_create_account:e?.skipCreateAccount,skip_kyc:e?.skipKyc,email:e?.email,...t}),i=`${this.#e.api}/auth?${s}`;this.#r(`Auth flow URL: ${i}`),window.location.assign(i);}async siwe(e){let n=A(),t=f({client_id:this.#n?.clientId,redirect_uri:this.#n?.redirectUri,message:e.message,signature:e.signature,code_challenge:n,code_challenge_method:"S256",authentication_method:"siwe",state:e?.state}),s=`${this.#e.api}/auth?${t}`;this.#r(`Auth flow SIWE URL: ${s}`),window.location.assign(s);}async getAccess(e){let n=this.#n?.clientId;if(this.#n?.clientSecret){if(l)return await this.#c(this.#n),!!this?.bearerProfile;console.error("\x1B[31m%s\x1B[0m","Use client credentials only on the server where the secret is secure!");}let s=this.#n?.redirectUri;if(!n)throw new Error("Missing ClientId");if(l)throw new Error("This only works client side");let i=new URLSearchParams(window.location.search).get("code")||undefined,a=new URLSearchParams(window.location.search).get("state")||undefined,o=window.localStorage.getItem(p),c=window.localStorage.getItem(g);if(i)return this.#r("Using auth code from auth flow to authorize"),await this.#a(n,s,i,a),this.#r(this.bearerProfile?"Authorized":"Not authorized"),!!this.bearerProfile;if(e)return this.#r("Using refresh token to authorize"),await this.#d(n,e),this.#r(this.bearerProfile?"Authorized":"Not authorized"),!!this.bearerProfile;if(o&&c){let d=new Date;if(parseInt(c)<d.getTime())throw window.localStorage.removeItem(p),window.localStorage.removeItem(g),this.isAuthorized=false,this.bearerProfile=undefined,new Error("Access token has expired");this.#r("Access token should still be valid, checking if it is authorized...");try{return this.#i=`Bearer ${o}`,this.isAuthorized=!0,await this.getTokens(),this.#r("Authorized"),!0}catch{throw this.#r("Access token is invalid."),window.localStorage.removeItem(p),window.localStorage.removeItem(g),this.isAuthorized=false,this.bearerProfile=undefined,new Error("Access token is invalid.")}}return this.#r(this.bearerProfile?"Authorized":"Not authorized"),!!this.bearerProfile}async#o(e){let n;if(k(e))n={...e,grant_type:"authorization_code"};else if(v(e))n={...e,grant_type:"refresh_token"};else if($(e))n={...e,grant_type:"client_credentials"};else throw new Error("Authorization grant type could not be detected.");return await this.#t("post","auth/token",n,true).then(t=>{if(this.bearerProfile=t,this.isAuthorized=!!t,this.#i=`Bearer ${t?.access_token}`,!l){let i=new Date().getTime()+t?.expires_in*1e3;window.localStorage.setItem(p,t?.access_token||""),window.localStorage.setItem(g,i?.toString());}}).catch(t=>{throw l||(localStorage.removeItem(b),localStorage.removeItem(p),localStorage.removeItem(g),S()),new Error(t?.message)}),k(e)&&S(),this.bearerProfile}getAuthContext(){return this.#t("get","auth/context")}getProfile(e){return this.#t("get",`profiles/${e}`)}getProfiles(e){return this.#t("get",`profiles${m(e)}`)}getAddress(e){return this.#t("get",`addresses/${e}`)}getAddresses(e){e=C(this.#e.name,e);let n=e?f(e):undefined,t=n?`addresses?${n}`:"addresses";return this.#t("get",t)}getBalances(e,n,t){let s=Array.isArray(t)?t.map(a=>`currency=${a}`).join("&"):t?`currency=${t}`:"",i=u(this.#e.name,n);return this.#t("get",`balances/${i}/${e}${s?`?${s}`:""}`)}getIban(e){return this.#t("get",`ibans/${encodeURI(e)}`)}getIbans(e){let{profile:n,chain:t}=e||{},s=m({profile:n,chain:t?u(this.#e.name,t):""});return this.#t("get",`ibans${s}`)}getOrders(e){return this.#t("get",`orders${m(e)}`)}getOrder(e){return this.#t("get",`orders/${e}`)}getTokens(){return this.#t("get","tokens")}linkAddress(e){return e=C(this.#e.name,e),this.#t("post","addresses",JSON.stringify(e))}placeOrder(e){let n={kind:"redeem",...C(this.#e.name,e),counterpart:{...e.counterpart,identifier:C(this.#e.name,e.counterpart.identifier)}};return this.#t("post","orders",JSON.stringify(n))}moveIban(e,{address:n,chain:t}){return this.#t("patch",`ibans/${e}`,JSON.stringify({address:n,chain:u(this.#e.name,t)}))}requestIban({address:e,chain:n,emailNotifications:t=true}){return this.#t("post","ibans",JSON.stringify({address:e,chain:u(this.#e.name,n),emailNotifications:t}))}submitProfileDetails(e,n){return this.#t("put",`profiles/${e}/details`,JSON.stringify(n))}uploadSupportingDocument(e){let n=new FormData;return n.append("file",e),R(`${this.#e.api}/files`,"post",n,{Authorization:this.#i||""})}async#t(e,n,t,s){let i={Authorization:this.#i||"",Accept:"application/vnd.monerium.api-v2+json","Content-Type":`application/${s?"x-www-form-urlencoded":"json"}`};return R(`${this.#e.api}/${n}`,e.toUpperCase(),s?f(t):t,i)}#a=async(e,n,t,s)=>{let i=localStorage.getItem(b)||"";if(!i)throw new Error("Code verifier not found");return this.#r("Use code verifier to authorize"),this.state=s,localStorage.removeItem(b),await this.#o({code:t,redirect_uri:n,client_id:e,code_verifier:i})};#c=async({clientId:e,clientSecret:n})=>await this.#o({client_id:e,client_secret:n});#d=async(e,n)=>await this.#o({refresh_token:n,client_id:e});subscribeOrderNotifications({filter:e,onMessage:n,onError:t}={}){if(!this.bearerProfile?.access_token)return;let{profile:s,state:i}=e||{},a=m({access_token:this.bearerProfile?.access_token,profile:s,state:i}),o,c=_({profile:s,state:i});if(this.#s?.has(c))o=this.#s.get(c);else {let d=`${this.#e.wss}/orders${a}`;o=new WebSocket(d),this.#s?.set(c,o);}return o.onopen=()=>{console.log("Connected to WebSocket server");},o.onmessage=d=>{let O=JSON.parse(d.data);n&&n(O);},o.onclose=()=>{console.log("WebSocket connection closed"),this.#s?.delete(a);},o.onerror=d=>{t&&t(d),console.error("WebSocket error:",d);},o}unsubscribeOrderNotifications(e){if(e){let n=_({profile:e?.profile,state:e?.state}),t=this.#s?.get(n);t&&(t.close(),this.#s?.delete(n));}else this.#s?.forEach(n=>{n?.close();}),this.#s?.clear(),this.#s=undefined;}async disconnect(){l||localStorage.removeItem(b),this.unsubscribeOrderNotifications(),this.#i=undefined,this.bearerProfile=undefined;}async revokeAccess(){l||(localStorage.removeItem(p),localStorage.removeItem(g)),this.disconnect();}getEnvironment=()=>this.#e};var Be=w;export{Q as AccountState,B as Currency,G as IdDocumentKind,L as KYCOutcome,W as KYCState,j as Method,w as MoneriumClient,J as OrderKind,H as OrderState,V as PaymentStandard,M as Permission,K as ProfileState,F as ProfileType,h as constants,Be as default,E as getChain,P as parseChain,Y as placeOrderMessage,x as rfc3339,te as shortenAddress,T as shortenIban,ee as siweMessage};
15
+ - ${l}`,f=t=>t&&Object.entries(t)?.length>0?Object.entries(t).filter(([e,r])=>r!==undefined).map(([e,r])=>`${encodeURIComponent(e)}=${encodeURIComponent(r)}`).join("&"):"",O=t=>{switch(t){case 1:return "ethereum";case 11155111:return "sepolia";case 100:return "gnosis";case 10200:return "chiado";case 137:return "polygon";case 80002:return "amoy";case 42161:return "arbitrum";case 421614:return "arbitrumsepolia";case 59144:return "linea";case 59141:return "lineasepolia";case 534352:return "scroll";case 534351:return "scrollsepolia";case 501:return "columbus";case 500:return "camino";default:throw new Error(`Chain not supported: ${t}`)}},D=t=>{if(typeof t!="string"||!t?.length)return t;let e=t.replace(/\s/g,"");return t?.length>11?`${e.substring(0,4)}...${e.substring(e.length-4)}`:t},re=t=>typeof t!="string"||!t?.length?t:t?.length>11?`${t.substring(0,7)}...${t.substring(t.length-5)}`:t;var T=(t,e)=>{if(e==="sandbox")switch(t){case "ethereum":return "sepolia";case "polygon":return "amoy";case "gnosis":return "chiado";case "arbitrum":return "arbitrumsepolia";case "linea":return "lineasepolia";case "scroll":return "scrollsepolia";case "camino":return "columbus";case "noble":return "noble";default:return t}return t},C=(t,e)=>{if(e?.chain){let{chain:r,...n}=e;return {...n,chain:P(T(r,t))}}return e};var {STORAGE_CODE_VERIFIER:w,STORAGE_ACCESS_TOKEN:p,STORAGE_ACCESS_EXPIRY:g}=h,d=typeof window>"u",I=class{#e;#i;bearerProfile;#s=new Map;isAuthorized=!!this.bearerProfile;#r=()=>{};#n;state;constructor(e){if(!e){this.#e=x.environments.sandbox;return}if(typeof e=="string")this.#e=x.environments[e];else if(this.#r=N(e.debug??false),this.#e=x.environments[e.environment||"sandbox"],!d&&!e?.clientSecret){let{clientId:r,redirectUri:n}=e;this.#n={clientId:r,redirectUri:n};}else if(d&&e?.clientSecret){this.#r("Client credentials detected"),console.error("\x1B[31m%s\x1B[0m","Use client credentials only on the server where the secret is secure!");let{clientId:r,clientSecret:n}=e;this.#n={clientId:r,clientSecret:n};}}async authorize(e){let r=S(),n=e?.address?{address:e?.address,signature:e?.signature,chain:e?.chain?u(this.#e.name,e?.chain):undefined}:{},s=f({client_id:this.#n?.clientId,redirect_uri:this.#n?.redirectUri,code_challenge:r,code_challenge_method:"S256",response_type:"code",state:e?.state,skip_create_account:e?.skipCreateAccount,skip_kyc:e?.skipKyc,email:e?.email,...n}),i=`${this.#e.api}/auth?${s}`;this.#r(`Auth flow URL: ${i}`),window.location.assign(i);}async siwe(e){let r=S(),n=f({client_id:this.#n?.clientId,redirect_uri:this.#n?.redirectUri,message:e.message,signature:e.signature,code_challenge:r,code_challenge_method:"S256",authentication_method:"siwe",state:e?.state}),s=`${this.#e.api}/auth?${n}`;this.#r(`Auth flow SIWE URL: ${s}`),window.location.assign(s);}async getAccess(e){let r=this.#n?.clientId;if(this.#n?.clientSecret){if(d)return await this.#c(this.#n),!!this?.bearerProfile;console.error("\x1B[31m%s\x1B[0m","Use client credentials only on the server where the secret is secure!");}let s=this.#n?.redirectUri;if(!r)throw new Error("Missing ClientId");if(d)throw new Error("This only works client side");let i=new URLSearchParams(window.location.search).get("error")||undefined,a=new URLSearchParams(window.location.search).get("error_description")||undefined;if(i||a)throw new Error(a);let o=new URLSearchParams(window.location.search).get("code")||undefined,l=new URLSearchParams(window.location.search).get("state")||undefined,c=window.localStorage.getItem(p),y=window.localStorage.getItem(g);if(o)return this.#r("Using auth code from auth flow to authorize"),await this.#a(r,s,o,l),this.#r(this.bearerProfile?"Authorized":"Not authorized"),!!this.bearerProfile;if(e)return this.#r("Using refresh token to authorize"),await this.#d(r,e),this.#r(this.bearerProfile?"Authorized":"Not authorized"),!!this.bearerProfile;if(c&&y){let U=new Date;if(parseInt(y)<U.getTime())throw window.localStorage.removeItem(p),window.localStorage.removeItem(g),this.isAuthorized=false,this.bearerProfile=undefined,new Error("Access token has expired");this.#r("Access token should still be valid, checking if it is authorized...");try{return this.#i=`Bearer ${c}`,this.isAuthorized=!0,await this.getTokens(),this.#r("Authorized"),!0}catch{throw this.#r("Access token is invalid."),window.localStorage.removeItem(p),window.localStorage.removeItem(g),this.isAuthorized=false,this.bearerProfile=undefined,new Error("Access token is invalid.")}}return this.#r(this.bearerProfile?"Authorized":"Not authorized"),!!this.bearerProfile}async#o(e){let r;if(R(e))r={...e,grant_type:"authorization_code"};else if(v(e))r={...e,grant_type:"refresh_token"};else if($(e))r={...e,grant_type:"client_credentials"};else throw new Error("Authorization grant type could not be detected.");return await this.#t("post","auth/token",r,true).then(n=>{if(this.bearerProfile=n,this.isAuthorized=!!n,this.#i=`Bearer ${n?.access_token}`,!d){let i=new Date().getTime()+n?.expires_in*1e3;window.localStorage.setItem(p,n?.access_token||""),window.localStorage.setItem(g,i?.toString());}}).catch(n=>{throw d||(localStorage.removeItem(w),localStorage.removeItem(p),localStorage.removeItem(g),k()),new Error(n?.message)}),R(e)&&k(),this.bearerProfile}getAuthContext(){return this.#t("get","auth/context")}getProfile(e){return this.#t("get",`profiles/${e}`)}getProfiles(e){return this.#t("get",`profiles${m(e)}`)}getAddress(e){return this.#t("get",`addresses/${e}`)}getAddresses(e){e=C(this.#e.name,e);let r=e?f(e):undefined,n=r?`addresses?${r}`:"addresses";return this.#t("get",n)}getBalances(e,r,n){let s=Array.isArray(n)?n.map(a=>`currency=${a}`).join("&"):n?`currency=${n}`:"",i=u(this.#e.name,r);return this.#t("get",`balances/${i}/${e}${s?`?${s}`:""}`)}getIban(e){return this.#t("get",`ibans/${encodeURI(e)}`)}getIbans(e){let{profile:r,chain:n}=e||{},s=m({profile:r,chain:n?u(this.#e.name,n):""});return this.#t("get",`ibans${s}`)}getOrders(e){return this.#t("get",`orders${m(e)}`)}getOrder(e){return this.#t("get",`orders/${e}`)}getTokens(){return this.#t("get","tokens")}linkAddress(e){return e=C(this.#e.name,e),this.#t("post","addresses",JSON.stringify(e))}placeOrder(e){let r={kind:"redeem",...C(this.#e.name,e),counterpart:{...e.counterpart,identifier:C(this.#e.name,e.counterpart.identifier)}};return this.#t("post","orders",JSON.stringify(r))}moveIban(e,{address:r,chain:n}){return this.#t("patch",`ibans/${e}`,JSON.stringify({address:r,chain:u(this.#e.name,n)}))}requestIban({address:e,chain:r,emailNotifications:n=true}){return this.#t("post","ibans",JSON.stringify({address:e,chain:u(this.#e.name,r),emailNotifications:n}))}submitProfileDetails(e,r){return this.#t("put",`profiles/${e}/details`,JSON.stringify(r))}uploadSupportingDocument(e){let r=new FormData;return r.append("file",e),_(`${this.#e.api}/files`,"post",r,{Authorization:this.#i||""})}async#t(e,r,n,s){let i={Authorization:this.#i||"",Accept:"application/vnd.monerium.api-v2+json","Content-Type":`application/${s?"x-www-form-urlencoded":"json"}`};return _(`${this.#e.api}/${r}`,e.toUpperCase(),s?f(n):n,i)}#a=async(e,r,n,s)=>{let i=localStorage.getItem(w)||"";if(!i)throw new Error("Code verifier not found");return this.#r("Use code verifier to authorize"),this.state=s,localStorage.removeItem(w),await this.#o({code:n,redirect_uri:r,client_id:e,code_verifier:i})};#c=async({clientId:e,clientSecret:r})=>await this.#o({client_id:e,client_secret:r});#d=async(e,r)=>await this.#o({refresh_token:r,client_id:e});subscribeOrderNotifications({filter:e,onMessage:r,onError:n}={}){if(!this.bearerProfile?.access_token)return;let{profile:s,state:i}=e||{},a=m({access_token:this.bearerProfile?.access_token,profile:s,state:i}),o,l=E({profile:s,state:i});if(this.#s?.has(l))o=this.#s.get(l);else {let c=`${this.#e.wss}/orders${a}`;o=new WebSocket(c),this.#s?.set(l,o);}return o.onopen=()=>{console.log("Connected to WebSocket server");},o.onmessage=c=>{let y=JSON.parse(c.data);r&&r(y);},o.onclose=()=>{console.log("WebSocket connection closed"),this.#s?.delete(a);},o.onerror=c=>{n&&n(c),console.error("WebSocket error:",c);},o}unsubscribeOrderNotifications(e){if(e){let r=E({profile:e?.profile,state:e?.state}),n=this.#s?.get(r);n&&(n.close(),this.#s?.delete(r));}else this.#s?.forEach(r=>{r?.close();}),this.#s?.clear(),this.#s=undefined;}async disconnect(){d||localStorage.removeItem(w),this.unsubscribeOrderNotifications(),this.#i=undefined,this.bearerProfile=undefined;}async revokeAccess(){d||(localStorage.removeItem(p),localStorage.removeItem(g)),this.disconnect();}getEnvironment=()=>this.#e};var Te=I;export{V as AccountState,B as Currency,J as IdDocumentKind,Q as KYCOutcome,W as KYCState,M as Method,I as MoneriumClient,H as OrderKind,X as OrderState,G as PaymentStandard,K as Permission,L as ProfileState,F as ProfileType,h as constants,Te as default,O as getChain,P as parseChain,ee as placeOrderMessage,b as rfc3339,re as shortenAddress,D as shortenIban,te as siweMessage};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monerium/sdk",
3
- "version": "3.4.1",
3
+ "version": "3.4.2",
4
4
  "description": "Essential tools to interact with the Monerium API, an electronic money issuer.",
5
5
  "repository": {
6
6
  "type": "git",