@monerium/sdk 2.7.1 → 2.7.3
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 +185 -1
- package/README.md +33 -2
- package/dist/client.d.ts +18 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +376 -363
- package/dist/package.json +1 -2
- package/dist/types.d.ts +1 -0
- package/package.json +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [2.7.
|
|
3
|
+
## [2.7.3](https://github.com/monerium/public-monorepo/compare/sdk-v2.7.3...sdk-v2.7.3) (2023-11-17)
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
### Features
|
|
@@ -12,12 +12,16 @@
|
|
|
12
12
|
### Bug Fixes
|
|
13
13
|
|
|
14
14
|
* add example, fix sdk for backwards compatibility and update README ([6992417](https://github.com/monerium/public-monorepo/commit/6992417e44b442a06b1d65f88d588d17e71b4562))
|
|
15
|
+
* add removal date to deprecated methods and add connect as deprecated ([c1e02e2](https://github.com/monerium/public-monorepo/commit/c1e02e273b08b091475757e0e68051098e20a5a0))
|
|
15
16
|
* add yarnrc to each lib ([6dc9f7a](https://github.com/monerium/public-monorepo/commit/6dc9f7a4a46e24596c862df83823f90be5dad803))
|
|
17
|
+
* broken test ([6cfdd57](https://github.com/monerium/public-monorepo/commit/6cfdd57f041eba99312f5dc32fb40b7b2c2406a9))
|
|
18
|
+
* clean query on error ([2620322](https://github.com/monerium/public-monorepo/commit/26203224cdfb09d5f1a8be34f0fb27ed6c95b800))
|
|
16
19
|
* continue on error gh-pages ([d033048](https://github.com/monerium/public-monorepo/commit/d033048a490390815ef17dad45b526b04898c2ae))
|
|
17
20
|
* debug ([b2543eb](https://github.com/monerium/public-monorepo/commit/b2543eb222cbe74131377e164c28c3093b72be5f))
|
|
18
21
|
* debug ([ea1bd38](https://github.com/monerium/public-monorepo/commit/ea1bd38c8f8f98cf65a9bcab615faa540a8b7324))
|
|
19
22
|
* debug ([20e3ccb](https://github.com/monerium/public-monorepo/commit/20e3ccb3297e3bba02be86349a151b1bf0ed8f5c))
|
|
20
23
|
* dep ([0d9953b](https://github.com/monerium/public-monorepo/commit/0d9953b5a2e259851d05d422ecf7f2c1fa36c6ea))
|
|
24
|
+
* expose getChain and getNetwork + update docs ([085d9bd](https://github.com/monerium/public-monorepo/commit/085d9bd261342d14936a7f9f1d5cc1fdd859ec26))
|
|
21
25
|
* letsgo ([af653ce](https://github.com/monerium/public-monorepo/commit/af653ce744b333023892370b21ec28738c82910e))
|
|
22
26
|
* lol ([630cb9f](https://github.com/monerium/public-monorepo/commit/630cb9fa3f4d7efa363b7fd9079c4e5e4e26bdd3))
|
|
23
27
|
* perm ([3210011](https://github.com/monerium/public-monorepo/commit/32100114916d85b1b1982cd942c3181210943ee9))
|
|
@@ -25,6 +29,7 @@
|
|
|
25
29
|
* publish ([537b336](https://github.com/monerium/public-monorepo/commit/537b336180df288e0653b0db7230ae84758f8475))
|
|
26
30
|
* publish not working ([50a2a05](https://github.com/monerium/public-monorepo/commit/50a2a0583c03ef7a66a605c8215f72256192b8e2))
|
|
27
31
|
* releaseas ([db309d2](https://github.com/monerium/public-monorepo/commit/db309d2635196bac5df230e886d70c395c58b06b))
|
|
32
|
+
* remove packageManager from sdk packagejson ([f87d93d](https://github.com/monerium/public-monorepo/commit/f87d93d51c953fdc8c72a4458f19f11ad0fd0d58))
|
|
28
33
|
* rewrite the CHANGELOG after a lot messy testing ([fb1a3c9](https://github.com/monerium/public-monorepo/commit/fb1a3c9517c269c49bc6ad9e492c79481184afcd))
|
|
29
34
|
* sdk version ([27c479c](https://github.com/monerium/public-monorepo/commit/27c479c3b324a33ea7e44613601e4f32269e9082))
|
|
30
35
|
* static files not deployed ([a1131d7](https://github.com/monerium/public-monorepo/commit/a1131d7ab988a93e41b7f3b65429b5aa27ff588e))
|
|
@@ -40,6 +45,7 @@
|
|
|
40
45
|
* testing ([24389c9](https://github.com/monerium/public-monorepo/commit/24389c9f243671c548d957dc499689e58e0bc3f6))
|
|
41
46
|
* testing affected ([60059eb](https://github.com/monerium/public-monorepo/commit/60059ebc035dccf1dcbb4eb64cf0eeb071020caf))
|
|
42
47
|
* testing affected ([a10f49a](https://github.com/monerium/public-monorepo/commit/a10f49a4840218c9f5fa76463b3132401d0a23f4))
|
|
48
|
+
* tests and release action ([a18438c](https://github.com/monerium/public-monorepo/commit/a18438c2974e79975722afe8f7f9679358f32da5))
|
|
43
49
|
* trigger both packages ([a8db647](https://github.com/monerium/public-monorepo/commit/a8db647e694abd753bdb06df352c1d72617d7e67))
|
|
44
50
|
* trigger sdk ([ee1b950](https://github.com/monerium/public-monorepo/commit/ee1b9502c61655e5f0771827fdd116b58c748834))
|
|
45
51
|
* typedoc deps ([0696536](https://github.com/monerium/public-monorepo/commit/0696536edd834b6bf2ca6bf6ea39914d37fcda9c))
|
|
@@ -47,6 +53,184 @@
|
|
|
47
53
|
* version ([f3a1b1d](https://github.com/monerium/public-monorepo/commit/f3a1b1d7750a2f743d84426e60ea368909dcf93d))
|
|
48
54
|
* yarn instead of npm ([5b86535](https://github.com/monerium/public-monorepo/commit/5b86535ed225effa0d13b6b60388bf05783ebe63))
|
|
49
55
|
|
|
56
|
+
## [2.7.3](https://github.com/monerium/public-monorepo/compare/sdk-v2.7.2...sdk-v2.7.3) (2023-11-17)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
### Bug Fixes
|
|
60
|
+
|
|
61
|
+
* clean query on error ([2620322](https://github.com/monerium/public-monorepo/commit/26203224cdfb09d5f1a8be34f0fb27ed6c95b800))
|
|
62
|
+
|
|
63
|
+
## [2.7.2](https://github.com/monerium/public-monorepo/compare/sdk-v2.7.2...sdk-v2.7.2) (2023-11-17)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Features
|
|
67
|
+
|
|
68
|
+
* add docs ([f5ba19d](https://github.com/monerium/public-monorepo/commit/f5ba19d5600e01cd0c97467a0a1f2fe94a2f40fc))
|
|
69
|
+
* new functions added + arguments to class instance ([b5b8c5d](https://github.com/monerium/public-monorepo/commit/b5b8c5d3fbae6ce7a90569b74d887b81d9f3a336))
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
### Bug Fixes
|
|
73
|
+
|
|
74
|
+
* add example, fix sdk for backwards compatibility and update README ([6992417](https://github.com/monerium/public-monorepo/commit/6992417e44b442a06b1d65f88d588d17e71b4562))
|
|
75
|
+
* add removal date to deprecated methods and add connect as deprecated ([c1e02e2](https://github.com/monerium/public-monorepo/commit/c1e02e273b08b091475757e0e68051098e20a5a0))
|
|
76
|
+
* add yarnrc to each lib ([6dc9f7a](https://github.com/monerium/public-monorepo/commit/6dc9f7a4a46e24596c862df83823f90be5dad803))
|
|
77
|
+
* continue on error gh-pages ([d033048](https://github.com/monerium/public-monorepo/commit/d033048a490390815ef17dad45b526b04898c2ae))
|
|
78
|
+
* debug ([b2543eb](https://github.com/monerium/public-monorepo/commit/b2543eb222cbe74131377e164c28c3093b72be5f))
|
|
79
|
+
* debug ([ea1bd38](https://github.com/monerium/public-monorepo/commit/ea1bd38c8f8f98cf65a9bcab615faa540a8b7324))
|
|
80
|
+
* debug ([20e3ccb](https://github.com/monerium/public-monorepo/commit/20e3ccb3297e3bba02be86349a151b1bf0ed8f5c))
|
|
81
|
+
* dep ([0d9953b](https://github.com/monerium/public-monorepo/commit/0d9953b5a2e259851d05d422ecf7f2c1fa36c6ea))
|
|
82
|
+
* expose getChain and getNetwork + update docs ([085d9bd](https://github.com/monerium/public-monorepo/commit/085d9bd261342d14936a7f9f1d5cc1fdd859ec26))
|
|
83
|
+
* letsgo ([af653ce](https://github.com/monerium/public-monorepo/commit/af653ce744b333023892370b21ec28738c82910e))
|
|
84
|
+
* lol ([630cb9f](https://github.com/monerium/public-monorepo/commit/630cb9fa3f4d7efa363b7fd9079c4e5e4e26bdd3))
|
|
85
|
+
* perm ([3210011](https://github.com/monerium/public-monorepo/commit/32100114916d85b1b1982cd942c3181210943ee9))
|
|
86
|
+
* props to auto-link ([ce85efd](https://github.com/monerium/public-monorepo/commit/ce85efd534cfcac7fb9e7804b733641aeb752f4f))
|
|
87
|
+
* publish ([537b336](https://github.com/monerium/public-monorepo/commit/537b336180df288e0653b0db7230ae84758f8475))
|
|
88
|
+
* publish not working ([50a2a05](https://github.com/monerium/public-monorepo/commit/50a2a0583c03ef7a66a605c8215f72256192b8e2))
|
|
89
|
+
* releaseas ([db309d2](https://github.com/monerium/public-monorepo/commit/db309d2635196bac5df230e886d70c395c58b06b))
|
|
90
|
+
* remove packageManager from sdk packagejson ([f87d93d](https://github.com/monerium/public-monorepo/commit/f87d93d51c953fdc8c72a4458f19f11ad0fd0d58))
|
|
91
|
+
* rewrite the CHANGELOG after a lot messy testing ([fb1a3c9](https://github.com/monerium/public-monorepo/commit/fb1a3c9517c269c49bc6ad9e492c79481184afcd))
|
|
92
|
+
* sdk version ([27c479c](https://github.com/monerium/public-monorepo/commit/27c479c3b324a33ea7e44613601e4f32269e9082))
|
|
93
|
+
* static files not deployed ([a1131d7](https://github.com/monerium/public-monorepo/commit/a1131d7ab988a93e41b7f3b65429b5aa27ff588e))
|
|
94
|
+
* stuff ([6b06483](https://github.com/monerium/public-monorepo/commit/6b06483ad5ca8f3e00e8d88f2739cf2526ae2101))
|
|
95
|
+
* stuff ([1dadd44](https://github.com/monerium/public-monorepo/commit/1dadd44f07fb2234bf1fca1f1f20dbc4158cface))
|
|
96
|
+
* syntax ([f8cfbad](https://github.com/monerium/public-monorepo/commit/f8cfbad0fa536808ddc988cf9e6ca8aef5247ef7))
|
|
97
|
+
* test ([2c52f99](https://github.com/monerium/public-monorepo/commit/2c52f99e5c2fc19c502fae01e7ca105010df979f))
|
|
98
|
+
* test ([21c2cb8](https://github.com/monerium/public-monorepo/commit/21c2cb8c936410f6701a87313cb1bcb4dd9f281f))
|
|
99
|
+
* test ([2a612b1](https://github.com/monerium/public-monorepo/commit/2a612b1f93a59ec709c9f328c7ba4bc910971de9))
|
|
100
|
+
* test ([0dfd8e1](https://github.com/monerium/public-monorepo/commit/0dfd8e1489db8096f1cb66a3816e410ddb996d64))
|
|
101
|
+
* test deploy ([1a3e311](https://github.com/monerium/public-monorepo/commit/1a3e311fdc7bde2f17390e4cdb3f0a48859e5cf9))
|
|
102
|
+
* test: ([e122f61](https://github.com/monerium/public-monorepo/commit/e122f61e5f907785b6076bfda855c275bcfce1d6))
|
|
103
|
+
* testing ([24389c9](https://github.com/monerium/public-monorepo/commit/24389c9f243671c548d957dc499689e58e0bc3f6))
|
|
104
|
+
* testing affected ([60059eb](https://github.com/monerium/public-monorepo/commit/60059ebc035dccf1dcbb4eb64cf0eeb071020caf))
|
|
105
|
+
* testing affected ([a10f49a](https://github.com/monerium/public-monorepo/commit/a10f49a4840218c9f5fa76463b3132401d0a23f4))
|
|
106
|
+
* tests and release action ([a18438c](https://github.com/monerium/public-monorepo/commit/a18438c2974e79975722afe8f7f9679358f32da5))
|
|
107
|
+
* trigger both packages ([a8db647](https://github.com/monerium/public-monorepo/commit/a8db647e694abd753bdb06df352c1d72617d7e67))
|
|
108
|
+
* trigger sdk ([ee1b950](https://github.com/monerium/public-monorepo/commit/ee1b9502c61655e5f0771827fdd116b58c748834))
|
|
109
|
+
* typedoc deps ([0696536](https://github.com/monerium/public-monorepo/commit/0696536edd834b6bf2ca6bf6ea39914d37fcda9c))
|
|
110
|
+
* uff ([ae8e9e5](https://github.com/monerium/public-monorepo/commit/ae8e9e510b5fad9997addd31e1153e9ef66a9d5c))
|
|
111
|
+
* version ([f3a1b1d](https://github.com/monerium/public-monorepo/commit/f3a1b1d7750a2f743d84426e60ea368909dcf93d))
|
|
112
|
+
* yarn instead of npm ([5b86535](https://github.com/monerium/public-monorepo/commit/5b86535ed225effa0d13b6b60388bf05783ebe63))
|
|
113
|
+
|
|
114
|
+
## [2.7.2](https://github.com/monerium/public-monorepo/compare/sdk-v2.7.2...sdk-v2.7.2) (2023-11-17)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
### Features
|
|
118
|
+
|
|
119
|
+
* add docs ([f5ba19d](https://github.com/monerium/public-monorepo/commit/f5ba19d5600e01cd0c97467a0a1f2fe94a2f40fc))
|
|
120
|
+
* new functions added + arguments to class instance ([b5b8c5d](https://github.com/monerium/public-monorepo/commit/b5b8c5d3fbae6ce7a90569b74d887b81d9f3a336))
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
### Bug Fixes
|
|
124
|
+
|
|
125
|
+
* add example, fix sdk for backwards compatibility and update README ([6992417](https://github.com/monerium/public-monorepo/commit/6992417e44b442a06b1d65f88d588d17e71b4562))
|
|
126
|
+
* add removal date to deprecated methods and add connect as deprecated ([c1e02e2](https://github.com/monerium/public-monorepo/commit/c1e02e273b08b091475757e0e68051098e20a5a0))
|
|
127
|
+
* add yarnrc to each lib ([6dc9f7a](https://github.com/monerium/public-monorepo/commit/6dc9f7a4a46e24596c862df83823f90be5dad803))
|
|
128
|
+
* continue on error gh-pages ([d033048](https://github.com/monerium/public-monorepo/commit/d033048a490390815ef17dad45b526b04898c2ae))
|
|
129
|
+
* debug ([b2543eb](https://github.com/monerium/public-monorepo/commit/b2543eb222cbe74131377e164c28c3093b72be5f))
|
|
130
|
+
* debug ([ea1bd38](https://github.com/monerium/public-monorepo/commit/ea1bd38c8f8f98cf65a9bcab615faa540a8b7324))
|
|
131
|
+
* debug ([20e3ccb](https://github.com/monerium/public-monorepo/commit/20e3ccb3297e3bba02be86349a151b1bf0ed8f5c))
|
|
132
|
+
* dep ([0d9953b](https://github.com/monerium/public-monorepo/commit/0d9953b5a2e259851d05d422ecf7f2c1fa36c6ea))
|
|
133
|
+
* expose getChain and getNetwork + update docs ([085d9bd](https://github.com/monerium/public-monorepo/commit/085d9bd261342d14936a7f9f1d5cc1fdd859ec26))
|
|
134
|
+
* letsgo ([af653ce](https://github.com/monerium/public-monorepo/commit/af653ce744b333023892370b21ec28738c82910e))
|
|
135
|
+
* lol ([630cb9f](https://github.com/monerium/public-monorepo/commit/630cb9fa3f4d7efa363b7fd9079c4e5e4e26bdd3))
|
|
136
|
+
* perm ([3210011](https://github.com/monerium/public-monorepo/commit/32100114916d85b1b1982cd942c3181210943ee9))
|
|
137
|
+
* props to auto-link ([ce85efd](https://github.com/monerium/public-monorepo/commit/ce85efd534cfcac7fb9e7804b733641aeb752f4f))
|
|
138
|
+
* publish ([537b336](https://github.com/monerium/public-monorepo/commit/537b336180df288e0653b0db7230ae84758f8475))
|
|
139
|
+
* publish not working ([50a2a05](https://github.com/monerium/public-monorepo/commit/50a2a0583c03ef7a66a605c8215f72256192b8e2))
|
|
140
|
+
* releaseas ([db309d2](https://github.com/monerium/public-monorepo/commit/db309d2635196bac5df230e886d70c395c58b06b))
|
|
141
|
+
* rewrite the CHANGELOG after a lot messy testing ([fb1a3c9](https://github.com/monerium/public-monorepo/commit/fb1a3c9517c269c49bc6ad9e492c79481184afcd))
|
|
142
|
+
* sdk version ([27c479c](https://github.com/monerium/public-monorepo/commit/27c479c3b324a33ea7e44613601e4f32269e9082))
|
|
143
|
+
* static files not deployed ([a1131d7](https://github.com/monerium/public-monorepo/commit/a1131d7ab988a93e41b7f3b65429b5aa27ff588e))
|
|
144
|
+
* stuff ([6b06483](https://github.com/monerium/public-monorepo/commit/6b06483ad5ca8f3e00e8d88f2739cf2526ae2101))
|
|
145
|
+
* stuff ([1dadd44](https://github.com/monerium/public-monorepo/commit/1dadd44f07fb2234bf1fca1f1f20dbc4158cface))
|
|
146
|
+
* syntax ([f8cfbad](https://github.com/monerium/public-monorepo/commit/f8cfbad0fa536808ddc988cf9e6ca8aef5247ef7))
|
|
147
|
+
* test ([2c52f99](https://github.com/monerium/public-monorepo/commit/2c52f99e5c2fc19c502fae01e7ca105010df979f))
|
|
148
|
+
* test ([21c2cb8](https://github.com/monerium/public-monorepo/commit/21c2cb8c936410f6701a87313cb1bcb4dd9f281f))
|
|
149
|
+
* test ([2a612b1](https://github.com/monerium/public-monorepo/commit/2a612b1f93a59ec709c9f328c7ba4bc910971de9))
|
|
150
|
+
* test ([0dfd8e1](https://github.com/monerium/public-monorepo/commit/0dfd8e1489db8096f1cb66a3816e410ddb996d64))
|
|
151
|
+
* test deploy ([1a3e311](https://github.com/monerium/public-monorepo/commit/1a3e311fdc7bde2f17390e4cdb3f0a48859e5cf9))
|
|
152
|
+
* test: ([e122f61](https://github.com/monerium/public-monorepo/commit/e122f61e5f907785b6076bfda855c275bcfce1d6))
|
|
153
|
+
* testing ([24389c9](https://github.com/monerium/public-monorepo/commit/24389c9f243671c548d957dc499689e58e0bc3f6))
|
|
154
|
+
* testing affected ([60059eb](https://github.com/monerium/public-monorepo/commit/60059ebc035dccf1dcbb4eb64cf0eeb071020caf))
|
|
155
|
+
* testing affected ([a10f49a](https://github.com/monerium/public-monorepo/commit/a10f49a4840218c9f5fa76463b3132401d0a23f4))
|
|
156
|
+
* tests and release action ([a18438c](https://github.com/monerium/public-monorepo/commit/a18438c2974e79975722afe8f7f9679358f32da5))
|
|
157
|
+
* trigger both packages ([a8db647](https://github.com/monerium/public-monorepo/commit/a8db647e694abd753bdb06df352c1d72617d7e67))
|
|
158
|
+
* trigger sdk ([ee1b950](https://github.com/monerium/public-monorepo/commit/ee1b9502c61655e5f0771827fdd116b58c748834))
|
|
159
|
+
* typedoc deps ([0696536](https://github.com/monerium/public-monorepo/commit/0696536edd834b6bf2ca6bf6ea39914d37fcda9c))
|
|
160
|
+
* uff ([ae8e9e5](https://github.com/monerium/public-monorepo/commit/ae8e9e510b5fad9997addd31e1153e9ef66a9d5c))
|
|
161
|
+
* version ([f3a1b1d](https://github.com/monerium/public-monorepo/commit/f3a1b1d7750a2f743d84426e60ea368909dcf93d))
|
|
162
|
+
* yarn instead of npm ([5b86535](https://github.com/monerium/public-monorepo/commit/5b86535ed225effa0d13b6b60388bf05783ebe63))
|
|
163
|
+
|
|
164
|
+
## [2.7.2](https://github.com/monerium/public-monorepo/compare/sdk-v2.7.2...sdk-v2.7.2) (2023-11-17)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
### Features
|
|
168
|
+
|
|
169
|
+
* add docs ([f5ba19d](https://github.com/monerium/public-monorepo/commit/f5ba19d5600e01cd0c97467a0a1f2fe94a2f40fc))
|
|
170
|
+
* new functions added + arguments to class instance ([b5b8c5d](https://github.com/monerium/public-monorepo/commit/b5b8c5d3fbae6ce7a90569b74d887b81d9f3a336))
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
### Bug Fixes
|
|
174
|
+
|
|
175
|
+
* add example, fix sdk for backwards compatibility and update README ([6992417](https://github.com/monerium/public-monorepo/commit/6992417e44b442a06b1d65f88d588d17e71b4562))
|
|
176
|
+
* add removal date to deprecated methods and add connect as deprecated ([c1e02e2](https://github.com/monerium/public-monorepo/commit/c1e02e273b08b091475757e0e68051098e20a5a0))
|
|
177
|
+
* add yarnrc to each lib ([6dc9f7a](https://github.com/monerium/public-monorepo/commit/6dc9f7a4a46e24596c862df83823f90be5dad803))
|
|
178
|
+
* continue on error gh-pages ([d033048](https://github.com/monerium/public-monorepo/commit/d033048a490390815ef17dad45b526b04898c2ae))
|
|
179
|
+
* debug ([b2543eb](https://github.com/monerium/public-monorepo/commit/b2543eb222cbe74131377e164c28c3093b72be5f))
|
|
180
|
+
* debug ([ea1bd38](https://github.com/monerium/public-monorepo/commit/ea1bd38c8f8f98cf65a9bcab615faa540a8b7324))
|
|
181
|
+
* debug ([20e3ccb](https://github.com/monerium/public-monorepo/commit/20e3ccb3297e3bba02be86349a151b1bf0ed8f5c))
|
|
182
|
+
* dep ([0d9953b](https://github.com/monerium/public-monorepo/commit/0d9953b5a2e259851d05d422ecf7f2c1fa36c6ea))
|
|
183
|
+
* expose getChain and getNetwork + update docs ([085d9bd](https://github.com/monerium/public-monorepo/commit/085d9bd261342d14936a7f9f1d5cc1fdd859ec26))
|
|
184
|
+
* letsgo ([af653ce](https://github.com/monerium/public-monorepo/commit/af653ce744b333023892370b21ec28738c82910e))
|
|
185
|
+
* lol ([630cb9f](https://github.com/monerium/public-monorepo/commit/630cb9fa3f4d7efa363b7fd9079c4e5e4e26bdd3))
|
|
186
|
+
* perm ([3210011](https://github.com/monerium/public-monorepo/commit/32100114916d85b1b1982cd942c3181210943ee9))
|
|
187
|
+
* props to auto-link ([ce85efd](https://github.com/monerium/public-monorepo/commit/ce85efd534cfcac7fb9e7804b733641aeb752f4f))
|
|
188
|
+
* publish ([537b336](https://github.com/monerium/public-monorepo/commit/537b336180df288e0653b0db7230ae84758f8475))
|
|
189
|
+
* publish not working ([50a2a05](https://github.com/monerium/public-monorepo/commit/50a2a0583c03ef7a66a605c8215f72256192b8e2))
|
|
190
|
+
* releaseas ([db309d2](https://github.com/monerium/public-monorepo/commit/db309d2635196bac5df230e886d70c395c58b06b))
|
|
191
|
+
* rewrite the CHANGELOG after a lot messy testing ([fb1a3c9](https://github.com/monerium/public-monorepo/commit/fb1a3c9517c269c49bc6ad9e492c79481184afcd))
|
|
192
|
+
* sdk version ([27c479c](https://github.com/monerium/public-monorepo/commit/27c479c3b324a33ea7e44613601e4f32269e9082))
|
|
193
|
+
* static files not deployed ([a1131d7](https://github.com/monerium/public-monorepo/commit/a1131d7ab988a93e41b7f3b65429b5aa27ff588e))
|
|
194
|
+
* stuff ([6b06483](https://github.com/monerium/public-monorepo/commit/6b06483ad5ca8f3e00e8d88f2739cf2526ae2101))
|
|
195
|
+
* stuff ([1dadd44](https://github.com/monerium/public-monorepo/commit/1dadd44f07fb2234bf1fca1f1f20dbc4158cface))
|
|
196
|
+
* syntax ([f8cfbad](https://github.com/monerium/public-monorepo/commit/f8cfbad0fa536808ddc988cf9e6ca8aef5247ef7))
|
|
197
|
+
* test ([2c52f99](https://github.com/monerium/public-monorepo/commit/2c52f99e5c2fc19c502fae01e7ca105010df979f))
|
|
198
|
+
* test ([21c2cb8](https://github.com/monerium/public-monorepo/commit/21c2cb8c936410f6701a87313cb1bcb4dd9f281f))
|
|
199
|
+
* test ([2a612b1](https://github.com/monerium/public-monorepo/commit/2a612b1f93a59ec709c9f328c7ba4bc910971de9))
|
|
200
|
+
* test ([0dfd8e1](https://github.com/monerium/public-monorepo/commit/0dfd8e1489db8096f1cb66a3816e410ddb996d64))
|
|
201
|
+
* test deploy ([1a3e311](https://github.com/monerium/public-monorepo/commit/1a3e311fdc7bde2f17390e4cdb3f0a48859e5cf9))
|
|
202
|
+
* test: ([e122f61](https://github.com/monerium/public-monorepo/commit/e122f61e5f907785b6076bfda855c275bcfce1d6))
|
|
203
|
+
* testing ([24389c9](https://github.com/monerium/public-monorepo/commit/24389c9f243671c548d957dc499689e58e0bc3f6))
|
|
204
|
+
* testing affected ([60059eb](https://github.com/monerium/public-monorepo/commit/60059ebc035dccf1dcbb4eb64cf0eeb071020caf))
|
|
205
|
+
* testing affected ([a10f49a](https://github.com/monerium/public-monorepo/commit/a10f49a4840218c9f5fa76463b3132401d0a23f4))
|
|
206
|
+
* trigger both packages ([a8db647](https://github.com/monerium/public-monorepo/commit/a8db647e694abd753bdb06df352c1d72617d7e67))
|
|
207
|
+
* trigger sdk ([ee1b950](https://github.com/monerium/public-monorepo/commit/ee1b9502c61655e5f0771827fdd116b58c748834))
|
|
208
|
+
* typedoc deps ([0696536](https://github.com/monerium/public-monorepo/commit/0696536edd834b6bf2ca6bf6ea39914d37fcda9c))
|
|
209
|
+
* uff ([ae8e9e5](https://github.com/monerium/public-monorepo/commit/ae8e9e510b5fad9997addd31e1153e9ef66a9d5c))
|
|
210
|
+
* version ([f3a1b1d](https://github.com/monerium/public-monorepo/commit/f3a1b1d7750a2f743d84426e60ea368909dcf93d))
|
|
211
|
+
* yarn instead of npm ([5b86535](https://github.com/monerium/public-monorepo/commit/5b86535ed225effa0d13b6b60388bf05783ebe63))
|
|
212
|
+
|
|
213
|
+
## [2.7.2](https://github.com/monerium/public-monorepo/compare/sdk-v2.7.2...sdk-v2.7.2) (2023-11-17)
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
### Bug Fixes
|
|
217
|
+
|
|
218
|
+
* add removal date to deprecated methods and add connect as deprecated ([c1e02e2](https://github.com/monerium/public-monorepo/commit/c1e02e273b08b091475757e0e68051098e20a5a0))
|
|
219
|
+
|
|
220
|
+
## [2.7.2](https://github.com/monerium/public-monorepo/compare/sdk-v2.7.2...sdk-v2.7.2) (2023-11-17)
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
### Bug Fixes
|
|
224
|
+
|
|
225
|
+
* add removal date to deprecated methods and add connect as deprecated ([c1e02e2](https://github.com/monerium/public-monorepo/commit/c1e02e273b08b091475757e0e68051098e20a5a0))
|
|
226
|
+
|
|
227
|
+
## [2.7.2](https://github.com/monerium/public-monorepo/compare/sdk-v2.7.1...sdk-v2.7.2) (2023-11-17)
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
### Bug Fixes
|
|
231
|
+
|
|
232
|
+
* expose getChain and getNetwork + update docs ([085d9bd](https://github.com/monerium/public-monorepo/commit/085d9bd261342d14936a7f9f1d5cc1fdd859ec26))
|
|
233
|
+
|
|
50
234
|
## [2.7.0](https://github.com/monerium/public-monorepo/compare/sdk-v2.7.0...sdk-v2.7.0) (2023-11-13)
|
|
51
235
|
|
|
52
236
|
### Features
|
package/README.md
CHANGED
|
@@ -64,6 +64,8 @@ const monerium = new MoneriumClient({
|
|
|
64
64
|
clientSecret: 'your_client_secret', // replace with your client secret
|
|
65
65
|
});
|
|
66
66
|
|
|
67
|
+
await monerium.getAccess();
|
|
68
|
+
|
|
67
69
|
// Retrieve authentication data after successful authentication.
|
|
68
70
|
await monerium.getAuthContext();
|
|
69
71
|
|
|
@@ -107,7 +109,7 @@ export function App() {
|
|
|
107
109
|
useEffect(() => {
|
|
108
110
|
const connect = async () => {
|
|
109
111
|
if (monerium) {
|
|
110
|
-
setIsAuthorized(await monerium.
|
|
112
|
+
setIsAuthorized(await monerium.getAccess());
|
|
111
113
|
}
|
|
112
114
|
};
|
|
113
115
|
|
|
@@ -311,6 +313,35 @@ API documentation:
|
|
|
311
313
|
|
|
312
314
|
- [/files](https://monerium.dev/api-docs#operation/supporting-document)
|
|
313
315
|
|
|
316
|
+
#### Subscribe to order events
|
|
317
|
+
|
|
318
|
+
````ts
|
|
319
|
+
import { OrderState } from '@monerium/sdk';
|
|
320
|
+
const [orderState, setOrderState] = useState<OrderState>();
|
|
321
|
+
// Subscribe to order events
|
|
322
|
+
monerium.subscribeOrders(OrderState.pending, (notification) => {
|
|
323
|
+
setOrderState(notification.meta.state)
|
|
324
|
+
})
|
|
325
|
+
|
|
326
|
+
monerium.subscribeOrders(OrderState.placed, (notification) => {
|
|
327
|
+
setOrderState(notification.meta.state)
|
|
328
|
+
})
|
|
329
|
+
|
|
330
|
+
monerium.subscribeOrders(OrderState.rejected, (notification) => {
|
|
331
|
+
setOrderState(notification.meta.state)
|
|
332
|
+
setTimeout(() => {
|
|
333
|
+
setOrderState(undefined)
|
|
334
|
+
}, 5000)
|
|
335
|
+
})
|
|
336
|
+
|
|
337
|
+
monerium.subscribeOrders(OrderState.processed, (notification) => {
|
|
338
|
+
setOrderState(notification.meta.state)
|
|
339
|
+
setTimeout(() => {
|
|
340
|
+
setOrderState(undefined)
|
|
341
|
+
}, 5000)
|
|
342
|
+
})
|
|
343
|
+
```
|
|
344
|
+
|
|
314
345
|
## API Reference
|
|
315
346
|
|
|
316
347
|
[API Documentation](https://monerium.dev/docs/api)
|
|
@@ -334,7 +365,7 @@ yarn watch
|
|
|
334
365
|
# Update the docs. This will run the build and update the docs in the static folder.
|
|
335
366
|
# Open static/index.html in your browser to view the docs. Refresh the page to see changes.
|
|
336
367
|
yarn docs:watch
|
|
337
|
-
|
|
368
|
+
````
|
|
338
369
|
|
|
339
370
|
Smart IDEs (such as VSCode) require [special configuration](https://yarnpkg.com/getting-started/editor-sdks) for TypeScript to work when using Yarn Plug'n'Play installs.
|
|
340
371
|
|
package/dist/client.d.ts
CHANGED
|
@@ -23,11 +23,12 @@ export declare class MoneriumClient {
|
|
|
23
23
|
* {@link https://monerium.dev/api-docs#operation/auth}
|
|
24
24
|
*/
|
|
25
25
|
authorize(client?: AuthFlowOptions): Promise<void>;
|
|
26
|
-
connect(client?: AuthorizationCodeCredentials | ClientCredentials): Promise<boolean>;
|
|
27
26
|
/**
|
|
28
|
-
*
|
|
27
|
+
* Get access to the API
|
|
28
|
+
* @param {AuthorizationCodeCredentials | ClientCredentials} client - the client credentials
|
|
29
|
+
* @returns boolean to indicate if access has been granted
|
|
29
30
|
*/
|
|
30
|
-
|
|
31
|
+
getAccess(client?: AuthorizationCodeCredentials | ClientCredentials): Promise<boolean>;
|
|
31
32
|
/**
|
|
32
33
|
* {@link https://monerium.dev/api-docs#operation/auth-context}
|
|
33
34
|
*/
|
|
@@ -69,7 +70,14 @@ export declare class MoneriumClient {
|
|
|
69
70
|
uploadSupportingDocument(document: File): Promise<SupportingDoc>;
|
|
70
71
|
connectOrderSocket(): Promise<void>;
|
|
71
72
|
subscribeToOrderNotifications: () => WebSocket;
|
|
73
|
+
/**
|
|
74
|
+
* Cleanups the socket and the subscriptions
|
|
75
|
+
*/
|
|
72
76
|
disconnect(): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Revokes access
|
|
79
|
+
*/
|
|
80
|
+
revokeAccess(): Promise<void>;
|
|
73
81
|
/**
|
|
74
82
|
* Subscribe to MoneriumEvent to receive notifications using the Monerium API (WebSocket)
|
|
75
83
|
* We are setting a subscription map because we need the user to have a token to start the WebSocket connection
|
|
@@ -84,15 +92,19 @@ export declare class MoneriumClient {
|
|
|
84
92
|
*/
|
|
85
93
|
unsubscribeOrders(event: MoneriumEvent): void;
|
|
86
94
|
/**
|
|
87
|
-
* @deprecated since v2.6.4, use {@link
|
|
95
|
+
* @deprecated since v2.6.4, will be removed in 2.7.2+, use {@link getAccess} instead.
|
|
88
96
|
*/
|
|
89
97
|
auth: (args: AuthArgs) => Promise<BearerProfile>;
|
|
90
98
|
/**
|
|
91
|
-
* @deprecated since v2.
|
|
99
|
+
* @deprecated since v2.7.1, will be removed in 2.7.2+, use {@link getAccess} instead.
|
|
100
|
+
*/
|
|
101
|
+
connect: (args: AuthArgs) => Promise<BearerProfile>;
|
|
102
|
+
/**
|
|
103
|
+
* @deprecated since v2.6.4, will be removed in 2.7.2+, use {@link authorize} instead.
|
|
92
104
|
*/
|
|
93
105
|
getAuthFlowURI: (args: PKCERequestArgs) => string;
|
|
94
106
|
/**
|
|
95
|
-
* @deprecated since v2.0.7, use {@link getAuthFlowURI} instead.
|
|
107
|
+
* @deprecated since v2.0.7, will be removed in 2.7.2+, use {@link getAuthFlowURI} instead.
|
|
96
108
|
*/
|
|
97
109
|
pkceRequest: (args: PKCERequestArgs) => string;
|
|
98
110
|
getEnvironment: () => Environment;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var G=(e,r,t)=>{if(!r.has(e))throw TypeError("Cannot "+t)};var w=(e,r,t)=>(G(e,r,"read from private field"),t?t.call(e):r.get(e)),T=(e,r,t)=>{if(r.has(e))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(e):r.set(e,t)},A=(e,r,t,n)=>(G(e,r,"write to private field"),n?n.call(e,t):r.set(e,t),t);var I=(e,r,t)=>(G(e,r,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var re=(e=>(e.eur="eur",e))(re||{}),te=(e=>(e.corporate="corporate",e.personal="personal",e))(te||{}),ne=(e=>(e.read="read",e.write="write",e))(ne||{}),oe=(e=>(e.absent="absent",e.submitted="submitted",e.pending="pending",e.confirmed="confirmed",e))(oe||{}),se=(e=>(e.approved="approved",e.rejected="rejected",e.unknown="unknown",e))(se||{}),ie=(e=>(e.requested="requested",e.approved="approved",e.pending="pending",e))(ie||{}),ae=(e=>(e.iban="iban",e.scan="scan",e))(ae||{}),ce=(e=>(e.redeem="redeem",e.issue="issue",e))(ce||{}),ue=(e=>(e.placed="placed",e.pending="pending",e.processed="processed",e.rejected="rejected",e))(ue||{});const de=e=>{if(e.toString()==="Invalid Date")throw e;const r=n=>n<10?"0"+n:n,t=n=>{if(n===0)return"Z";const u=n>0?"-":"+";return n=Math.abs(n),u+r(Math.floor(n/60))+":"+r(n%60)};return e.getFullYear()+"-"+r(e.getMonth()+1)+"-"+r(e.getDate())+"T"+r(e.getHours())+":"+r(e.getMinutes())+":"+r(e.getSeconds())+t(e.getTimezoneOffset())},_e=(e,r)=>`Send EUR ${e} to ${r} at ${de(new Date)}`,D=e=>{var r;return e&&((r=Object.entries(e))==null?void 0:r.length)>0?Object.entries(e).map(([t,n])=>`${encodeURIComponent(t)}=${encodeURIComponent(n)}`).join("&"):""},be=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}`)}},Se=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}`)}},J={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"}}},Be="I hereby declare that I am the address owner.",U="monerium.sdk.code_verifier",V="monerium.sdk.refresh_token",ke={LINK_MESSAGE:Be,STORAGE_CODE_VERIFIER:U,STORAGE_REFRESH_TOKEN:V};var L=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function he(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ce(e){if(e.__esModule)return e;var r=e.default;if(typeof r=="function"){var t=function n(){if(this instanceof n){var u=[null];u.push.apply(u,arguments);var i=Function.bind.apply(r,u);return new i}return r.apply(this,arguments)};t.prototype=r.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var u=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,u.get?u:{enumerable:!0,get:function(){return e[n]}})}),t}var fe={exports:{}};function xe(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 Q={exports:{}};const Ee={},Ae=Object.freeze(Object.defineProperty({__proto__:null,default:Ee},Symbol.toStringTag,{value:"Module"})),Ie=Ce(Ae);var X;function le(){return X||(X=1,function(e,r){(function(t,n){e.exports=n()})(L,function(){var t=t||function(n,u){var i;if(typeof window<"u"&&window.crypto&&(i=window.crypto),typeof self<"u"&&self.crypto&&(i=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(i=globalThis.crypto),!i&&typeof window<"u"&&window.msCrypto&&(i=window.msCrypto),!i&&typeof L<"u"&&L.crypto&&(i=L.crypto),!i&&typeof xe=="function")try{i=Ie}catch{}var v=function(){if(i){if(typeof i.getRandomValues=="function")try{return i.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof i.randomBytes=="function")try{return i.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},B=Object.create||function(){function o(){}return function(s){var c;return o.prototype=s,c=new o,o.prototype=null,c}}(),p={},y=p.lib={},m=y.Base=function(){return{extend:function(o){var s=B(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||h).stringify(this)},concat:function(o){var s=this.words,c=o.words,d=this.sigBytes,_=o.sigBytes;if(this.clamp(),d%4)for(var S=0;S<_;S++){var k=c[S>>>2]>>>24-S%4*8&255;s[d+S>>>2]|=k<<24-(d+S)%4*8}else for(var C=0;C<_;C+=4)s[d+C>>>2]=c[C>>>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=[],c=0;c<o;c+=4)s.push(v());return new g.init(s,o)}}),b=p.enc={},h=b.Hex={stringify:function(o){for(var s=o.words,c=o.sigBytes,d=[],_=0;_<c;_++){var S=s[_>>>2]>>>24-_%4*8&255;d.push((S>>>4).toString(16)),d.push((S&15).toString(16))}return d.join("")},parse:function(o){for(var s=o.length,c=[],d=0;d<s;d+=2)c[d>>>3]|=parseInt(o.substr(d,2),16)<<24-d%8*4;return new g.init(c,s/2)}},l=b.Latin1={stringify:function(o){for(var s=o.words,c=o.sigBytes,d=[],_=0;_<c;_++){var S=s[_>>>2]>>>24-_%4*8&255;d.push(String.fromCharCode(S))}return d.join("")},parse:function(o){for(var s=o.length,c=[],d=0;d<s;d++)c[d>>>2]|=(o.charCodeAt(d)&255)<<24-d%4*8;return new g.init(c,s)}},a=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)))}},f=y.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new g.init,this._nDataBytes=0},_append:function(o){typeof o=="string"&&(o=a.parse(o)),this._data.concat(o),this._nDataBytes+=o.sigBytes},_process:function(o){var s,c=this._data,d=c.words,_=c.sigBytes,S=this.blockSize,k=S*4,C=_/k;o?C=n.ceil(C):C=n.max((C|0)-this._minBufferSize,0);var M=C*S,z=n.min(M*4,_);if(M){for(var j=0;j<M;j+=S)this._doProcessBlock(d,j);s=d.splice(0,M),c.sigBytes-=z}return new g.init(s,z)},clone:function(){var o=m.clone.call(this);return o._data=this._data.clone(),o},_minBufferSize:0});y.Hasher=f.extend({cfg:m.extend(),init:function(o){this.cfg=this.cfg.extend(o),this.reset()},reset:function(){f.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,c){return new o.init(c).finalize(s)}},_createHmacHelper:function(o){return function(s,c){return new x.HMAC.init(o,c).finalize(s)}}});var x=p.algo={};return p}(Math);return t})}(Q)),Q.exports}(function(e,r){(function(t,n){e.exports=n(le())})(L,function(t){return function(){var n=t,u=n.lib,i=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 h=[],l=0;l<g;l+=3)for(var a=m[l>>>2]>>>24-l%4*8&255,f=m[l+1>>>2]>>>24-(l+1)%4*8&255,x=m[l+2>>>2]>>>24-(l+2)%4*8&255,o=a<<16|f<<8|x,s=0;s<4&&l+s*.75<g;s++)h.push(b.charAt(o>>>6*(3-s)&63));var c=b.charAt(64);if(c)for(;h.length%4;)h.push(c);return h.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 h=0;h<g.length;h++)b[g.charCodeAt(h)]=h}var l=g.charAt(64);if(l){var a=p.indexOf(l);a!==-1&&(m=a)}return B(p,m,b)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function B(p,y,m){for(var g=[],b=0,h=0;h<y;h++)if(h%4){var l=m[p.charCodeAt(h-1)]<<h%4*2,a=m[p.charCodeAt(h)]>>>6-h%4*2,f=l|a;g[b>>>2]|=f<<24-b%4*8,b++}return i.create(g,b)}}(),t.enc.Base64url})})(fe);var Re=fe.exports;const Oe=he(Re);var pe={exports:{}};(function(e,r){(function(t,n){e.exports=n(le())})(L,function(t){return function(n){var u=t,i=u.lib,v=i.WordArray,B=i.Hasher,p=u.algo,y=[],m=[];(function(){function h(x){for(var o=n.sqrt(x),s=2;s<=o;s++)if(!(x%s))return!1;return!0}function l(x){return(x-(x|0))*4294967296|0}for(var a=2,f=0;f<64;)h(a)&&(f<8&&(y[f]=l(n.pow(a,1/2))),m[f]=l(n.pow(a,1/3)),f++),a++})();var g=[],b=p.SHA256=B.extend({_doReset:function(){this._hash=new v.init(y.slice(0))},_doProcessBlock:function(h,l){for(var a=this._hash.words,f=a[0],x=a[1],o=a[2],s=a[3],c=a[4],d=a[5],_=a[6],S=a[7],k=0;k<64;k++){if(k<16)g[k]=h[l+k]|0;else{var C=g[k-15],M=(C<<25|C>>>7)^(C<<14|C>>>18)^C>>>3,z=g[k-2],j=(z<<15|z>>>17)^(z<<13|z>>>19)^z>>>10;g[k]=M+g[k-7]+j+g[k-16]}var ve=c&d^~c&_,ge=f&x^f&o^x&o,we=(f<<30|f>>>2)^(f<<19|f>>>13)^(f<<10|f>>>22),ye=(c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25),K=S+ye+ve+m[k]+g[k],me=we+ge;S=_,_=d,d=c,c=s+K|0,s=o,o=x,x=f,f=K+me|0}a[0]=a[0]+f|0,a[1]=a[1]+x|0,a[2]=a[2]+o|0,a[3]=a[3]+s|0,a[4]=a[4]+c|0,a[5]=a[5]+d|0,a[6]=a[6]+_|0,a[7]=a[7]+S|0},_doFinalize:function(){var h=this._data,l=h.words,a=this._nDataBytes*8,f=h.sigBytes*8;return l[f>>>5]|=128<<24-f%32,l[(f+64>>>9<<4)+14]=n.floor(a/4294967296),l[(f+64>>>9<<4)+15]=a,h.sigBytes=l.length*4,this._process(),this._hash},clone:function(){var h=B.clone.call(this);return h._hash=this._hash.clone(),h}});u.SHA256=B._createHelper(b),u.HmacSHA256=B._createHmacHelper(b)}(Math),t.SHA256})})(pe);var Pe=pe.exports;const Te=he(Pe),$e=(e,r)=>{const{client_id:t,redirect_uri:n,scope:u,state:i,chainId:v,chain:B,network:p,address:y,signature:m}=e,g=y?{address:y,...m!==void 0?{signature:m}:{},...v!==void 0||B!==void 0?{chain:v?be(v):B}:{},...v!==void 0||p!==void 0?{network:v?Se(v):p}:{}}:{};return D({client_id:t,redirect_uri:n,...u!==void 0?{scope:u}:{},...i!==void 0?{state:i}:{},code_challenge:r,code_challenge_method:"S256",response_type:"code",...g})},ze=()=>{let e="";const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=r.length;let n=0;for(;n<128;)e+=r.charAt(Math.floor(Math.random()*t)),n+=1;return e},Ue=e=>Oe.stringify(Te(e)),Y=(e,r)=>{const t=ze(),n=Ue(t);return sessionStorage.setItem(U,t||""),`${e}/auth?${$e(r,n)}`},He=()=>{const e=window.location.href,[r,t]=e.split("?");t&&window.history.replaceState(null,"",r)},ee=e=>e.code!=null,Me=e=>e.refresh_token!=null,Le=e=>e.client_secret!=null,je=async(e,r,t,n)=>{const u=await fetch(`${e}`,{method:r,headers:n,body:t});let i;const v=await u.text();try{i=JSON.parse(v)}catch{throw v}if(!u.ok)throw i;return i},Z=typeof window>"u";var O,q,H,$,P,E,R,F,N,W;class qe{constructor(r){T(this,E);T(this,O,void 0);T(this,q,void 0);T(this,H,void 0);T(this,$,void 0);T(this,P,void 0);T(this,F,void 0);T(this,N,void 0);T(this,W,void 0);if(A(this,$,new Map),this.isAuthorized=!!this.bearerProfile,A(this,F,async(t,n,u)=>{const i=sessionStorage.getItem(U)||"";if(!i)throw new Error("Code verifier not found");return this.codeVerifier=i,sessionStorage.removeItem(U),await this.getBearerToken({code:u,redirect_uri:n,client_id:t,code_verifier:i})}),A(this,N,async({clientId:t,clientSecret:n})=>await this.getBearerToken({client_id:t,client_secret:n})),A(this,W,async(t,n)=>await this.getBearerToken({refresh_token:n,client_id:t})),this.subscribeToOrderNotifications=()=>{var u,i;const t=`${w(this,O).wss}/profiles/${(u=this.bearerProfile)==null?void 0:u.profile}/orders?access_token=${(i=this.bearerProfile)==null?void 0:i.access_token}`,n=new WebSocket(t);return n.addEventListener("open",()=>{console.info(`Socket connected: ${t}`)}),n.addEventListener("error",v=>{throw console.error(v),new Error(`Socket error: ${t}`)}),n.addEventListener("message",v=>{var p;const B=JSON.parse(v.data);(p=w(this,$).get(B.meta.state))==null||p(B)}),n.addEventListener("close",()=>{console.info(`Socket connection closed: ${t}`)}),n},this.auth=async t=>await this.getBearerToken(t),this.getAuthFlowURI=t=>{const n=Y(w(this,O).api,t);return this.codeVerifier=sessionStorage.getItem(U),n},this.pkceRequest=t=>this.getAuthFlowURI(t),this.getEnvironment=()=>w(this,O),!r){A(this,O,J.environments.sandbox);return}if(typeof r=="string")A(this,O,J.environments[r]);else if(A(this,O,J.environments[r.environment||"sandbox"]),Z){const{clientId:t,clientSecret:n}=r;A(this,P,{clientId:t,clientSecret:n})}else{const{clientId:t,redirectUrl:n}=r;A(this,P,{clientId:t,redirectUrl:n})}}async authorize(r){var i,v;const t=(r==null?void 0:r.clientId)||((i=w(this,P))==null?void 0:i.clientId),n=(r==null?void 0:r.redirectUrl)||((v=w(this,P))==null?void 0:v.redirectUrl);if(!t)throw new Error("Missing ClientId");if(!n)throw new Error("Missing RedirectUrl");const u=Y(w(this,O).api,{client_id:t,redirect_uri:n,address:r==null?void 0:r.address,signature:r==null?void 0:r.signature,chainId:r==null?void 0:r.chainId});window.location.replace(u)}async connect(r){var B,p,y;const t=(r==null?void 0:r.clientId)||((B=w(this,P))==null?void 0:B.clientId);if((r==null?void 0:r.clientSecret)||((p=w(this,P))==null?void 0:p.clientSecret)){if(!Z)throw new Error("Only use client credentials on server side");return await w(this,N).call(this,w(this,P)),!!this.bearerProfile}const u=(r==null?void 0:r.redirectUrl)||((y=w(this,P))==null?void 0:y.redirectUrl);if(!t)throw new Error("Missing ClientId");if(Z)throw new Error("This only works on client side");const i=new URLSearchParams(window.location.search).get("code")||void 0,v=sessionStorage.getItem(V)||void 0;return i?await w(this,F).call(this,t,u,i):v&&await w(this,W).call(this,t,v),!!this.bearerProfile}async getBearerToken(r){let t;if(ee(r))t={...r,grant_type:"authorization_code"};else if(Me(r))t={...r,grant_type:"refresh_token"};else if(Le(r))t={...r,grant_type:"client_credentials"};else throw new Error("Authentication method could not be detected.");return await I(this,E,R).call(this,"post","auth/token",t,!0).then(n=>{var u;this.bearerProfile=n,this.isAuthorized=!!n,A(this,q,`Bearer ${n==null?void 0:n.access_token}`),window.sessionStorage.setItem(V,((u=this.bearerProfile)==null?void 0:u.refresh_token)||"")}).catch(n=>{throw sessionStorage.removeItem(U),sessionStorage.removeItem(V),new Error(n==null?void 0:n.message)}),ee(r)&&He(),this.bearerProfile}getAuthContext(){return I(this,E,R).call(this,"get","auth/context")}getProfile(r){return I(this,E,R).call(this,"get",`profiles/${r}`)}getBalances(r){return r?I(this,E,R).call(this,"get",`profiles/${r}/balances`):I(this,E,R).call(this,"get","balances")}getOrders(r){const t=D(r);return I(this,E,R).call(this,"get",`orders?${t}`)}getOrder(r){return I(this,E,R).call(this,"get",`orders/${r}`)}getTokens(){return I(this,E,R).call(this,"get","tokens")}linkAddress(r,t){return I(this,E,R).call(this,"post",`profiles/${r}/addresses`,JSON.stringify(t))}placeOrder(r,t){const n={...r,kind:"redeem",currency:"eur"};return t?I(this,E,R).call(this,"post",`profiles/${t}/orders`,JSON.stringify(n)):I(this,E,R).call(this,"post","orders",JSON.stringify(n))}uploadSupportingDocument(r){const t=D(r);return I(this,E,R).call(this,"post","files/supporting-document",t,!0)}async connectOrderSocket(){var r;(r=this.bearerProfile)!=null&&r.access_token&&w(this,$).size>0&&A(this,H,this.subscribeToOrderNotifications())}async disconnect(){var r;sessionStorage.removeItem(U),w(this,$).clear(),(r=w(this,H))==null||r.close()}subscribeOrders(r,t){w(this,$).set(r,t)}unsubscribeOrders(r){var t;w(this,$).delete(r),w(this,$).size===0&&((t=w(this,H))==null||t.close(),A(this,H,void 0))}}O=new WeakMap,q=new WeakMap,H=new WeakMap,$=new WeakMap,P=new WeakMap,E=new WeakSet,R=async function(r,t,n,u){return je(`${w(this,O).api}/${t}`,r,u?D(n):n,{Authorization:w(this,q)||"","Content-Type":`application/${u?"x-www-form-urlencoded":"json"}`})},F=new WeakMap,N=new WeakMap,W=new WeakMap;exports.AccountState=ie;exports.Currency=re;exports.KYCOutcome=se;exports.KYCState=oe;exports.MoneriumClient=qe;exports.OrderKind=ce;exports.OrderState=ue;exports.PaymentStandard=ae;exports.Permission=ne;exports.ProfileType=te;exports.constants=ke;exports.placeOrderMessage=_e;exports.rfc3339=de;
|
|
1
|
+
"use strict";var Z=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var w=(e,t,r)=>(Z(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)},I=(e,t,r,n)=>(Z(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);var B=(e,t,r)=>(Z(e,t,"access private method"),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var se=(e=>(e.eur="eur",e))(se||{}),oe=(e=>(e.corporate="corporate",e.personal="personal",e))(oe||{}),ie=(e=>(e.read="read",e.write="write",e))(ie||{}),ae=(e=>(e.absent="absent",e.submitted="submitted",e.pending="pending",e.confirmed="confirmed",e))(ae||{}),ce=(e=>(e.approved="approved",e.rejected="rejected",e.unknown="unknown",e))(ce||{}),ue=(e=>(e.requested="requested",e.approved="approved",e.pending="pending",e))(ue||{}),de=(e=>(e.iban="iban",e.scan="scan",e))(de||{}),he=(e=>(e.redeem="redeem",e.issue="issue",e))(he||{}),fe=(e=>(e.placed="placed",e.pending="pending",e.processed="processed",e.rejected="rejected",e))(fe||{});const le=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())},ke=(e,t)=>`Send EUR ${e} to ${t} at ${le(new Date)}`,Q=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("&"):""},pe=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}`)}},ve=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}`)}},K={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"}}},xe="I hereby declare that I am the address owner.",M="monerium.sdk.code_verifier",W="monerium.sdk.refresh_token",Ae={LINK_MESSAGE:xe,STORAGE_CODE_VERIFIER:M,STORAGE_REFRESH_TOKEN:W};var N=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ge(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ee(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 we={exports:{}};function Ie(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 X={exports:{}};const Re={},Oe=Object.freeze(Object.defineProperty({__proto__:null,default:Re},Symbol.toStringTag,{value:"Module"})),Pe=Ee(Oe);var ee;function ye(){return ee||(ee=1,function(e,t){(function(r,n){e.exports=n()})(N,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 N<"u"&&N.crypto&&(c=N.crypto),!c&&typeof Ie=="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 s(){}return function(o){var a;return s.prototype=o,a=new s,s.prototype=null,a}}(),p={},y=p.lib={},m=y.Base=function(){return{extend:function(s){var o=C(this);return s&&o.mixIn(s),(!o.hasOwnProperty("init")||this.init===o.init)&&(o.init=function(){o.$super.init.apply(this,arguments)}),o.init.prototype=o,o.$super=this,o},create:function(){var s=this.extend();return s.init.apply(s,arguments),s},init:function(){},mixIn:function(s){for(var o in s)s.hasOwnProperty(o)&&(this[o]=s[o]);s.hasOwnProperty("toString")&&(this.toString=s.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),g=y.WordArray=m.extend({init:function(s,o){s=this.words=s||[],o!=u?this.sigBytes=o:this.sigBytes=s.length*4},toString:function(s){return(s||h).stringify(this)},concat:function(s){var o=this.words,a=s.words,d=this.sigBytes,_=s.sigBytes;if(this.clamp(),d%4)for(var S=0;S<_;S++){var k=a[S>>>2]>>>24-S%4*8&255;o[d+S>>>2]|=k<<24-(d+S)%4*8}else for(var x=0;x<_;x+=4)o[d+x>>>2]=a[x>>>2];return this.sigBytes+=_,this},clamp:function(){var s=this.words,o=this.sigBytes;s[o>>>2]&=4294967295<<32-o%4*8,s.length=n.ceil(o/4)},clone:function(){var s=m.clone.call(this);return s.words=this.words.slice(0),s},random:function(s){for(var o=[],a=0;a<s;a+=4)o.push(v());return new g.init(o,s)}}),b=p.enc={},h=b.Hex={stringify:function(s){for(var o=s.words,a=s.sigBytes,d=[],_=0;_<a;_++){var S=o[_>>>2]>>>24-_%4*8&255;d.push((S>>>4).toString(16)),d.push((S&15).toString(16))}return d.join("")},parse:function(s){for(var o=s.length,a=[],d=0;d<o;d+=2)a[d>>>3]|=parseInt(s.substr(d,2),16)<<24-d%8*4;return new g.init(a,o/2)}},l=b.Latin1={stringify:function(s){for(var o=s.words,a=s.sigBytes,d=[],_=0;_<a;_++){var S=o[_>>>2]>>>24-_%4*8&255;d.push(String.fromCharCode(S))}return d.join("")},parse:function(s){for(var o=s.length,a=[],d=0;d<o;d++)a[d>>>2]|=(s.charCodeAt(d)&255)<<24-d%4*8;return new g.init(a,o)}},i=b.Utf8={stringify:function(s){try{return decodeURIComponent(escape(l.stringify(s)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(s){return l.parse(unescape(encodeURIComponent(s)))}},f=y.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new g.init,this._nDataBytes=0},_append:function(s){typeof s=="string"&&(s=i.parse(s)),this._data.concat(s),this._nDataBytes+=s.sigBytes},_process:function(s){var o,a=this._data,d=a.words,_=a.sigBytes,S=this.blockSize,k=S*4,x=_/k;s?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 F=0;F<j;F+=S)this._doProcessBlock(d,F);o=d.splice(0,j),a.sigBytes-=U}return new g.init(o,U)},clone:function(){var s=m.clone.call(this);return s._data=this._data.clone(),s},_minBufferSize:0});y.Hasher=f.extend({cfg:m.extend(),init:function(s){this.cfg=this.cfg.extend(s),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(s){return this._append(s),this._process(),this},finalize:function(s){s&&this._append(s);var o=this._doFinalize();return o},blockSize:16,_createHelper:function(s){return function(o,a){return new s.init(a).finalize(o)}},_createHmacHelper:function(s){return function(o,a){return new A.HMAC.init(s,a).finalize(o)}}});var A=p.algo={};return p}(Math);return r})}(X)),X.exports}(function(e,t){(function(r,n){e.exports=n(ye())})(N,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 h=[],l=0;l<g;l+=3)for(var i=m[l>>>2]>>>24-l%4*8&255,f=m[l+1>>>2]>>>24-(l+1)%4*8&255,A=m[l+2>>>2]>>>24-(l+2)%4*8&255,s=i<<16|f<<8|A,o=0;o<4&&l+o*.75<g;o++)h.push(b.charAt(s>>>6*(3-o)&63));var a=b.charAt(64);if(a)for(;h.length%4;)h.push(a);return h.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 h=0;h<g.length;h++)b[g.charCodeAt(h)]=h}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,h=0;h<y;h++)if(h%4){var l=m[p.charCodeAt(h-1)]<<h%4*2,i=m[p.charCodeAt(h)]>>>6-h%4*2,f=l|i;g[b>>>2]|=f<<24-b%4*8,b++}return c.create(g,b)}}(),r.enc.Base64url})})(we);var $e=we.exports;const ze=ge($e);var me={exports:{}};(function(e,t){(function(r,n){e.exports=n(ye())})(N,function(r){return function(n){var u=r,c=u.lib,v=c.WordArray,C=c.Hasher,p=u.algo,y=[],m=[];(function(){function h(A){for(var s=n.sqrt(A),o=2;o<=s;o++)if(!(A%o))return!1;return!0}function l(A){return(A-(A|0))*4294967296|0}for(var i=2,f=0;f<64;)h(i)&&(f<8&&(y[f]=l(n.pow(i,1/2))),m[f]=l(n.pow(i,1/3)),f++),i++})();var g=[],b=p.SHA256=C.extend({_doReset:function(){this._hash=new v.init(y.slice(0))},_doProcessBlock:function(h,l){for(var i=this._hash.words,f=i[0],A=i[1],s=i[2],o=i[3],a=i[4],d=i[5],_=i[6],S=i[7],k=0;k<64;k++){if(k<16)g[k]=h[l+k]|0;else{var x=g[k-15],j=(x<<25|x>>>7)^(x<<14|x>>>18)^x>>>3,U=g[k-2],F=(U<<15|U>>>17)^(U<<13|U>>>19)^U>>>10;g[k]=j+g[k-7]+F+g[k-16]}var _e=a&d^~a&_,be=f&A^f&s^A&s,Se=(f<<30|f>>>2)^(f<<19|f>>>13)^(f<<10|f>>>22),Ce=(a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25),Y=S+Ce+_e+m[k]+g[k],Be=Se+be;S=_,_=d,d=a,a=o+Y|0,o=s,s=A,A=f,f=Y+Be|0}i[0]=i[0]+f|0,i[1]=i[1]+A|0,i[2]=i[2]+s|0,i[3]=i[3]+o|0,i[4]=i[4]+a|0,i[5]=i[5]+d|0,i[6]=i[6]+_|0,i[7]=i[7]+S|0},_doFinalize:function(){var h=this._data,l=h.words,i=this._nDataBytes*8,f=h.sigBytes*8;return l[f>>>5]|=128<<24-f%32,l[(f+64>>>9<<4)+14]=n.floor(i/4294967296),l[(f+64>>>9<<4)+15]=i,h.sigBytes=l.length*4,this._process(),this._hash},clone:function(){var h=C.clone.call(this);return h._hash=this._hash.clone(),h}});u.SHA256=C._createHelper(b),u.HmacSHA256=C._createHmacHelper(b)}(Math),r.SHA256})})(me);var Ue=me.exports;const He=ge(Ue),Te=(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?pe(v):C}:{},...v!==void 0||p!==void 0?{network:v?ve(v):p}:{}}:{};return Q({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})},Me=()=>{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},Le=e=>ze.stringify(He(e)),te=(e,t)=>{const r=Me(),n=Le(r);return sessionStorage.setItem(M,r||""),`${e}/auth?${Te(t,n)}`},re=()=>{const e=window.location.href;if(!e||!(e!=null&&e.includes("?")))return;const[t,r]=e.split("?");r&&window.history.replaceState(null,"",t)},ne=e=>e.code!=null,je=e=>e.refresh_token!=null,qe=e=>e.client_secret!=null,Ne=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 P,D,L,z,$,H,q,E,R,V,G,J;class Fe{constructor(t){O(this,H);O(this,E);O(this,P,void 0);O(this,D,void 0);O(this,L,void 0);O(this,z,void 0);O(this,$,void 0);O(this,V,void 0);O(this,G,void 0);O(this,J,void 0);if(I(this,z,new Map),this.isAuthorized=!!this.bearerProfile,I(this,V,async(r,n,u)=>{const c=sessionStorage.getItem(M)||"";if(!c)throw new Error("Code verifier not found");return this.codeVerifier=c,sessionStorage.removeItem(M),await B(this,H,q).call(this,{code:u,redirect_uri:n,client_id:r,code_verifier:c})}),I(this,G,async({clientId:r,clientSecret:n})=>await B(this,H,q).call(this,{client_id:r,client_secret:n})),I(this,J,async(r,n)=>await B(this,H,q).call(this,{refresh_token:n,client_id:r})),this.subscribeToOrderNotifications=()=>{var u,c;const r=`${w(this,P).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 B(this,H,q).call(this,r),this.connect=async r=>await B(this,H,q).call(this,r),this.getAuthFlowURI=r=>{const n=te(w(this,P).api,r);return this.codeVerifier=sessionStorage.getItem(M),n},this.pkceRequest=r=>this.getAuthFlowURI(r),this.getEnvironment=()=>w(this,P),!t){I(this,P,K.environments.sandbox);return}if(typeof t=="string")I(this,P,K.environments[t]);else if(I(this,P,K.environments[t.environment||"sandbox"]),T){const{clientId:r,clientSecret:n}=t;I(this,$,{clientId:r,clientSecret:n})}else{const{clientId:r,redirectUrl:n}=t;I(this,$,{clientId:r,redirectUrl:n})}}async authorize(t){var c,v;const r=(t==null?void 0:t.clientId)||((c=w(this,$))==null?void 0:c.clientId),n=(t==null?void 0:t.redirectUrl)||((v=w(this,$))==null?void 0:v.redirectUrl);if(!r)throw new Error("Missing ClientId");if(!n)throw new Error("Missing RedirectUrl");const u=te(w(this,P).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,$))==null?void 0:C.clientId);if((t==null?void 0:t.clientSecret)||((p=w(this,$))==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,$)),!!this.bearerProfile}const u=(t==null?void 0:t.redirectUrl)||((y=w(this,$))==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=sessionStorage.getItem(W)||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 B(this,E,R).call(this,"get","auth/context")}getProfile(t){return B(this,E,R).call(this,"get",`profiles/${t}`)}getBalances(t){return t?B(this,E,R).call(this,"get",`profiles/${t}/balances`):B(this,E,R).call(this,"get","balances")}getOrders(t){const r=Q(t);return B(this,E,R).call(this,"get",`orders?${r}`)}getOrder(t){return B(this,E,R).call(this,"get",`orders/${t}`)}getTokens(){return B(this,E,R).call(this,"get","tokens")}linkAddress(t,r){return B(this,E,R).call(this,"post",`profiles/${t}/addresses`,JSON.stringify(r))}placeOrder(t,r){const n={...t,kind:"redeem",currency:"eur"};return r?B(this,E,R).call(this,"post",`profiles/${r}/orders`,JSON.stringify(n)):B(this,E,R).call(this,"post","orders",JSON.stringify(n))}uploadSupportingDocument(t){const r=Q(t);return B(this,E,R).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||sessionStorage.removeItem(M),w(this,z).clear(),(t=w(this,L))==null||t.close()}async revokeAccess(){T||sessionStorage.removeItem(W),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))}}P=new WeakMap,D=new WeakMap,L=new WeakMap,z=new WeakMap,$=new WeakMap,H=new WeakSet,q=async function(t){let r;if(ne(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 B(this,E,R).call(this,"post","auth/token",r,!0).then(n=>{var u;this.bearerProfile=n,this.isAuthorized=!!n,I(this,D,`Bearer ${n==null?void 0:n.access_token}`),T||window.sessionStorage.setItem(W,((u=this.bearerProfile)==null?void 0:u.refresh_token)||"")}).catch(n=>{throw T||(sessionStorage.removeItem(M),sessionStorage.removeItem(W),re()),new Error(n==null?void 0:n.message)}),ne(t)&&re(),this.bearerProfile},E=new WeakSet,R=async function(t,r,n,u){return Ne(`${w(this,P).api}/${r}`,t,u?Q(n):n,{Authorization:w(this,D)||"","Content-Type":`application/${u?"x-www-form-urlencoded":"json"}`})},V=new WeakMap,G=new WeakMap,J=new WeakMap;exports.AccountState=ue;exports.Currency=se;exports.KYCOutcome=ce;exports.KYCState=ae;exports.MoneriumClient=Fe;exports.OrderKind=he;exports.OrderState=fe;exports.PaymentStandard=de;exports.Permission=ie;exports.ProfileType=oe;exports.constants=Ae;exports.getChain=pe;exports.getNetwork=ve;exports.placeOrderMessage=ke;exports.rfc3339=le;
|