@monerium/sdk 2.10.0 → 2.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.12.0](https://github.com/monerium/js-sdk/compare/sdk-v2.11.1...sdk-v2.12.0) (2024-03-12)
4
+
5
+ ### Bug Fixes
6
+
7
+ * upload document ([0f6d49d](https://github.com/monerium/js-sdk/commit/0f6d49d821afa72c4a61e94e7a3a1377357dc727))
8
+
9
+ ## [2.11.1](https://github.com/monerium/js-sdk/compare/sdk-v2.11.0...sdk-v2.11.1) (2024-03-12)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * upload document ([0f6d49d](https://github.com/monerium/js-sdk/commit/0f6d49d821afa72c4a61e94e7a3a1377357dc727))
15
+
16
+ ## [2.11.0](https://github.com/monerium/js-sdk/compare/sdk-v2.10.0...sdk-v2.11.0) (2024-02-05)
17
+
18
+
19
+ ### Features
20
+
21
+ * sepolia ([6de28cd](https://github.com/monerium/js-sdk/commit/6de28cd23be3a9130f2ecc08b47b4cdcf79991f5))
22
+
23
+
24
+ ### Bug Fixes
25
+
26
+ * sepolia ([b5fbf28](https://github.com/monerium/js-sdk/commit/b5fbf2833bf460368c11c2ab8dccad0fde92339c))
27
+ * sepolia ([a744ebc](https://github.com/monerium/js-sdk/commit/a744ebcc95a96765e54928116945b9bb2bc4f2a6))
28
+ * sepolia instead of goerli ([030b172](https://github.com/monerium/js-sdk/commit/030b17259aad5d6c4576911ea328420b8d2cfd63))
29
+
3
30
  ## [2.10.0](https://github.com/monerium/js-sdk/compare/sdk-v2.9.0...sdk-v2.10.0) (2023-12-20)
4
31
 
5
32
 
package/README.md CHANGED
@@ -40,7 +40,7 @@ yarn add @monerium/sdk
40
40
 
41
41
  | Environment | Chain | Network |
42
42
  | ----------- | -------- | ------- |
43
- | sandbox | ethereum | goerli |
43
+ | sandbox | ethereum | sepolia |
44
44
  | | polygon | mumbai |
45
45
  | | gnosis | chiado |
46
46
  | production | ethereum | mainnet |
@@ -222,7 +222,7 @@ await monerium.linkAddress(profileId, {
222
222
  message: LINK_MESSAGE
223
223
  signature,
224
224
  accounts: [
225
- {"currency":"eur","chain":"ethereum","network":"goerli"},
225
+ {"currency":"eur","chain":"ethereum","network":"sepolia"},
226
226
  {"currency":"eur","chain":"gnosis","network":"chiado"}
227
227
  ],
228
228
  } as LinkAddress);
@@ -281,7 +281,7 @@ const order = await monerium.placeOrder({
281
281
  message,
282
282
  memo: 'Powered by Monerium SDK',
283
283
  chain: 'ethereum',
284
- network: 'goerli',
284
+ network: 'sepolia',
285
285
  // supportingDocumentId, see below
286
286
  });
287
287
  ```
package/dist/client.d.ts CHANGED
@@ -9,6 +9,7 @@ export declare class MoneriumClient {
9
9
  /** The bearer profile will be available after authentication, it includes the access_token and refresh_token */
10
10
  bearerProfile?: BearerProfile;
11
11
  isAuthorized: boolean;
12
+ state: string | undefined;
12
13
  /** Constructor for no arguments, defaults to sandbox */
13
14
  constructor();
14
15
  /** Constructor with only env as an argument*/
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var X=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var w=(e,t,r)=>(X(e,t,"read from private field"),r?r.call(e):t.get(e)),R=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},I=(e,t,r,n)=>(X(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);var k=(e,t,r)=>(X(e,t,"access private method"),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var ce=(e=>(e.eur="eur",e))(ce||{}),ue=(e=>(e.corporate="corporate",e.personal="personal",e))(ue||{}),he=(e=>(e.read="read",e.write="write",e))(he||{}),fe=(e=>(e.absent="absent",e.submitted="submitted",e.pending="pending",e.confirmed="confirmed",e))(fe||{}),de=(e=>(e.approved="approved",e.rejected="rejected",e.unknown="unknown",e))(de||{}),le=(e=>(e.requested="requested",e.approved="approved",e.pending="pending",e))(le||{}),pe=(e=>(e.iban="iban",e.scan="scan",e.chain="chain",e))(pe||{}),ve=(e=>(e.redeem="redeem",e.issue="issue",e))(ve||{}),ge=(e=>(e.placed="placed",e.pending="pending",e.processed="processed",e.rejected="rejected",e))(ge||{});const te=e=>{if(e.toString()==="Invalid Date")throw e;const t=n=>n<10?"0"+n:n,r=n=>{if(n===0)return"Z";const u=n>0?"-":"+";return n=Math.abs(n),u+t(Math.floor(n/60))+":"+t(n%60)};return e.getFullYear()+"-"+t(e.getMonth()+1)+"-"+t(e.getDate())+"T"+t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())+r(e.getTimezoneOffset())},xe=(e,t,r,n)=>{const u=`${(n==null?void 0:n.toUpperCase())||"EUR"}`;return r?`Send ${u} ${e} to ${t} on ${K(r)} at ${te(new Date)}`:`Send ${u} ${e} to ${t} at ${te(new Date)}`},Z=e=>{var t;return e&&((t=Object.entries(e))==null?void 0:t.length)>0?Object.entries(e).map(([r,n])=>`${encodeURIComponent(r)}=${encodeURIComponent(n)}`).join("&"):""},K=e=>{switch(e){case 1:case 5:return"ethereum";case 100:case 10200:return"gnosis";case 137:case 80001:return"polygon";default:throw new Error(`Chain not supported: ${e}`)}},re=e=>{switch(e){case 1:case 100:case 137:return"mainnet";case 5:return"goerli";case 10200:return"chiado";case 80001:return"mumbai";default:throw new Error(`Network not supported: ${e}`)}},Q=e=>{if(e!=null&&e.chainId){const{chainId:t,...r}=e;return{...r,chain:K(t),network:re(t)}}return e},Y={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"}}},Ae="I hereby declare that I am the address owner.",M="monerium.sdk.code_verifier",D="monerium.sdk.refresh_token",Ee={LINK_MESSAGE:Ae,STORAGE_CODE_VERIFIER:M,STORAGE_REFRESH_TOKEN:D};var q=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function we(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ie(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var u=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,u.get?u:{enumerable:!0,get:function(){return e[n]}})}),r}var ye={exports:{}};function $e(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var ee={exports:{}};const Re={},Oe=Object.freeze(Object.defineProperty({__proto__:null,default:Re},Symbol.toStringTag,{value:"Module"})),Pe=Ie(Oe);var oe;function me(){return oe||(oe=1,function(e,t){(function(r,n){e.exports=n()})(q,function(){var r=r||function(n,u){var c;if(typeof window<"u"&&window.crypto&&(c=window.crypto),typeof self<"u"&&self.crypto&&(c=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(c=globalThis.crypto),!c&&typeof window<"u"&&window.msCrypto&&(c=window.msCrypto),!c&&typeof q<"u"&&q.crypto&&(c=q.crypto),!c&&typeof $e=="function")try{c=Pe}catch{}var v=function(){if(c){if(typeof c.getRandomValues=="function")try{return c.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof c.randomBytes=="function")try{return c.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},C=Object.create||function(){function o(){}return function(s){var a;return o.prototype=s,a=new o,o.prototype=null,a}}(),p={},y=p.lib={},m=y.Base=function(){return{extend:function(o){var s=C(this);return o&&s.mixIn(o),(!s.hasOwnProperty("init")||this.init===s.init)&&(s.init=function(){s.$super.init.apply(this,arguments)}),s.init.prototype=s,s.$super=this,s},create:function(){var o=this.extend();return o.init.apply(o,arguments),o},init:function(){},mixIn:function(o){for(var s in o)o.hasOwnProperty(s)&&(this[s]=o[s]);o.hasOwnProperty("toString")&&(this.toString=o.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),g=y.WordArray=m.extend({init:function(o,s){o=this.words=o||[],s!=u?this.sigBytes=s:this.sigBytes=o.length*4},toString:function(o){return(o||f).stringify(this)},concat:function(o){var s=this.words,a=o.words,h=this.sigBytes,_=o.sigBytes;if(this.clamp(),h%4)for(var S=0;S<_;S++){var B=a[S>>>2]>>>24-S%4*8&255;s[h+S>>>2]|=B<<24-(h+S)%4*8}else for(var x=0;x<_;x+=4)s[h+x>>>2]=a[x>>>2];return this.sigBytes+=_,this},clamp:function(){var o=this.words,s=this.sigBytes;o[s>>>2]&=4294967295<<32-s%4*8,o.length=n.ceil(s/4)},clone:function(){var o=m.clone.call(this);return o.words=this.words.slice(0),o},random:function(o){for(var s=[],a=0;a<o;a+=4)s.push(v());return new g.init(s,o)}}),b=p.enc={},f=b.Hex={stringify:function(o){for(var s=o.words,a=o.sigBytes,h=[],_=0;_<a;_++){var S=s[_>>>2]>>>24-_%4*8&255;h.push((S>>>4).toString(16)),h.push((S&15).toString(16))}return h.join("")},parse:function(o){for(var s=o.length,a=[],h=0;h<s;h+=2)a[h>>>3]|=parseInt(o.substr(h,2),16)<<24-h%8*4;return new g.init(a,s/2)}},l=b.Latin1={stringify:function(o){for(var s=o.words,a=o.sigBytes,h=[],_=0;_<a;_++){var S=s[_>>>2]>>>24-_%4*8&255;h.push(String.fromCharCode(S))}return h.join("")},parse:function(o){for(var s=o.length,a=[],h=0;h<s;h++)a[h>>>2]|=(o.charCodeAt(h)&255)<<24-h%4*8;return new g.init(a,s)}},i=b.Utf8={stringify:function(o){try{return decodeURIComponent(escape(l.stringify(o)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(o){return l.parse(unescape(encodeURIComponent(o)))}},d=y.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new g.init,this._nDataBytes=0},_append:function(o){typeof o=="string"&&(o=i.parse(o)),this._data.concat(o),this._nDataBytes+=o.sigBytes},_process:function(o){var s,a=this._data,h=a.words,_=a.sigBytes,S=this.blockSize,B=S*4,x=_/B;o?x=n.ceil(x):x=n.max((x|0)-this._minBufferSize,0);var N=x*S,U=n.min(N*4,_);if(N){for(var W=0;W<N;W+=S)this._doProcessBlock(h,W);s=h.splice(0,N),a.sigBytes-=U}return new g.init(s,U)},clone:function(){var o=m.clone.call(this);return o._data=this._data.clone(),o},_minBufferSize:0});y.Hasher=d.extend({cfg:m.extend(),init:function(o){this.cfg=this.cfg.extend(o),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(o){return this._append(o),this._process(),this},finalize:function(o){o&&this._append(o);var s=this._doFinalize();return s},blockSize:16,_createHelper:function(o){return function(s,a){return new o.init(a).finalize(s)}},_createHmacHelper:function(o){return function(s,a){return new A.HMAC.init(o,a).finalize(s)}}});var A=p.algo={};return p}(Math);return r})}(ee)),ee.exports}(function(e,t){(function(r,n){e.exports=n(me())})(q,function(r){return function(){var n=r,u=n.lib,c=u.WordArray,v=n.enc;v.Base64url={stringify:function(p,y){y===void 0&&(y=!0);var m=p.words,g=p.sigBytes,b=y?this._safe_map:this._map;p.clamp();for(var f=[],l=0;l<g;l+=3)for(var i=m[l>>>2]>>>24-l%4*8&255,d=m[l+1>>>2]>>>24-(l+1)%4*8&255,A=m[l+2>>>2]>>>24-(l+2)%4*8&255,o=i<<16|d<<8|A,s=0;s<4&&l+s*.75<g;s++)f.push(b.charAt(o>>>6*(3-s)&63));var a=b.charAt(64);if(a)for(;f.length%4;)f.push(a);return f.join("")},parse:function(p,y){y===void 0&&(y=!0);var m=p.length,g=y?this._safe_map:this._map,b=this._reverseMap;if(!b){b=this._reverseMap=[];for(var f=0;f<g.length;f++)b[g.charCodeAt(f)]=f}var l=g.charAt(64);if(l){var i=p.indexOf(l);i!==-1&&(m=i)}return C(p,m,b)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function C(p,y,m){for(var g=[],b=0,f=0;f<y;f++)if(f%4){var l=m[p.charCodeAt(f-1)]<<f%4*2,i=m[p.charCodeAt(f)]>>>6-f%4*2,d=l|i;g[b>>>2]|=d<<24-b%4*8,b++}return c.create(g,b)}}(),r.enc.Base64url})})(ye);var ze=ye.exports;const Ue=we(ze);var _e={exports:{}};(function(e,t){(function(r,n){e.exports=n(me())})(q,function(r){return function(n){var u=r,c=u.lib,v=c.WordArray,C=c.Hasher,p=u.algo,y=[],m=[];(function(){function f(A){for(var o=n.sqrt(A),s=2;s<=o;s++)if(!(A%s))return!1;return!0}function l(A){return(A-(A|0))*4294967296|0}for(var i=2,d=0;d<64;)f(i)&&(d<8&&(y[d]=l(n.pow(i,1/2))),m[d]=l(n.pow(i,1/3)),d++),i++})();var g=[],b=p.SHA256=C.extend({_doReset:function(){this._hash=new v.init(y.slice(0))},_doProcessBlock:function(f,l){for(var i=this._hash.words,d=i[0],A=i[1],o=i[2],s=i[3],a=i[4],h=i[5],_=i[6],S=i[7],B=0;B<64;B++){if(B<16)g[B]=f[l+B]|0;else{var x=g[B-15],N=(x<<25|x>>>7)^(x<<14|x>>>18)^x>>>3,U=g[B-2],W=(U<<15|U>>>17)^(U<<13|U>>>19)^U>>>10;g[B]=N+g[B-7]+W+g[B-16]}var be=a&h^~a&_,Se=d&A^d&o^A&o,Ce=(d<<30|d>>>2)^(d<<19|d>>>13)^(d<<10|d>>>22),ke=(a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25),ne=S+ke+be+m[B]+g[B],Be=Ce+Se;S=_,_=h,h=a,a=s+ne|0,s=o,o=A,A=d,d=ne+Be|0}i[0]=i[0]+d|0,i[1]=i[1]+A|0,i[2]=i[2]+o|0,i[3]=i[3]+s|0,i[4]=i[4]+a|0,i[5]=i[5]+h|0,i[6]=i[6]+_|0,i[7]=i[7]+S|0},_doFinalize:function(){var f=this._data,l=f.words,i=this._nDataBytes*8,d=f.sigBytes*8;return l[d>>>5]|=128<<24-d%32,l[(d+64>>>9<<4)+14]=n.floor(i/4294967296),l[(d+64>>>9<<4)+15]=i,f.sigBytes=l.length*4,this._process(),this._hash},clone:function(){var f=C.clone.call(this);return f._hash=this._hash.clone(),f}});u.SHA256=C._createHelper(b),u.HmacSHA256=C._createHmacHelper(b)}(Math),r.SHA256})})(_e);var He=_e.exports;const Te=we(He),Me=(e,t)=>{const{client_id:r,redirect_uri:n,scope:u,state:c,chainId:v,chain:C,network:p,address:y,signature:m}=e,g=y?{address:y,...m!==void 0?{signature:m}:{},...v!==void 0||C!==void 0?{chain:v?K(v):C}:{},...v!==void 0||p!==void 0?{network:v?re(v):p}:{}}:{};return Z({client_id:r,redirect_uri:n,...u!==void 0?{scope:u}:{},...c!==void 0?{state:c}:{},code_challenge:t,code_challenge_method:"S256",response_type:"code",...g})},Le=()=>{let e="";const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=t.length;let n=0;for(;n<128;)e+=t.charAt(Math.floor(Math.random()*r)),n+=1;return e},Ne=e=>Ue.stringify(Te(e)),se=(e,t)=>{const r=Le(),n=Ne(r);return localStorage.setItem(M,r||""),`${e}/auth?${Me(t,n)}`},ie=()=>{const e=window.location.href;if(!e||!(e!=null&&e.includes("?")))return;const[t,r]=e.split("?");r&&window.history.replaceState(null,"",t)},ae=e=>e.code!=null,je=e=>e.refresh_token!=null,qe=e=>e.client_secret!=null,Fe=async(e,t,r,n)=>{const u=await fetch(`${e}`,{method:t,headers:n,body:r});let c;const v=await u.text();try{c=JSON.parse(v)}catch{throw v}if(!u.ok)throw c;return c},T=typeof window>"u";var O,F,L,z,P,H,j,E,$,V,G,J;class We{constructor(t){R(this,H);R(this,E);R(this,O,void 0);R(this,F,void 0);R(this,L,void 0);R(this,z,void 0);R(this,P,void 0);R(this,V,void 0);R(this,G,void 0);R(this,J,void 0);if(I(this,z,new Map),this.isAuthorized=!!this.bearerProfile,I(this,V,async(r,n,u)=>{const c=localStorage.getItem(M)||"";if(!c)throw new Error("Code verifier not found");return this.codeVerifier=c,localStorage.removeItem(M),await k(this,H,j).call(this,{code:u,redirect_uri:n,client_id:r,code_verifier:c})}),I(this,G,async({clientId:r,clientSecret:n})=>await k(this,H,j).call(this,{client_id:r,client_secret:n})),I(this,J,async(r,n)=>await k(this,H,j).call(this,{refresh_token:n,client_id:r})),this.subscribeToOrderNotifications=()=>{var u,c;const r=`${w(this,O).wss}/profiles/${(u=this.bearerProfile)==null?void 0:u.profile}/orders?access_token=${(c=this.bearerProfile)==null?void 0:c.access_token}`,n=new WebSocket(r);return n.addEventListener("open",()=>{console.info(`Socket connected: ${r}`)}),n.addEventListener("error",v=>{throw console.error(v),new Error(`Socket error: ${r}`)}),n.addEventListener("message",v=>{var p;const C=JSON.parse(v.data);(p=w(this,z).get(C.meta.state))==null||p(C)}),n.addEventListener("close",()=>{console.info(`Socket connection closed: ${r}`)}),n},this.auth=async r=>await k(this,H,j).call(this,r),this.connect=async r=>await k(this,H,j).call(this,r),this.getAuthFlowURI=r=>{const n=se(w(this,O).api,r);return this.codeVerifier=localStorage.getItem(M),n},this.pkceRequest=r=>this.getAuthFlowURI(r),this.getEnvironment=()=>w(this,O),!t){I(this,O,Y.environments.sandbox);return}if(typeof t=="string")I(this,O,Y.environments[t]);else if(I(this,O,Y.environments[t.environment||"sandbox"]),T){const{clientId:r,clientSecret:n}=t;I(this,P,{clientId:r,clientSecret:n})}else{const{clientId:r,redirectUrl:n}=t;I(this,P,{clientId:r,redirectUrl:n})}}async authorize(t){var c,v;const r=(t==null?void 0:t.clientId)||((c=w(this,P))==null?void 0:c.clientId),n=(t==null?void 0:t.redirectUrl)||((v=w(this,P))==null?void 0:v.redirectUrl);if(!r)throw new Error("Missing ClientId");if(!n)throw new Error("Missing RedirectUrl");const u=se(w(this,O).api,{client_id:r,redirect_uri:n,address:t==null?void 0:t.address,signature:t==null?void 0:t.signature,chainId:t==null?void 0:t.chainId});window.location.replace(u)}async getAccess(t){var C,p,y;const r=(t==null?void 0:t.clientId)||((C=w(this,P))==null?void 0:C.clientId);if((t==null?void 0:t.clientSecret)||((p=w(this,P))==null?void 0:p.clientSecret)){if(!T)throw new Error("Only use client credentials on server side");return await w(this,G).call(this,w(this,P)),!!this.bearerProfile}const u=(t==null?void 0:t.redirectUrl)||((y=w(this,P))==null?void 0:y.redirectUrl);if(!r)throw new Error("Missing ClientId");if(T)throw new Error("This only works client side");const c=new URLSearchParams(window.location.search).get("code")||void 0,v=localStorage.getItem(D)||void 0;return v?await w(this,J).call(this,r,v):c&&await w(this,V).call(this,r,u,c),!!this.bearerProfile}getAuthContext(){return k(this,E,$).call(this,"get","auth/context")}getProfile(t){return k(this,E,$).call(this,"get",`profiles/${t}`)}getBalances(t){return t?k(this,E,$).call(this,"get",`profiles/${t}/balances`):k(this,E,$).call(this,"get","balances")}getOrders(t){const r=Z(t);return k(this,E,$).call(this,"get",`orders?${r}`)}getOrder(t){return k(this,E,$).call(this,"get",`orders/${t}`)}getTokens(){return k(this,E,$).call(this,"get","tokens")}linkAddress(t,r){return r=Q(r),r.accounts=r.accounts.map(n=>Q(n)),k(this,E,$).call(this,"post",`profiles/${t}/addresses`,JSON.stringify(r))}placeOrder(t,r){const n={kind:"redeem",currency:"eur",...Q(t),counterpart:{...t.counterpart,identifier:Q(t.counterpart.identifier)}};return r?k(this,E,$).call(this,"post",`profiles/${r}/orders`,JSON.stringify(n)):k(this,E,$).call(this,"post","orders",JSON.stringify(n))}uploadSupportingDocument(t){const r=Z(t);return k(this,E,$).call(this,"post","files/supporting-document",r,!0)}async connectOrderSocket(){var t;(t=this.bearerProfile)!=null&&t.access_token&&w(this,z).size>0&&I(this,L,this.subscribeToOrderNotifications())}async disconnect(){var t;T||localStorage.removeItem(M),w(this,z).clear(),(t=w(this,L))==null||t.close(),I(this,F,void 0),this.bearerProfile=void 0}async revokeAccess(){T||localStorage.removeItem(D),this.disconnect()}subscribeOrders(t,r){w(this,z).set(t,r)}unsubscribeOrders(t){var r;w(this,z).delete(t),w(this,z).size===0&&((r=w(this,L))==null||r.close(),I(this,L,void 0))}}O=new WeakMap,F=new WeakMap,L=new WeakMap,z=new WeakMap,P=new WeakMap,H=new WeakSet,j=async function(t){let r;if(ae(t))r={...t,grant_type:"authorization_code"};else if(je(t))r={...t,grant_type:"refresh_token"};else if(qe(t))r={...t,grant_type:"client_credentials"};else throw new Error("Authorization grant type could not be detected.");return await k(this,E,$).call(this,"post","auth/token",r,!0).then(n=>{var u;this.bearerProfile=n,this.isAuthorized=!!n,I(this,F,`Bearer ${n==null?void 0:n.access_token}`),T||window.localStorage.setItem(D,((u=this.bearerProfile)==null?void 0:u.refresh_token)||"")}).catch(n=>{throw T||(localStorage.removeItem(M),localStorage.removeItem(D),ie()),new Error(n==null?void 0:n.message)}),ae(t)&&ie(),this.bearerProfile},E=new WeakSet,$=async function(t,r,n,u){return Fe(`${w(this,O).api}/${r}`,t,u?Z(n):n,{Authorization:w(this,F)||"","Content-Type":`application/${u?"x-www-form-urlencoded":"json"}`})},V=new WeakMap,G=new WeakMap,J=new WeakMap;exports.AccountState=le;exports.Currency=ce;exports.KYCOutcome=de;exports.KYCState=fe;exports.MoneriumClient=We;exports.OrderKind=ve;exports.OrderState=ge;exports.PaymentStandard=pe;exports.Permission=he;exports.ProfileType=ue;exports.constants=Ee;exports.getChain=K;exports.getNetwork=re;exports.placeOrderMessage=xe;exports.rfc3339=te;
1
+ "use strict";var K=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var g=(e,t,r)=>(K(e,t,"read from private field"),r?r.call(e):t.get(e)),O=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},E=(e,t,r,n)=>(K(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);var k=(e,t,r)=>(K(e,t,"access private method"),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var ue=(e=>(e.eur="eur",e))(ue||{}),he=(e=>(e.corporate="corporate",e.personal="personal",e))(he||{}),fe=(e=>(e.read="read",e.write="write",e))(fe||{}),de=(e=>(e.absent="absent",e.submitted="submitted",e.pending="pending",e.confirmed="confirmed",e))(de||{}),le=(e=>(e.approved="approved",e.rejected="rejected",e.unknown="unknown",e))(le||{}),pe=(e=>(e.requested="requested",e.approved="approved",e.pending="pending",e))(pe||{}),ve=(e=>(e.iban="iban",e.scan="scan",e.chain="chain",e))(ve||{}),ge=(e=>(e.redeem="redeem",e.issue="issue",e))(ge||{}),we=(e=>(e.placed="placed",e.pending="pending",e.processed="processed",e.rejected="rejected",e))(we||{});const ee=e=>{if(e.toString()==="Invalid Date")throw e;const t=n=>n<10?"0"+n:n,r=n=>{if(n===0)return"Z";const c=n>0?"-":"+";return n=Math.abs(n),c+t(Math.floor(n/60))+":"+t(n%60)};return e.getFullYear()+"-"+t(e.getMonth()+1)+"-"+t(e.getDate())+"T"+t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())+r(e.getTimezoneOffset())},Ae=(e,t,r,n)=>{const c=`${(n==null?void 0:n.toUpperCase())||"EUR"}`;return r?`Send ${c} ${e} to ${t} on ${Z(r)} at ${ee(new Date)}`:`Send ${c} ${e} to ${t} at ${ee(new Date)}`},te=e=>{var t;return e&&((t=Object.entries(e))==null?void 0:t.length)>0?Object.entries(e).map(([r,n])=>`${encodeURIComponent(r)}=${encodeURIComponent(n)}`).join("&"):""},Z=e=>{switch(e){case 1:case 11155111:return"ethereum";case 100:case 10200:return"gnosis";case 137:case 80001:return"polygon";default:throw new Error(`Chain not supported: ${e}`)}},re=e=>{switch(e){case 1:case 100:case 137:return"mainnet";case 11155111:return"sepolia";case 10200:return"chiado";case 80001:return"mumbai";default:throw new Error(`Network not supported: ${e}`)}},Q=e=>{if(e!=null&&e.chainId){const{chainId:t,...r}=e;return{...r,chain:Z(t),network:re(t)}}return e},X={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"}}},Ee="I hereby declare that I am the address owner.",M="monerium.sdk.code_verifier",W="monerium.sdk.refresh_token",Ie={LINK_MESSAGE:Ee,STORAGE_CODE_VERIFIER:M,STORAGE_REFRESH_TOKEN:W};var q=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ye(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function $e(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var c=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,c.get?c:{enumerable:!0,get:function(){return e[n]}})}),r}var me={exports:{}};function Re(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Y={exports:{}};const Oe={},Pe=Object.freeze(Object.defineProperty({__proto__:null,default:Oe},Symbol.toStringTag,{value:"Module"})),ze=$e(Pe);var oe;function _e(){return oe||(oe=1,function(e,t){(function(r,n){e.exports=n()})(q,function(){var r=r||function(n,c){var u;if(typeof window<"u"&&window.crypto&&(u=window.crypto),typeof self<"u"&&self.crypto&&(u=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(u=globalThis.crypto),!u&&typeof window<"u"&&window.msCrypto&&(u=window.msCrypto),!u&&typeof q<"u"&&q.crypto&&(u=q.crypto),!u&&typeof Re=="function")try{u=ze}catch{}var l=function(){if(u){if(typeof u.getRandomValues=="function")try{return u.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof u.randomBytes=="function")try{return u.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},C=Object.create||function(){function o(){}return function(s){var a;return o.prototype=s,a=new o,o.prototype=null,a}}(),v={},m=v.lib={},y=m.Base=function(){return{extend:function(o){var s=C(this);return o&&s.mixIn(o),(!s.hasOwnProperty("init")||this.init===s.init)&&(s.init=function(){s.$super.init.apply(this,arguments)}),s.init.prototype=s,s.$super=this,s},create:function(){var o=this.extend();return o.init.apply(o,arguments),o},init:function(){},mixIn:function(o){for(var s in o)o.hasOwnProperty(s)&&(this[s]=o[s]);o.hasOwnProperty("toString")&&(this.toString=o.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),w=m.WordArray=y.extend({init:function(o,s){o=this.words=o||[],s!=c?this.sigBytes=s:this.sigBytes=o.length*4},toString:function(o){return(o||f).stringify(this)},concat:function(o){var s=this.words,a=o.words,h=this.sigBytes,_=o.sigBytes;if(this.clamp(),h%4)for(var S=0;S<_;S++){var B=a[S>>>2]>>>24-S%4*8&255;s[h+S>>>2]|=B<<24-(h+S)%4*8}else for(var x=0;x<_;x+=4)s[h+x>>>2]=a[x>>>2];return this.sigBytes+=_,this},clamp:function(){var o=this.words,s=this.sigBytes;o[s>>>2]&=4294967295<<32-s%4*8,o.length=n.ceil(s/4)},clone:function(){var o=y.clone.call(this);return o.words=this.words.slice(0),o},random:function(o){for(var s=[],a=0;a<o;a+=4)s.push(l());return new w.init(s,o)}}),b=v.enc={},f=b.Hex={stringify:function(o){for(var s=o.words,a=o.sigBytes,h=[],_=0;_<a;_++){var S=s[_>>>2]>>>24-_%4*8&255;h.push((S>>>4).toString(16)),h.push((S&15).toString(16))}return h.join("")},parse:function(o){for(var s=o.length,a=[],h=0;h<s;h+=2)a[h>>>3]|=parseInt(o.substr(h,2),16)<<24-h%8*4;return new w.init(a,s/2)}},p=b.Latin1={stringify:function(o){for(var s=o.words,a=o.sigBytes,h=[],_=0;_<a;_++){var S=s[_>>>2]>>>24-_%4*8&255;h.push(String.fromCharCode(S))}return h.join("")},parse:function(o){for(var s=o.length,a=[],h=0;h<s;h++)a[h>>>2]|=(o.charCodeAt(h)&255)<<24-h%4*8;return new w.init(a,s)}},i=b.Utf8={stringify:function(o){try{return decodeURIComponent(escape(p.stringify(o)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(o){return p.parse(unescape(encodeURIComponent(o)))}},d=m.BufferedBlockAlgorithm=y.extend({reset:function(){this._data=new w.init,this._nDataBytes=0},_append:function(o){typeof o=="string"&&(o=i.parse(o)),this._data.concat(o),this._nDataBytes+=o.sigBytes},_process:function(o){var s,a=this._data,h=a.words,_=a.sigBytes,S=this.blockSize,B=S*4,x=_/B;o?x=n.ceil(x):x=n.max((x|0)-this._minBufferSize,0);var j=x*S,U=n.min(j*4,_);if(j){for(var D=0;D<j;D+=S)this._doProcessBlock(h,D);s=h.splice(0,j),a.sigBytes-=U}return new w.init(s,U)},clone:function(){var o=y.clone.call(this);return o._data=this._data.clone(),o},_minBufferSize:0});m.Hasher=d.extend({cfg:y.extend(),init:function(o){this.cfg=this.cfg.extend(o),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(o){return this._append(o),this._process(),this},finalize:function(o){o&&this._append(o);var s=this._doFinalize();return s},blockSize:16,_createHelper:function(o){return function(s,a){return new o.init(a).finalize(s)}},_createHmacHelper:function(o){return function(s,a){return new A.HMAC.init(o,a).finalize(s)}}});var A=v.algo={};return v}(Math);return r})}(Y)),Y.exports}(function(e,t){(function(r,n){e.exports=n(_e())})(q,function(r){return function(){var n=r,c=n.lib,u=c.WordArray,l=n.enc;l.Base64url={stringify:function(v,m){m===void 0&&(m=!0);var y=v.words,w=v.sigBytes,b=m?this._safe_map:this._map;v.clamp();for(var f=[],p=0;p<w;p+=3)for(var i=y[p>>>2]>>>24-p%4*8&255,d=y[p+1>>>2]>>>24-(p+1)%4*8&255,A=y[p+2>>>2]>>>24-(p+2)%4*8&255,o=i<<16|d<<8|A,s=0;s<4&&p+s*.75<w;s++)f.push(b.charAt(o>>>6*(3-s)&63));var a=b.charAt(64);if(a)for(;f.length%4;)f.push(a);return f.join("")},parse:function(v,m){m===void 0&&(m=!0);var y=v.length,w=m?this._safe_map:this._map,b=this._reverseMap;if(!b){b=this._reverseMap=[];for(var f=0;f<w.length;f++)b[w.charCodeAt(f)]=f}var p=w.charAt(64);if(p){var i=v.indexOf(p);i!==-1&&(y=i)}return C(v,y,b)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function C(v,m,y){for(var w=[],b=0,f=0;f<m;f++)if(f%4){var p=y[v.charCodeAt(f-1)]<<f%4*2,i=y[v.charCodeAt(f)]>>>6-f%4*2,d=p|i;w[b>>>2]|=d<<24-b%4*8,b++}return u.create(w,b)}}(),r.enc.Base64url})})(me);var Ue=me.exports;const He=ye(Ue);var be={exports:{}};(function(e,t){(function(r,n){e.exports=n(_e())})(q,function(r){return function(n){var c=r,u=c.lib,l=u.WordArray,C=u.Hasher,v=c.algo,m=[],y=[];(function(){function f(A){for(var o=n.sqrt(A),s=2;s<=o;s++)if(!(A%s))return!1;return!0}function p(A){return(A-(A|0))*4294967296|0}for(var i=2,d=0;d<64;)f(i)&&(d<8&&(m[d]=p(n.pow(i,1/2))),y[d]=p(n.pow(i,1/3)),d++),i++})();var w=[],b=v.SHA256=C.extend({_doReset:function(){this._hash=new l.init(m.slice(0))},_doProcessBlock:function(f,p){for(var i=this._hash.words,d=i[0],A=i[1],o=i[2],s=i[3],a=i[4],h=i[5],_=i[6],S=i[7],B=0;B<64;B++){if(B<16)w[B]=f[p+B]|0;else{var x=w[B-15],j=(x<<25|x>>>7)^(x<<14|x>>>18)^x>>>3,U=w[B-2],D=(U<<15|U>>>17)^(U<<13|U>>>19)^U>>>10;w[B]=j+w[B-7]+D+w[B-16]}var Se=a&h^~a&_,Ce=d&A^d&o^A&o,ke=(d<<30|d>>>2)^(d<<19|d>>>13)^(d<<10|d>>>22),Be=(a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25),ne=S+Be+Se+y[B]+w[B],xe=ke+Ce;S=_,_=h,h=a,a=s+ne|0,s=o,o=A,A=d,d=ne+xe|0}i[0]=i[0]+d|0,i[1]=i[1]+A|0,i[2]=i[2]+o|0,i[3]=i[3]+s|0,i[4]=i[4]+a|0,i[5]=i[5]+h|0,i[6]=i[6]+_|0,i[7]=i[7]+S|0},_doFinalize:function(){var f=this._data,p=f.words,i=this._nDataBytes*8,d=f.sigBytes*8;return p[d>>>5]|=128<<24-d%32,p[(d+64>>>9<<4)+14]=n.floor(i/4294967296),p[(d+64>>>9<<4)+15]=i,f.sigBytes=p.length*4,this._process(),this._hash},clone:function(){var f=C.clone.call(this);return f._hash=this._hash.clone(),f}});c.SHA256=C._createHelper(b),c.HmacSHA256=C._createHmacHelper(b)}(Math),r.SHA256})})(be);var Te=be.exports;const Me=ye(Te),Le=(e,t)=>{const{client_id:r,redirect_uri:n,scope:c,state:u,chainId:l,chain:C,network:v,address:m,signature:y}=e,w=m?{address:m,...y!==void 0?{signature:y}:{},...l!==void 0||C!==void 0?{chain:l?Z(l):C}:{},...l!==void 0||v!==void 0?{network:l?re(l):v}:{}}:{};return te({client_id:r,redirect_uri:n,...c!==void 0?{scope:c}:{},...u!==void 0?{state:u}:{},code_challenge:t,code_challenge_method:"S256",response_type:"code",...w})},Ne=()=>{let e="";const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=t.length;let n=0;for(;n<128;)e+=t.charAt(Math.floor(Math.random()*r)),n+=1;return e},je=e=>He.stringify(Me(e)),se=(e,t)=>{const r=Ne(),n=je(r);return localStorage.setItem(M,r||""),`${e}/auth?${Le(t,n)}`},ie=()=>{const e=window.location.href;if(!e||!(e!=null&&e.includes("?")))return;const[t,r]=e.split("?");r&&window.history.replaceState(null,"",t)},ae=e=>e.code!=null,Fe=e=>e.refresh_token!=null,qe=e=>e.client_secret!=null,ce=async(e,t,r,n)=>{const c=await fetch(`${e}`,{method:t,headers:n,body:r});let u;const l=await c.text();try{u=JSON.parse(l)}catch{throw l}if(!c.ok)throw u;return u},T=typeof window>"u";var R,L,N,z,P,H,F,I,$,V,G,J;class De{constructor(t){O(this,H);O(this,I);O(this,R,void 0);O(this,L,void 0);O(this,N,void 0);O(this,z,void 0);O(this,P,void 0);O(this,V,void 0);O(this,G,void 0);O(this,J,void 0);if(E(this,z,new Map),this.isAuthorized=!!this.bearerProfile,E(this,V,async(r,n,c,u)=>{const l=localStorage.getItem(M)||"";if(!l)throw new Error("Code verifier not found");return this.codeVerifier=l,this.state=u,localStorage.removeItem(M),await k(this,H,F).call(this,{code:c,redirect_uri:n,client_id:r,code_verifier:l})}),E(this,G,async({clientId:r,clientSecret:n})=>await k(this,H,F).call(this,{client_id:r,client_secret:n})),E(this,J,async(r,n)=>await k(this,H,F).call(this,{refresh_token:n,client_id:r})),this.subscribeToOrderNotifications=()=>{var c,u;const r=`${g(this,R).wss}/profiles/${(c=this.bearerProfile)==null?void 0:c.profile}/orders?access_token=${(u=this.bearerProfile)==null?void 0:u.access_token}`,n=new WebSocket(r);return n.addEventListener("open",()=>{console.info(`Socket connected: ${r}`)}),n.addEventListener("error",l=>{throw console.error(l),new Error(`Socket error: ${r}`)}),n.addEventListener("message",l=>{var v;const C=JSON.parse(l.data);(v=g(this,z).get(C.meta.state))==null||v(C)}),n.addEventListener("close",()=>{console.info(`Socket connection closed: ${r}`)}),n},this.auth=async r=>await k(this,H,F).call(this,r),this.connect=async r=>await k(this,H,F).call(this,r),this.getAuthFlowURI=r=>{const n=se(g(this,R).api,r);return this.codeVerifier=localStorage.getItem(M),n},this.pkceRequest=r=>this.getAuthFlowURI(r),this.getEnvironment=()=>g(this,R),!t){E(this,R,X.environments.sandbox);return}if(typeof t=="string")E(this,R,X.environments[t]);else if(E(this,R,X.environments[t.environment||"sandbox"]),T){const{clientId:r,clientSecret:n}=t;E(this,P,{clientId:r,clientSecret:n})}else{const{clientId:r,redirectUrl:n}=t;E(this,P,{clientId:r,redirectUrl:n})}}async authorize(t){var u,l;const r=(t==null?void 0:t.clientId)||((u=g(this,P))==null?void 0:u.clientId),n=(t==null?void 0:t.redirectUrl)||((l=g(this,P))==null?void 0:l.redirectUrl);if(!r)throw new Error("Missing ClientId");if(!n)throw new Error("Missing RedirectUrl");const c=se(g(this,R).api,{client_id:r,redirect_uri:n,address:t==null?void 0:t.address,signature:t==null?void 0:t.signature,chainId:t==null?void 0:t.chainId,state:t==null?void 0:t.state});window.location.replace(c)}async getAccess(t){var v,m,y;const r=(t==null?void 0:t.clientId)||((v=g(this,P))==null?void 0:v.clientId);if((t==null?void 0:t.clientSecret)||((m=g(this,P))==null?void 0:m.clientSecret)){if(!T)throw new Error("Only use client credentials on server side");return await g(this,G).call(this,g(this,P)),!!this.bearerProfile}const c=(t==null?void 0:t.redirectUrl)||((y=g(this,P))==null?void 0:y.redirectUrl);if(!r)throw new Error("Missing ClientId");if(T)throw new Error("This only works client side");const u=new URLSearchParams(window.location.search).get("code")||void 0,l=new URLSearchParams(window.location.search).get("state")||void 0,C=localStorage.getItem(W)||void 0;return C?await g(this,J).call(this,r,C):u&&await g(this,V).call(this,r,c,u,l),!!this.bearerProfile}getAuthContext(){return k(this,I,$).call(this,"get","auth/context")}getProfile(t){return k(this,I,$).call(this,"get",`profiles/${t}`)}getBalances(t){return t?k(this,I,$).call(this,"get",`profiles/${t}/balances`):k(this,I,$).call(this,"get","balances")}getOrders(t){const r=te(t);return k(this,I,$).call(this,"get",`orders?${r}`)}getOrder(t){return k(this,I,$).call(this,"get",`orders/${t}`)}getTokens(){return k(this,I,$).call(this,"get","tokens")}linkAddress(t,r){return r=Q(r),r.accounts=r.accounts.map(n=>Q(n)),k(this,I,$).call(this,"post",`profiles/${t}/addresses`,JSON.stringify(r))}placeOrder(t,r){const n={kind:"redeem",currency:"eur",...Q(t),counterpart:{...t.counterpart,identifier:Q(t.counterpart.identifier)}};return r?k(this,I,$).call(this,"post",`profiles/${r}/orders`,JSON.stringify(n)):k(this,I,$).call(this,"post","orders",JSON.stringify(n))}uploadSupportingDocument(t){const r=new FormData;return r.append("file",t),ce(`${g(this,R).api}/files`,"post",r,{Authorization:g(this,L)||""})}async connectOrderSocket(){var t;(t=this.bearerProfile)!=null&&t.access_token&&g(this,z).size>0&&E(this,N,this.subscribeToOrderNotifications())}async disconnect(){var t;T||localStorage.removeItem(M),g(this,z).clear(),(t=g(this,N))==null||t.close(),E(this,L,void 0),this.bearerProfile=void 0}async revokeAccess(){T||localStorage.removeItem(W),this.disconnect()}subscribeOrders(t,r){g(this,z).set(t,r)}unsubscribeOrders(t){var r;g(this,z).delete(t),g(this,z).size===0&&((r=g(this,N))==null||r.close(),E(this,N,void 0))}}R=new WeakMap,L=new WeakMap,N=new WeakMap,z=new WeakMap,P=new WeakMap,H=new WeakSet,F=async function(t){let r;if(ae(t))r={...t,grant_type:"authorization_code"};else if(Fe(t))r={...t,grant_type:"refresh_token"};else if(qe(t))r={...t,grant_type:"client_credentials"};else throw new Error("Authorization grant type could not be detected.");return await k(this,I,$).call(this,"post","auth/token",r,!0).then(n=>{var c;this.bearerProfile=n,this.isAuthorized=!!n,E(this,L,`Bearer ${n==null?void 0:n.access_token}`),T||window.localStorage.setItem(W,((c=this.bearerProfile)==null?void 0:c.refresh_token)||"")}).catch(n=>{throw T||(localStorage.removeItem(M),localStorage.removeItem(W),ie()),new Error(n==null?void 0:n.message)}),ae(t)&&ie(),this.bearerProfile},I=new WeakSet,$=async function(t,r,n,c){return ce(`${g(this,R).api}/${r}`,t,c?te(n):n,{Authorization:g(this,L)||"","Content-Type":`application/${c?"x-www-form-urlencoded":"json"}`})},V=new WeakMap,G=new WeakMap,J=new WeakMap;exports.AccountState=pe;exports.Currency=ue;exports.KYCOutcome=le;exports.KYCState=de;exports.MoneriumClient=De;exports.OrderKind=ge;exports.OrderState=we;exports.PaymentStandard=ve;exports.Permission=fe;exports.ProfileType=he;exports.constants=Ie;exports.getChain=Z;exports.getNetwork=re;exports.placeOrderMessage=Ae;exports.rfc3339=ee;
package/dist/index.mjs CHANGED
@@ -1,30 +1,30 @@
1
- var X = (e, t, r) => {
1
+ var Z = (e, t, r) => {
2
2
  if (!t.has(e))
3
3
  throw TypeError("Cannot " + r);
4
4
  };
5
- var w = (e, t, r) => (X(e, t, "read from private field"), r ? r.call(e) : t.get(e)), R = (e, t, r) => {
5
+ var g = (e, t, r) => (Z(e, t, "read from private field"), r ? r.call(e) : t.get(e)), z = (e, t, r) => {
6
6
  if (t.has(e))
7
7
  throw TypeError("Cannot add the same private member more than once");
8
8
  t instanceof WeakSet ? t.add(e) : t.set(e, r);
9
- }, I = (e, t, r, n) => (X(e, t, "write to private field"), n ? n.call(e, r) : t.set(e, r), r);
10
- var k = (e, t, r) => (X(e, t, "access private method"), r);
11
- var we = /* @__PURE__ */ ((e) => (e.eur = "eur", e))(we || {}), ye = /* @__PURE__ */ ((e) => (e.corporate = "corporate", e.personal = "personal", e))(ye || {}), me = /* @__PURE__ */ ((e) => (e.read = "read", e.write = "write", e))(me || {}), _e = /* @__PURE__ */ ((e) => (e.absent = "absent", e.submitted = "submitted", e.pending = "pending", e.confirmed = "confirmed", e))(_e || {}), be = /* @__PURE__ */ ((e) => (e.approved = "approved", e.rejected = "rejected", e.unknown = "unknown", e))(be || {}), Se = /* @__PURE__ */ ((e) => (e.requested = "requested", e.approved = "approved", e.pending = "pending", e))(Se || {}), Be = /* @__PURE__ */ ((e) => (e.iban = "iban", e.scan = "scan", e.chain = "chain", e))(Be || {}), ke = /* @__PURE__ */ ((e) => (e.redeem = "redeem", e.issue = "issue", e))(ke || {}), Ce = /* @__PURE__ */ ((e) => (e.placed = "placed", e.pending = "pending", e.processed = "processed", e.rejected = "rejected", e))(Ce || {});
9
+ }, E = (e, t, r, n) => (Z(e, t, "write to private field"), n ? n.call(e, r) : t.set(e, r), r);
10
+ var k = (e, t, r) => (Z(e, t, "access private method"), r);
11
+ var ye = /* @__PURE__ */ ((e) => (e.eur = "eur", e))(ye || {}), me = /* @__PURE__ */ ((e) => (e.corporate = "corporate", e.personal = "personal", e))(me || {}), _e = /* @__PURE__ */ ((e) => (e.read = "read", e.write = "write", e))(_e || {}), be = /* @__PURE__ */ ((e) => (e.absent = "absent", e.submitted = "submitted", e.pending = "pending", e.confirmed = "confirmed", e))(be || {}), Se = /* @__PURE__ */ ((e) => (e.approved = "approved", e.rejected = "rejected", e.unknown = "unknown", e))(Se || {}), Be = /* @__PURE__ */ ((e) => (e.requested = "requested", e.approved = "approved", e.pending = "pending", e))(Be || {}), ke = /* @__PURE__ */ ((e) => (e.iban = "iban", e.scan = "scan", e.chain = "chain", e))(ke || {}), Ce = /* @__PURE__ */ ((e) => (e.redeem = "redeem", e.issue = "issue", e))(Ce || {}), xe = /* @__PURE__ */ ((e) => (e.placed = "placed", e.pending = "pending", e.processed = "processed", e.rejected = "rejected", e))(xe || {});
12
12
  const re = (e) => {
13
13
  if (e.toString() === "Invalid Date")
14
14
  throw e;
15
15
  const t = (n) => n < 10 ? "0" + n : n, r = (n) => {
16
16
  if (n === 0)
17
17
  return "Z";
18
- const u = n > 0 ? "-" : "+";
19
- return n = Math.abs(n), u + t(Math.floor(n / 60)) + ":" + t(n % 60);
18
+ const c = n > 0 ? "-" : "+";
19
+ return n = Math.abs(n), c + t(Math.floor(n / 60)) + ":" + t(n % 60);
20
20
  };
21
21
  return e.getFullYear() + "-" + t(e.getMonth() + 1) + "-" + t(e.getDate()) + "T" + t(e.getHours()) + ":" + t(e.getMinutes()) + ":" + t(e.getSeconds()) + r(e.getTimezoneOffset());
22
- }, Fe = (e, t, r, n) => {
23
- const u = `${(n == null ? void 0 : n.toUpperCase()) || "EUR"}`;
24
- return r ? `Send ${u} ${e} to ${t} on ${ee(
22
+ }, qe = (e, t, r, n) => {
23
+ const c = `${(n == null ? void 0 : n.toUpperCase()) || "EUR"}`;
24
+ return r ? `Send ${c} ${e} to ${t} on ${ee(
25
25
  r
26
- )} at ${re(/* @__PURE__ */ new Date())}` : `Send ${u} ${e} to ${t} at ${re(/* @__PURE__ */ new Date())}`;
27
- }, Z = (e) => {
26
+ )} at ${re(/* @__PURE__ */ new Date())}` : `Send ${c} ${e} to ${t} at ${re(/* @__PURE__ */ new Date())}`;
27
+ }, Y = (e) => {
28
28
  var t;
29
29
  return e && ((t = Object.entries(e)) == null ? void 0 : t.length) > 0 ? Object.entries(e).map(
30
30
  ([r, n]) => `${encodeURIComponent(r)}=${encodeURIComponent(n)}`
@@ -32,7 +32,7 @@ const re = (e) => {
32
32
  }, ee = (e) => {
33
33
  switch (e) {
34
34
  case 1:
35
- case 5:
35
+ case 11155111:
36
36
  return "ethereum";
37
37
  case 100:
38
38
  case 10200:
@@ -43,14 +43,14 @@ const re = (e) => {
43
43
  default:
44
44
  throw new Error(`Chain not supported: ${e}`);
45
45
  }
46
- }, ae = (e) => {
46
+ }, ce = (e) => {
47
47
  switch (e) {
48
48
  case 1:
49
49
  case 100:
50
50
  case 137:
51
51
  return "mainnet";
52
- case 5:
53
- return "goerli";
52
+ case 11155111:
53
+ return "sepolia";
54
54
  case 10200:
55
55
  return "chiado";
56
56
  case 80001:
@@ -64,11 +64,11 @@ const re = (e) => {
64
64
  return {
65
65
  ...r,
66
66
  chain: ee(t),
67
- network: ae(t)
67
+ network: ce(t)
68
68
  };
69
69
  }
70
70
  return e;
71
- }, K = {
71
+ }, X = {
72
72
  environments: {
73
73
  production: {
74
74
  api: "https://api.monerium.app",
@@ -81,16 +81,16 @@ const re = (e) => {
81
81
  wss: "wss://api.monerium.dev"
82
82
  }
83
83
  }
84
- }, xe = "I hereby declare that I am the address owner.", M = "monerium.sdk.code_verifier", D = "monerium.sdk.refresh_token", We = {
85
- LINK_MESSAGE: xe,
84
+ }, Ae = "I hereby declare that I am the address owner.", M = "monerium.sdk.code_verifier", W = "monerium.sdk.refresh_token", De = {
85
+ LINK_MESSAGE: Ae,
86
86
  STORAGE_CODE_VERIFIER: M,
87
- STORAGE_REFRESH_TOKEN: D
87
+ STORAGE_REFRESH_TOKEN: W
88
88
  };
89
89
  var q = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
90
- function ce(e) {
90
+ function ue(e) {
91
91
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
92
92
  }
93
- function Ae(e) {
93
+ function Ee(e) {
94
94
  if (e.__esModule)
95
95
  return e;
96
96
  var t = e.default;
@@ -102,8 +102,8 @@ function Ae(e) {
102
102
  } else
103
103
  r = {};
104
104
  return Object.defineProperty(r, "__esModule", { value: !0 }), Object.keys(e).forEach(function(n) {
105
- var u = Object.getOwnPropertyDescriptor(e, n);
106
- Object.defineProperty(r, n, u.get ? u : {
105
+ var c = Object.getOwnPropertyDescriptor(e, n);
106
+ Object.defineProperty(r, n, c.get ? c : {
107
107
  enumerable: !0,
108
108
  get: function() {
109
109
  return e[n];
@@ -111,38 +111,38 @@ function Ae(e) {
111
111
  });
112
112
  }), r;
113
113
  }
114
- var ue = { exports: {} };
115
- function Ee(e) {
114
+ var he = { exports: {} };
115
+ function Ie(e) {
116
116
  throw new Error('Could not dynamically require "' + e + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
117
117
  }
118
- var Y = { exports: {} };
119
- const Ie = {}, $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
118
+ var K = { exports: {} };
119
+ const $e = {}, Re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
120
120
  __proto__: null,
121
- default: Ie
122
- }, Symbol.toStringTag, { value: "Module" })), Re = /* @__PURE__ */ Ae($e);
121
+ default: $e
122
+ }, Symbol.toStringTag, { value: "Module" })), ze = /* @__PURE__ */ Ee(Re);
123
123
  var ne;
124
- function he() {
124
+ function fe() {
125
125
  return ne || (ne = 1, function(e, t) {
126
126
  (function(r, n) {
127
127
  e.exports = n();
128
128
  })(q, function() {
129
- var r = r || function(n, u) {
130
- var c;
131
- if (typeof window < "u" && window.crypto && (c = window.crypto), typeof self < "u" && self.crypto && (c = self.crypto), typeof globalThis < "u" && globalThis.crypto && (c = globalThis.crypto), !c && typeof window < "u" && window.msCrypto && (c = window.msCrypto), !c && typeof q < "u" && q.crypto && (c = q.crypto), !c && typeof Ee == "function")
129
+ var r = r || function(n, c) {
130
+ var u;
131
+ if (typeof window < "u" && window.crypto && (u = window.crypto), typeof self < "u" && self.crypto && (u = self.crypto), typeof globalThis < "u" && globalThis.crypto && (u = globalThis.crypto), !u && typeof window < "u" && window.msCrypto && (u = window.msCrypto), !u && typeof q < "u" && q.crypto && (u = q.crypto), !u && typeof Ie == "function")
132
132
  try {
133
- c = Re;
133
+ u = ze;
134
134
  } catch {
135
135
  }
136
- var v = function() {
137
- if (c) {
138
- if (typeof c.getRandomValues == "function")
136
+ var l = function() {
137
+ if (u) {
138
+ if (typeof u.getRandomValues == "function")
139
139
  try {
140
- return c.getRandomValues(new Uint32Array(1))[0];
140
+ return u.getRandomValues(new Uint32Array(1))[0];
141
141
  } catch {
142
142
  }
143
- if (typeof c.randomBytes == "function")
143
+ if (typeof u.randomBytes == "function")
144
144
  try {
145
- return c.randomBytes(4).readInt32LE();
145
+ return u.randomBytes(4).readInt32LE();
146
146
  } catch {
147
147
  }
148
148
  }
@@ -154,7 +154,7 @@ function he() {
154
154
  var a;
155
155
  return o.prototype = s, a = new o(), o.prototype = null, a;
156
156
  };
157
- }(), p = {}, y = p.lib = {}, m = y.Base = function() {
157
+ }(), v = {}, m = v.lib = {}, y = m.Base = function() {
158
158
  return {
159
159
  /**
160
160
  * Creates a new object that inherits from this object.
@@ -239,7 +239,7 @@ function he() {
239
239
  return this.init.prototype.extend(this);
240
240
  }
241
241
  };
242
- }(), g = y.WordArray = m.extend({
242
+ }(), w = m.WordArray = y.extend({
243
243
  /**
244
244
  * Initializes a newly created word array.
245
245
  *
@@ -253,7 +253,7 @@ function he() {
253
253
  * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
254
254
  */
255
255
  init: function(o, s) {
256
- o = this.words = o || [], s != u ? this.sigBytes = s : this.sigBytes = o.length * 4;
256
+ o = this.words = o || [], s != c ? this.sigBytes = s : this.sigBytes = o.length * 4;
257
257
  },
258
258
  /**
259
259
  * Converts this word array to a string.
@@ -315,7 +315,7 @@ function he() {
315
315
  * var clone = wordArray.clone();
316
316
  */
317
317
  clone: function() {
318
- var o = m.clone.call(this);
318
+ var o = y.clone.call(this);
319
319
  return o.words = this.words.slice(0), o;
320
320
  },
321
321
  /**
@@ -333,10 +333,10 @@ function he() {
333
333
  */
334
334
  random: function(o) {
335
335
  for (var s = [], a = 0; a < o; a += 4)
336
- s.push(v());
337
- return new g.init(s, o);
336
+ s.push(l());
337
+ return new w.init(s, o);
338
338
  }
339
- }), b = p.enc = {}, f = b.Hex = {
339
+ }), b = v.enc = {}, f = b.Hex = {
340
340
  /**
341
341
  * Converts a word array to a hex string.
342
342
  *
@@ -373,9 +373,9 @@ function he() {
373
373
  parse: function(o) {
374
374
  for (var s = o.length, a = [], h = 0; h < s; h += 2)
375
375
  a[h >>> 3] |= parseInt(o.substr(h, 2), 16) << 24 - h % 8 * 4;
376
- return new g.init(a, s / 2);
376
+ return new w.init(a, s / 2);
377
377
  }
378
- }, l = b.Latin1 = {
378
+ }, p = b.Latin1 = {
379
379
  /**
380
380
  * Converts a word array to a Latin1 string.
381
381
  *
@@ -412,7 +412,7 @@ function he() {
412
412
  parse: function(o) {
413
413
  for (var s = o.length, a = [], h = 0; h < s; h++)
414
414
  a[h >>> 2] |= (o.charCodeAt(h) & 255) << 24 - h % 4 * 8;
415
- return new g.init(a, s);
415
+ return new w.init(a, s);
416
416
  }
417
417
  }, i = b.Utf8 = {
418
418
  /**
@@ -430,7 +430,7 @@ function he() {
430
430
  */
431
431
  stringify: function(o) {
432
432
  try {
433
- return decodeURIComponent(escape(l.stringify(o)));
433
+ return decodeURIComponent(escape(p.stringify(o)));
434
434
  } catch {
435
435
  throw new Error("Malformed UTF-8 data");
436
436
  }
@@ -449,9 +449,9 @@ function he() {
449
449
  * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
450
450
  */
451
451
  parse: function(o) {
452
- return l.parse(unescape(encodeURIComponent(o)));
452
+ return p.parse(unescape(encodeURIComponent(o)));
453
453
  }
454
- }, d = y.BufferedBlockAlgorithm = m.extend({
454
+ }, d = m.BufferedBlockAlgorithm = y.extend({
455
455
  /**
456
456
  * Resets this block algorithm's data buffer to its initial state.
457
457
  *
@@ -460,7 +460,7 @@ function he() {
460
460
  * bufferedBlockAlgorithm.reset();
461
461
  */
462
462
  reset: function() {
463
- this._data = new g.init(), this._nDataBytes = 0;
463
+ this._data = new w.init(), this._nDataBytes = 0;
464
464
  },
465
465
  /**
466
466
  * Adds new data to this block algorithm's buffer.
@@ -494,11 +494,11 @@ function he() {
494
494
  o ? x = n.ceil(x) : x = n.max((x | 0) - this._minBufferSize, 0);
495
495
  var N = x * S, P = n.min(N * 4, _);
496
496
  if (N) {
497
- for (var W = 0; W < N; W += S)
498
- this._doProcessBlock(h, W);
497
+ for (var D = 0; D < N; D += S)
498
+ this._doProcessBlock(h, D);
499
499
  s = h.splice(0, N), a.sigBytes -= P;
500
500
  }
501
- return new g.init(s, P);
501
+ return new w.init(s, P);
502
502
  },
503
503
  /**
504
504
  * Creates a copy of this object.
@@ -510,16 +510,16 @@ function he() {
510
510
  * var clone = bufferedBlockAlgorithm.clone();
511
511
  */
512
512
  clone: function() {
513
- var o = m.clone.call(this);
513
+ var o = y.clone.call(this);
514
514
  return o._data = this._data.clone(), o;
515
515
  },
516
516
  _minBufferSize: 0
517
517
  });
518
- y.Hasher = d.extend({
518
+ m.Hasher = d.extend({
519
519
  /**
520
520
  * Configuration options.
521
521
  */
522
- cfg: m.extend(),
522
+ cfg: y.extend(),
523
523
  /**
524
524
  * Initializes a newly created hasher.
525
525
  *
@@ -614,20 +614,20 @@ function he() {
614
614
  };
615
615
  }
616
616
  });
617
- var A = p.algo = {};
618
- return p;
617
+ var A = v.algo = {};
618
+ return v;
619
619
  }(Math);
620
620
  return r;
621
621
  });
622
- }(Y)), Y.exports;
622
+ }(K)), K.exports;
623
623
  }
624
624
  (function(e, t) {
625
625
  (function(r, n) {
626
- e.exports = n(he());
626
+ e.exports = n(fe());
627
627
  })(q, function(r) {
628
628
  return function() {
629
- var n = r, u = n.lib, c = u.WordArray, v = n.enc;
630
- v.Base64url = {
629
+ var n = r, c = n.lib, u = c.WordArray, l = n.enc;
630
+ l.Base64url = {
631
631
  /**
632
632
  * Converts a word array to a Base64url string.
633
633
  *
@@ -643,12 +643,12 @@ function he() {
643
643
  *
644
644
  * var base64String = CryptoJS.enc.Base64url.stringify(wordArray);
645
645
  */
646
- stringify: function(p, y) {
647
- y === void 0 && (y = !0);
648
- var m = p.words, g = p.sigBytes, b = y ? this._safe_map : this._map;
649
- p.clamp();
650
- for (var f = [], l = 0; l < g; l += 3)
651
- for (var i = m[l >>> 2] >>> 24 - l % 4 * 8 & 255, d = m[l + 1 >>> 2] >>> 24 - (l + 1) % 4 * 8 & 255, A = m[l + 2 >>> 2] >>> 24 - (l + 2) % 4 * 8 & 255, o = i << 16 | d << 8 | A, s = 0; s < 4 && l + s * 0.75 < g; s++)
646
+ stringify: function(v, m) {
647
+ m === void 0 && (m = !0);
648
+ var y = v.words, w = v.sigBytes, b = m ? this._safe_map : this._map;
649
+ v.clamp();
650
+ for (var f = [], p = 0; p < w; p += 3)
651
+ for (var i = y[p >>> 2] >>> 24 - p % 4 * 8 & 255, d = y[p + 1 >>> 2] >>> 24 - (p + 1) % 4 * 8 & 255, A = y[p + 2 >>> 2] >>> 24 - (p + 2) % 4 * 8 & 255, o = i << 16 | d << 8 | A, s = 0; s < 4 && p + s * 0.75 < w; s++)
652
652
  f.push(b.charAt(o >>> 6 * (3 - s) & 63));
653
653
  var a = b.charAt(64);
654
654
  if (a)
@@ -671,44 +671,44 @@ function he() {
671
671
  *
672
672
  * var wordArray = CryptoJS.enc.Base64url.parse(base64String);
673
673
  */
674
- parse: function(p, y) {
675
- y === void 0 && (y = !0);
676
- var m = p.length, g = y ? this._safe_map : this._map, b = this._reverseMap;
674
+ parse: function(v, m) {
675
+ m === void 0 && (m = !0);
676
+ var y = v.length, w = m ? this._safe_map : this._map, b = this._reverseMap;
677
677
  if (!b) {
678
678
  b = this._reverseMap = [];
679
- for (var f = 0; f < g.length; f++)
680
- b[g.charCodeAt(f)] = f;
679
+ for (var f = 0; f < w.length; f++)
680
+ b[w.charCodeAt(f)] = f;
681
681
  }
682
- var l = g.charAt(64);
683
- if (l) {
684
- var i = p.indexOf(l);
685
- i !== -1 && (m = i);
682
+ var p = w.charAt(64);
683
+ if (p) {
684
+ var i = v.indexOf(p);
685
+ i !== -1 && (y = i);
686
686
  }
687
- return B(p, m, b);
687
+ return B(v, y, b);
688
688
  },
689
689
  _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
690
690
  _safe_map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
691
691
  };
692
- function B(p, y, m) {
693
- for (var g = [], b = 0, f = 0; f < y; f++)
692
+ function B(v, m, y) {
693
+ for (var w = [], b = 0, f = 0; f < m; f++)
694
694
  if (f % 4) {
695
- var l = m[p.charCodeAt(f - 1)] << f % 4 * 2, i = m[p.charCodeAt(f)] >>> 6 - f % 4 * 2, d = l | i;
696
- g[b >>> 2] |= d << 24 - b % 4 * 8, b++;
695
+ var p = y[v.charCodeAt(f - 1)] << f % 4 * 2, i = y[v.charCodeAt(f)] >>> 6 - f % 4 * 2, d = p | i;
696
+ w[b >>> 2] |= d << 24 - b % 4 * 8, b++;
697
697
  }
698
- return c.create(g, b);
698
+ return u.create(w, b);
699
699
  }
700
700
  }(), r.enc.Base64url;
701
701
  });
702
- })(ue);
703
- var ze = ue.exports;
704
- const Ue = /* @__PURE__ */ ce(ze);
705
- var fe = { exports: {} };
702
+ })(he);
703
+ var Ue = he.exports;
704
+ const He = /* @__PURE__ */ ue(Ue);
705
+ var de = { exports: {} };
706
706
  (function(e, t) {
707
707
  (function(r, n) {
708
- e.exports = n(he());
708
+ e.exports = n(fe());
709
709
  })(q, function(r) {
710
710
  return function(n) {
711
- var u = r, c = u.lib, v = c.WordArray, B = c.Hasher, p = u.algo, y = [], m = [];
711
+ var c = r, u = c.lib, l = u.WordArray, B = u.Hasher, v = c.algo, m = [], y = [];
712
712
  (function() {
713
713
  function f(A) {
714
714
  for (var o = n.sqrt(A), s = 2; s <= o; s++)
@@ -716,174 +716,174 @@ var fe = { exports: {} };
716
716
  return !1;
717
717
  return !0;
718
718
  }
719
- function l(A) {
719
+ function p(A) {
720
720
  return (A - (A | 0)) * 4294967296 | 0;
721
721
  }
722
722
  for (var i = 2, d = 0; d < 64; )
723
- f(i) && (d < 8 && (y[d] = l(n.pow(i, 1 / 2))), m[d] = l(n.pow(i, 1 / 3)), d++), i++;
723
+ f(i) && (d < 8 && (m[d] = p(n.pow(i, 1 / 2))), y[d] = p(n.pow(i, 1 / 3)), d++), i++;
724
724
  })();
725
- var g = [], b = p.SHA256 = B.extend({
725
+ var w = [], b = v.SHA256 = B.extend({
726
726
  _doReset: function() {
727
- this._hash = new v.init(y.slice(0));
727
+ this._hash = new l.init(m.slice(0));
728
728
  },
729
- _doProcessBlock: function(f, l) {
729
+ _doProcessBlock: function(f, p) {
730
730
  for (var i = this._hash.words, d = i[0], A = i[1], o = i[2], s = i[3], a = i[4], h = i[5], _ = i[6], S = i[7], C = 0; C < 64; C++) {
731
731
  if (C < 16)
732
- g[C] = f[l + C] | 0;
732
+ w[C] = f[p + C] | 0;
733
733
  else {
734
- var x = g[C - 15], N = (x << 25 | x >>> 7) ^ (x << 14 | x >>> 18) ^ x >>> 3, P = g[C - 2], W = (P << 15 | P >>> 17) ^ (P << 13 | P >>> 19) ^ P >>> 10;
735
- g[C] = N + g[C - 7] + W + g[C - 16];
734
+ var x = w[C - 15], N = (x << 25 | x >>> 7) ^ (x << 14 | x >>> 18) ^ x >>> 3, P = w[C - 2], D = (P << 15 | P >>> 17) ^ (P << 13 | P >>> 19) ^ P >>> 10;
735
+ w[C] = N + w[C - 7] + D + w[C - 16];
736
736
  }
737
- var de = a & h ^ ~a & _, le = d & A ^ d & o ^ A & o, pe = (d << 30 | d >>> 2) ^ (d << 19 | d >>> 13) ^ (d << 10 | d >>> 22), ve = (a << 26 | a >>> 6) ^ (a << 21 | a >>> 11) ^ (a << 7 | a >>> 25), te = S + ve + de + m[C] + g[C], ge = pe + le;
738
- S = _, _ = h, h = a, a = s + te | 0, s = o, o = A, A = d, d = te + ge | 0;
737
+ var le = a & h ^ ~a & _, pe = d & A ^ d & o ^ A & o, ve = (d << 30 | d >>> 2) ^ (d << 19 | d >>> 13) ^ (d << 10 | d >>> 22), ge = (a << 26 | a >>> 6) ^ (a << 21 | a >>> 11) ^ (a << 7 | a >>> 25), te = S + ge + le + y[C] + w[C], we = ve + pe;
738
+ S = _, _ = h, h = a, a = s + te | 0, s = o, o = A, A = d, d = te + we | 0;
739
739
  }
740
740
  i[0] = i[0] + d | 0, i[1] = i[1] + A | 0, i[2] = i[2] + o | 0, i[3] = i[3] + s | 0, i[4] = i[4] + a | 0, i[5] = i[5] + h | 0, i[6] = i[6] + _ | 0, i[7] = i[7] + S | 0;
741
741
  },
742
742
  _doFinalize: function() {
743
- var f = this._data, l = f.words, i = this._nDataBytes * 8, d = f.sigBytes * 8;
744
- return l[d >>> 5] |= 128 << 24 - d % 32, l[(d + 64 >>> 9 << 4) + 14] = n.floor(i / 4294967296), l[(d + 64 >>> 9 << 4) + 15] = i, f.sigBytes = l.length * 4, this._process(), this._hash;
743
+ var f = this._data, p = f.words, i = this._nDataBytes * 8, d = f.sigBytes * 8;
744
+ return p[d >>> 5] |= 128 << 24 - d % 32, p[(d + 64 >>> 9 << 4) + 14] = n.floor(i / 4294967296), p[(d + 64 >>> 9 << 4) + 15] = i, f.sigBytes = p.length * 4, this._process(), this._hash;
745
745
  },
746
746
  clone: function() {
747
747
  var f = B.clone.call(this);
748
748
  return f._hash = this._hash.clone(), f;
749
749
  }
750
750
  });
751
- u.SHA256 = B._createHelper(b), u.HmacSHA256 = B._createHmacHelper(b);
751
+ c.SHA256 = B._createHelper(b), c.HmacSHA256 = B._createHmacHelper(b);
752
752
  }(Math), r.SHA256;
753
753
  });
754
- })(fe);
755
- var He = fe.exports;
756
- const Pe = /* @__PURE__ */ ce(He), Oe = (e, t) => {
754
+ })(de);
755
+ var Pe = de.exports;
756
+ const Oe = /* @__PURE__ */ ue(Pe), Te = (e, t) => {
757
757
  const {
758
758
  client_id: r,
759
759
  redirect_uri: n,
760
- scope: u,
761
- state: c,
762
- chainId: v,
760
+ scope: c,
761
+ state: u,
762
+ chainId: l,
763
763
  chain: B,
764
- network: p,
765
- address: y,
766
- signature: m
767
- } = e, g = y ? {
768
- address: y,
769
- ...m !== void 0 ? { signature: m } : {},
770
- ...v !== void 0 || B !== void 0 ? { chain: v ? ee(v) : B } : {},
771
- ...v !== void 0 || p !== void 0 ? { network: v ? ae(v) : p } : {}
764
+ network: v,
765
+ address: m,
766
+ signature: y
767
+ } = e, w = m ? {
768
+ address: m,
769
+ ...y !== void 0 ? { signature: y } : {},
770
+ ...l !== void 0 || B !== void 0 ? { chain: l ? ee(l) : B } : {},
771
+ ...l !== void 0 || v !== void 0 ? { network: l ? ce(l) : v } : {}
772
772
  } : {};
773
- return Z({
773
+ return Y({
774
774
  client_id: r,
775
775
  redirect_uri: n,
776
- ...u !== void 0 ? { scope: u } : {},
777
- ...c !== void 0 ? { state: c } : {},
776
+ ...c !== void 0 ? { scope: c } : {},
777
+ ...u !== void 0 ? { state: u } : {},
778
778
  code_challenge: t,
779
779
  code_challenge_method: "S256",
780
780
  response_type: "code",
781
- ...g
781
+ ...w
782
782
  });
783
- }, Te = () => {
783
+ }, Me = () => {
784
784
  let e = "";
785
785
  const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", r = t.length;
786
786
  let n = 0;
787
787
  for (; n < 128; )
788
788
  e += t.charAt(Math.floor(Math.random() * r)), n += 1;
789
789
  return e;
790
- }, Me = (e) => Ue.stringify(Pe(e)), oe = (e, t) => {
791
- const r = Te(), n = Me(r);
792
- return localStorage.setItem(M, r || ""), `${e}/auth?${Oe(t, n)}`;
790
+ }, Le = (e) => He.stringify(Oe(e)), oe = (e, t) => {
791
+ const r = Me(), n = Le(r);
792
+ return localStorage.setItem(M, r || ""), `${e}/auth?${Te(t, n)}`;
793
793
  }, se = () => {
794
794
  const e = window.location.href;
795
795
  if (!e || !(e != null && e.includes("?")))
796
796
  return;
797
797
  const [t, r] = e.split("?");
798
798
  r && window.history.replaceState(null, "", t);
799
- }, ie = (e) => e.code != null, Le = (e) => e.refresh_token != null, Ne = (e) => e.client_secret != null, je = async (e, t, r, n) => {
800
- const u = await fetch(`${e}`, {
799
+ }, ie = (e) => e.code != null, Fe = (e) => e.refresh_token != null, Ne = (e) => e.client_secret != null, ae = async (e, t, r, n) => {
800
+ const c = await fetch(`${e}`, {
801
801
  method: t,
802
802
  headers: n,
803
803
  body: r
804
804
  });
805
- let c;
806
- const v = await u.text();
805
+ let u;
806
+ const l = await c.text();
807
807
  try {
808
- c = JSON.parse(v);
808
+ u = JSON.parse(l);
809
809
  } catch {
810
- throw v;
810
+ throw l;
811
811
  }
812
- if (!u.ok)
813
- throw c;
814
- return c;
812
+ if (!c.ok)
813
+ throw u;
814
+ return u;
815
815
  }, T = typeof window > "u";
816
- var z, F, L, H, U, O, j, E, $, V, G, J;
817
- class De {
816
+ var R, L, F, H, U, O, j, I, $, V, G, J;
817
+ class We {
818
818
  constructor(t) {
819
819
  /**
820
820
  * {@link https://monerium.dev/api-docs#operation/auth-token}
821
821
  */
822
- R(this, O);
822
+ z(this, O);
823
823
  // -- Helper Methods
824
- R(this, E);
825
- R(this, z, void 0);
826
- R(this, F, void 0);
824
+ z(this, I);
825
+ z(this, R, void 0);
826
+ z(this, L, void 0);
827
827
  /** The socket will be available after subscribing to an event */
828
- R(this, L, void 0);
829
- R(this, H, void 0);
830
- R(this, U, void 0);
831
- R(this, V, void 0);
832
- R(this, G, void 0);
833
- R(this, J, void 0);
834
- if (I(this, H, /* @__PURE__ */ new Map()), this.isAuthorized = !!this.bearerProfile, I(this, V, async (r, n, u) => {
835
- const c = localStorage.getItem(M) || "";
836
- if (!c)
828
+ z(this, F, void 0);
829
+ z(this, H, void 0);
830
+ z(this, U, void 0);
831
+ z(this, V, void 0);
832
+ z(this, G, void 0);
833
+ z(this, J, void 0);
834
+ if (E(this, H, /* @__PURE__ */ new Map()), this.isAuthorized = !!this.bearerProfile, E(this, V, async (r, n, c, u) => {
835
+ const l = localStorage.getItem(M) || "";
836
+ if (!l)
837
837
  throw new Error("Code verifier not found");
838
- return this.codeVerifier = c, localStorage.removeItem(M), await k(this, O, j).call(this, {
839
- code: u,
838
+ return this.codeVerifier = l, this.state = u, localStorage.removeItem(M), await k(this, O, j).call(this, {
839
+ code: c,
840
840
  redirect_uri: n,
841
841
  client_id: r,
842
- code_verifier: c
842
+ code_verifier: l
843
843
  });
844
- }), I(this, G, async ({
844
+ }), E(this, G, async ({
845
845
  clientId: r,
846
846
  clientSecret: n
847
847
  }) => await k(this, O, j).call(this, {
848
848
  client_id: r,
849
849
  client_secret: n
850
- })), I(this, J, async (r, n) => await k(this, O, j).call(this, {
850
+ })), E(this, J, async (r, n) => await k(this, O, j).call(this, {
851
851
  refresh_token: n,
852
852
  client_id: r
853
853
  })), this.subscribeToOrderNotifications = () => {
854
- var u, c;
855
- const r = `${w(this, z).wss}/profiles/${(u = this.bearerProfile) == null ? void 0 : u.profile}/orders?access_token=${(c = this.bearerProfile) == null ? void 0 : c.access_token}`, n = new WebSocket(r);
854
+ var c, u;
855
+ const r = `${g(this, R).wss}/profiles/${(c = this.bearerProfile) == null ? void 0 : c.profile}/orders?access_token=${(u = this.bearerProfile) == null ? void 0 : u.access_token}`, n = new WebSocket(r);
856
856
  return n.addEventListener("open", () => {
857
857
  console.info(`Socket connected: ${r}`);
858
- }), n.addEventListener("error", (v) => {
859
- throw console.error(v), new Error(`Socket error: ${r}`);
860
- }), n.addEventListener("message", (v) => {
861
- var p;
862
- const B = JSON.parse(v.data);
863
- (p = w(this, H).get(B.meta.state)) == null || p(
858
+ }), n.addEventListener("error", (l) => {
859
+ throw console.error(l), new Error(`Socket error: ${r}`);
860
+ }), n.addEventListener("message", (l) => {
861
+ var v;
862
+ const B = JSON.parse(l.data);
863
+ (v = g(this, H).get(B.meta.state)) == null || v(
864
864
  B
865
865
  );
866
866
  }), n.addEventListener("close", () => {
867
867
  console.info(`Socket connection closed: ${r}`);
868
868
  }), n;
869
869
  }, this.auth = async (r) => await k(this, O, j).call(this, r), this.connect = async (r) => await k(this, O, j).call(this, r), this.getAuthFlowURI = (r) => {
870
- const n = oe(w(this, z).api, r);
870
+ const n = oe(g(this, R).api, r);
871
871
  return this.codeVerifier = localStorage.getItem(M), n;
872
- }, this.pkceRequest = (r) => this.getAuthFlowURI(r), this.getEnvironment = () => w(this, z), !t) {
873
- I(this, z, K.environments.sandbox);
872
+ }, this.pkceRequest = (r) => this.getAuthFlowURI(r), this.getEnvironment = () => g(this, R), !t) {
873
+ E(this, R, X.environments.sandbox);
874
874
  return;
875
875
  }
876
876
  if (typeof t == "string")
877
- I(this, z, K.environments[t]);
878
- else if (I(this, z, K.environments[t.environment || "sandbox"]), T) {
877
+ E(this, R, X.environments[t]);
878
+ else if (E(this, R, X.environments[t.environment || "sandbox"]), T) {
879
879
  const { clientId: r, clientSecret: n } = t;
880
- I(this, U, {
880
+ E(this, U, {
881
881
  clientId: r,
882
882
  clientSecret: n
883
883
  });
884
884
  } else {
885
885
  const { clientId: r, redirectUrl: n } = t;
886
- I(this, U, {
886
+ E(this, U, {
887
887
  clientId: r,
888
888
  redirectUrl: n
889
889
  });
@@ -897,20 +897,21 @@ class De {
897
897
  * {@link https://monerium.dev/api-docs#operation/auth}
898
898
  */
899
899
  async authorize(t) {
900
- var c, v;
901
- const r = (t == null ? void 0 : t.clientId) || ((c = w(this, U)) == null ? void 0 : c.clientId), n = (t == null ? void 0 : t.redirectUrl) || ((v = w(this, U)) == null ? void 0 : v.redirectUrl);
900
+ var u, l;
901
+ const r = (t == null ? void 0 : t.clientId) || ((u = g(this, U)) == null ? void 0 : u.clientId), n = (t == null ? void 0 : t.redirectUrl) || ((l = g(this, U)) == null ? void 0 : l.redirectUrl);
902
902
  if (!r)
903
903
  throw new Error("Missing ClientId");
904
904
  if (!n)
905
905
  throw new Error("Missing RedirectUrl");
906
- const u = oe(w(this, z).api, {
906
+ const c = oe(g(this, R).api, {
907
907
  client_id: r,
908
908
  redirect_uri: n,
909
909
  address: t == null ? void 0 : t.address,
910
910
  signature: t == null ? void 0 : t.signature,
911
- chainId: t == null ? void 0 : t.chainId
911
+ chainId: t == null ? void 0 : t.chainId,
912
+ state: t == null ? void 0 : t.state
912
913
  });
913
- window.location.replace(u);
914
+ window.location.replace(c);
914
915
  }
915
916
  /**
916
917
  * Get access to the API
@@ -918,27 +919,27 @@ class De {
918
919
  * @returns boolean to indicate if access has been granted
919
920
  */
920
921
  async getAccess(t) {
921
- var B, p, y;
922
- const r = (t == null ? void 0 : t.clientId) || ((B = w(this, U)) == null ? void 0 : B.clientId);
923
- if ((t == null ? void 0 : t.clientSecret) || ((p = w(this, U)) == null ? void 0 : p.clientSecret)) {
922
+ var v, m, y;
923
+ const r = (t == null ? void 0 : t.clientId) || ((v = g(this, U)) == null ? void 0 : v.clientId);
924
+ if ((t == null ? void 0 : t.clientSecret) || ((m = g(this, U)) == null ? void 0 : m.clientSecret)) {
924
925
  if (!T)
925
926
  throw new Error("Only use client credentials on server side");
926
- return await w(this, G).call(this, w(this, U)), !!this.bearerProfile;
927
+ return await g(this, G).call(this, g(this, U)), !!this.bearerProfile;
927
928
  }
928
- const u = (t == null ? void 0 : t.redirectUrl) || ((y = w(this, U)) == null ? void 0 : y.redirectUrl);
929
+ const c = (t == null ? void 0 : t.redirectUrl) || ((y = g(this, U)) == null ? void 0 : y.redirectUrl);
929
930
  if (!r)
930
931
  throw new Error("Missing ClientId");
931
932
  if (T)
932
933
  throw new Error("This only works client side");
933
- const c = new URLSearchParams(window.location.search).get("code") || void 0, v = localStorage.getItem(D) || void 0;
934
- return v ? await w(this, J).call(this, r, v) : c && await w(this, V).call(this, r, u, c), !!this.bearerProfile;
934
+ const u = new URLSearchParams(window.location.search).get("code") || void 0, l = new URLSearchParams(window.location.search).get("state") || void 0, B = localStorage.getItem(W) || void 0;
935
+ return B ? await g(this, J).call(this, r, B) : u && await g(this, V).call(this, r, c, u, l), !!this.bearerProfile;
935
936
  }
936
937
  // -- Read Methods
937
938
  /**
938
939
  * {@link https://monerium.dev/api-docs#operation/auth-context}
939
940
  */
940
941
  getAuthContext() {
941
- return k(this, E, $).call(this, "get", "auth/context");
942
+ return k(this, I, $).call(this, "get", "auth/context");
942
943
  }
943
944
  /**
944
945
  * {@link https://monerium.dev/api-docs#operation/profile}
@@ -946,40 +947,40 @@ class De {
946
947
 
947
948
  */
948
949
  getProfile(t) {
949
- return k(this, E, $).call(this, "get", `profiles/${t}`);
950
+ return k(this, I, $).call(this, "get", `profiles/${t}`);
950
951
  }
951
952
  /**
952
953
  * {@link https://monerium.dev/api-docs#operation/profile-balances}
953
954
  * @param {string=} profileId - the id of the profile to fetch balances.
954
955
  */
955
956
  getBalances(t) {
956
- return t ? k(this, E, $).call(this, "get", `profiles/${t}/balances`) : k(this, E, $).call(this, "get", "balances");
957
+ return t ? k(this, I, $).call(this, "get", `profiles/${t}/balances`) : k(this, I, $).call(this, "get", "balances");
957
958
  }
958
959
  /**
959
960
  * {@link https://monerium.dev/api-docs#operation/orders}
960
961
  */
961
962
  getOrders(t) {
962
- const r = Z(t);
963
- return k(this, E, $).call(this, "get", `orders?${r}`);
963
+ const r = Y(t);
964
+ return k(this, I, $).call(this, "get", `orders?${r}`);
964
965
  }
965
966
  /**
966
967
  * {@link https://monerium.dev/api-docs#operation/order}
967
968
  */
968
969
  getOrder(t) {
969
- return k(this, E, $).call(this, "get", `orders/${t}`);
970
+ return k(this, I, $).call(this, "get", `orders/${t}`);
970
971
  }
971
972
  /**
972
973
  * {@link https://monerium.dev/api-docs#operation/tokens}
973
974
  */
974
975
  getTokens() {
975
- return k(this, E, $).call(this, "get", "tokens");
976
+ return k(this, I, $).call(this, "get", "tokens");
976
977
  }
977
978
  // -- Write Methods
978
979
  /**
979
980
  * {@link https://monerium.dev/api-docs#operation/profile-addresses}
980
981
  */
981
982
  linkAddress(t, r) {
982
- return r = Q(r), r.accounts = r.accounts.map((n) => Q(n)), k(this, E, $).call(this, "post", `profiles/${t}/addresses`, JSON.stringify(r));
983
+ return r = Q(r), r.accounts = r.accounts.map((n) => Q(n)), k(this, I, $).call(this, "post", `profiles/${t}/addresses`, JSON.stringify(r));
983
984
  }
984
985
  /**
985
986
  * {@link https://monerium.dev/api-docs#operation/post-orders}
@@ -994,34 +995,34 @@ class De {
994
995
  identifier: Q(t.counterpart.identifier)
995
996
  }
996
997
  };
997
- return r ? k(this, E, $).call(this, "post", `profiles/${r}/orders`, JSON.stringify(n)) : k(this, E, $).call(this, "post", "orders", JSON.stringify(n));
998
+ return r ? k(this, I, $).call(this, "post", `profiles/${r}/orders`, JSON.stringify(n)) : k(this, I, $).call(this, "post", "orders", JSON.stringify(n));
998
999
  }
999
1000
  /**
1000
1001
  * {@link https://monerium.dev/api-docs#operation/supporting-document}
1001
1002
  */
1002
1003
  uploadSupportingDocument(t) {
1003
- const r = Z(
1004
- t
1005
- );
1006
- return k(this, E, $).call(this, "post", "files/supporting-document", r, !0);
1004
+ const r = new FormData();
1005
+ return r.append("file", t), ae(`${g(this, R).api}/files`, "post", r, {
1006
+ Authorization: g(this, L) || ""
1007
+ });
1007
1008
  }
1008
1009
  // -- Notifications
1009
1010
  async connectOrderSocket() {
1010
1011
  var t;
1011
- (t = this.bearerProfile) != null && t.access_token && w(this, H).size > 0 && I(this, L, this.subscribeToOrderNotifications());
1012
+ (t = this.bearerProfile) != null && t.access_token && g(this, H).size > 0 && E(this, F, this.subscribeToOrderNotifications());
1012
1013
  }
1013
1014
  /**
1014
1015
  * Cleanups the socket and the subscriptions
1015
1016
  */
1016
1017
  async disconnect() {
1017
1018
  var t;
1018
- T || localStorage.removeItem(M), w(this, H).clear(), (t = w(this, L)) == null || t.close(), I(this, F, void 0), this.bearerProfile = void 0;
1019
+ T || localStorage.removeItem(M), g(this, H).clear(), (t = g(this, F)) == null || t.close(), E(this, L, void 0), this.bearerProfile = void 0;
1019
1020
  }
1020
1021
  /**
1021
1022
  * Revokes access
1022
1023
  */
1023
1024
  async revokeAccess() {
1024
- T || localStorage.removeItem(D), this.disconnect();
1025
+ T || localStorage.removeItem(W), this.disconnect();
1025
1026
  }
1026
1027
  /**
1027
1028
  * Subscribe to MoneriumEvent to receive notifications using the Monerium API (WebSocket)
@@ -1031,7 +1032,7 @@ class De {
1031
1032
  * @param handler The handler to be called when the event is triggered
1032
1033
  */
1033
1034
  subscribeOrders(t, r) {
1034
- w(this, H).set(t, r);
1035
+ g(this, H).set(t, r);
1035
1036
  }
1036
1037
  /**
1037
1038
  * Unsubscribe from MoneriumEvent and close the socket if there are no more subscriptions
@@ -1039,53 +1040,53 @@ class De {
1039
1040
  */
1040
1041
  unsubscribeOrders(t) {
1041
1042
  var r;
1042
- w(this, H).delete(t), w(this, H).size === 0 && ((r = w(this, L)) == null || r.close(), I(this, L, void 0));
1043
+ g(this, H).delete(t), g(this, H).size === 0 && ((r = g(this, F)) == null || r.close(), E(this, F, void 0));
1043
1044
  }
1044
1045
  }
1045
- z = new WeakMap(), F = new WeakMap(), L = new WeakMap(), H = new WeakMap(), U = new WeakMap(), O = new WeakSet(), j = async function(t) {
1046
+ R = new WeakMap(), L = new WeakMap(), F = new WeakMap(), H = new WeakMap(), U = new WeakMap(), O = new WeakSet(), j = async function(t) {
1046
1047
  let r;
1047
1048
  if (ie(t))
1048
1049
  r = { ...t, grant_type: "authorization_code" };
1049
- else if (Le(t))
1050
+ else if (Fe(t))
1050
1051
  r = { ...t, grant_type: "refresh_token" };
1051
1052
  else if (Ne(t))
1052
1053
  r = { ...t, grant_type: "client_credentials" };
1053
1054
  else
1054
1055
  throw new Error("Authorization grant type could not be detected.");
1055
- return await k(this, E, $).call(this, "post", "auth/token", r, !0).then((n) => {
1056
- var u;
1057
- this.bearerProfile = n, this.isAuthorized = !!n, I(this, F, `Bearer ${n == null ? void 0 : n.access_token}`), T || window.localStorage.setItem(
1058
- D,
1059
- ((u = this.bearerProfile) == null ? void 0 : u.refresh_token) || ""
1056
+ return await k(this, I, $).call(this, "post", "auth/token", r, !0).then((n) => {
1057
+ var c;
1058
+ this.bearerProfile = n, this.isAuthorized = !!n, E(this, L, `Bearer ${n == null ? void 0 : n.access_token}`), T || window.localStorage.setItem(
1059
+ W,
1060
+ ((c = this.bearerProfile) == null ? void 0 : c.refresh_token) || ""
1060
1061
  );
1061
1062
  }).catch((n) => {
1062
- throw T || (localStorage.removeItem(M), localStorage.removeItem(D), se()), new Error(n == null ? void 0 : n.message);
1063
+ throw T || (localStorage.removeItem(M), localStorage.removeItem(W), se()), new Error(n == null ? void 0 : n.message);
1063
1064
  }), ie(t) && se(), this.bearerProfile;
1064
- }, E = new WeakSet(), $ = async function(t, r, n, u) {
1065
- return je(
1066
- `${w(this, z).api}/${r}`,
1065
+ }, I = new WeakSet(), $ = async function(t, r, n, c) {
1066
+ return ae(
1067
+ `${g(this, R).api}/${r}`,
1067
1068
  t,
1068
- u ? Z(n) : n,
1069
+ c ? Y(n) : n,
1069
1070
  {
1070
- Authorization: w(this, F) || "",
1071
- "Content-Type": `application/${u ? "x-www-form-urlencoded" : "json"}`
1071
+ Authorization: g(this, L) || "",
1072
+ "Content-Type": `application/${c ? "x-www-form-urlencoded" : "json"}`
1072
1073
  }
1073
1074
  );
1074
1075
  }, V = new WeakMap(), G = new WeakMap(), J = new WeakMap();
1075
1076
  export {
1076
- Se as AccountState,
1077
- we as Currency,
1078
- be as KYCOutcome,
1079
- _e as KYCState,
1080
- De as MoneriumClient,
1081
- ke as OrderKind,
1082
- Ce as OrderState,
1083
- Be as PaymentStandard,
1084
- me as Permission,
1085
- ye as ProfileType,
1086
- We as constants,
1077
+ Be as AccountState,
1078
+ ye as Currency,
1079
+ Se as KYCOutcome,
1080
+ be as KYCState,
1081
+ We as MoneriumClient,
1082
+ Ce as OrderKind,
1083
+ xe as OrderState,
1084
+ ke as PaymentStandard,
1085
+ _e as Permission,
1086
+ me as ProfileType,
1087
+ De as constants,
1087
1088
  ee as getChain,
1088
- ae as getNetwork,
1089
- Fe as placeOrderMessage,
1089
+ ce as getNetwork,
1090
+ qe as placeOrderMessage,
1090
1091
  re as rfc3339
1091
1092
  };
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monerium/sdk",
3
- "version": "2.10.0",
3
+ "version": "2.12.0",
4
4
  "description": "Everything you need to interact with the Monerium API - an electronic money issuer.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/dist/types.d.ts CHANGED
@@ -10,7 +10,7 @@ export type Config = {
10
10
  };
11
11
  };
12
12
  export type ENV = 'sandbox' | 'production';
13
- export type EthereumTestnet = 'goerli';
13
+ export type EthereumTestnet = 'sepolia';
14
14
  export type GnosisTestnet = 'chiado';
15
15
  export type PolygonTestnet = 'mumbai';
16
16
  export type Chain = 'ethereum' | 'gnosis' | 'polygon';
@@ -18,7 +18,7 @@ export type Networks = EthereumTestnet | GnosisTestnet | PolygonTestnet | 'mainn
18
18
  export type NetworkSemiStrict<C extends Chain> = C extends 'ethereum' ? EthereumTestnet | 'mainnet' : C extends 'gnosis' ? GnosisTestnet | 'mainnet' : C extends 'polygon' ? PolygonTestnet | 'mainnet' : never;
19
19
  export type NetworkStrict<C extends Chain, E extends ENV> = E extends 'production' ? 'mainnet' : E extends 'sandbox' ? C extends 'ethereum' ? EthereumTestnet : C extends 'gnosis' ? GnosisTestnet : C extends 'polygon' ? PolygonTestnet : never : never;
20
20
  export type Network<C extends Chain = Chain, E extends ENV = ENV> = C extends Chain ? E extends ENV ? NetworkStrict<C, E> & NetworkSemiStrict<C> : never : never;
21
- export type ChainId = number | 1 | 5 | 100 | 137 | 10200 | 80001;
21
+ export type ChainId = number | 1 | 11155111 | 100 | 137 | 10200 | 80001;
22
22
  export declare enum Currency {
23
23
  eur = "eur"
24
24
  }
@@ -359,6 +359,7 @@ export type AuthFlowOptions = {
359
359
  address?: string;
360
360
  signature?: string;
361
361
  chainId?: ChainId;
362
+ state?: string;
362
363
  };
363
364
  export type ClientCredentials = {
364
365
  clientId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monerium/sdk",
3
- "version": "2.10.0",
3
+ "version": "2.12.0",
4
4
  "description": "Everything you need to interact with the Monerium API - an electronic money issuer.",
5
5
  "license": "MIT",
6
6
  "repository": {