wallaby-cash 1.5.1 → 1.6.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/dist/helpers/object-to-params.d.ts +7 -0
- package/dist/index.cjs.js +36 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +36 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +36 -9
- package/dist/index.js.map +1 -1
- package/dist/lib/wallet/index.d.ts +6 -4
- package/dist/types/base.d.ts +1 -1
- package/dist/types/common.d.ts +14 -0
- package/dist/types/wallet.d.ts +7 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -25,7 +25,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
25
25
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
26
26
|
PERFORMANCE OF THIS SOFTWARE.
|
|
27
27
|
***************************************************************************** */
|
|
28
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
28
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
29
29
|
|
|
30
30
|
var extendStatics = function(d, b) {
|
|
31
31
|
extendStatics = Object.setPrototypeOf ||
|
|
@@ -64,8 +64,8 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
function __generator(thisArg, body) {
|
|
67
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
68
|
-
return g =
|
|
67
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
68
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
69
69
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
70
70
|
function step(op) {
|
|
71
71
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -997,6 +997,8 @@ function requireBrowser () {
|
|
|
997
997
|
return false;
|
|
998
998
|
}
|
|
999
999
|
|
|
1000
|
+
let m;
|
|
1001
|
+
|
|
1000
1002
|
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
|
1001
1003
|
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
|
1002
1004
|
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
|
@@ -1004,7 +1006,7 @@ function requireBrowser () {
|
|
|
1004
1006
|
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
|
1005
1007
|
// Is firefox >= v31?
|
|
1006
1008
|
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
1007
|
-
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(
|
|
1009
|
+
(typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) ||
|
|
1008
1010
|
// Double check webkit in userAgent just in case we are in a worker
|
|
1009
1011
|
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
|
1010
1012
|
}
|
|
@@ -4927,13 +4929,30 @@ var StorageService = /** @class */ (function () {
|
|
|
4927
4929
|
return StorageService;
|
|
4928
4930
|
}());
|
|
4929
4931
|
|
|
4932
|
+
/**
|
|
4933
|
+
* Converts an object to query parameters string.
|
|
4934
|
+
*
|
|
4935
|
+
* @param obj - The object to convert.
|
|
4936
|
+
* @returns The query parameters string.
|
|
4937
|
+
*/
|
|
4938
|
+
function objectToQueryParams(obj) {
|
|
4939
|
+
var params = new URLSearchParams();
|
|
4940
|
+
for (var key in obj) {
|
|
4941
|
+
if (obj.hasOwnProperty(key) && obj[key] !== undefined && obj[key] !== null) {
|
|
4942
|
+
params.append(key, obj[key]);
|
|
4943
|
+
}
|
|
4944
|
+
}
|
|
4945
|
+
return params.toString();
|
|
4946
|
+
}
|
|
4947
|
+
|
|
4930
4948
|
var Base = /** @class */ (function () {
|
|
4931
4949
|
function Base(config) {
|
|
4950
|
+
var _a;
|
|
4932
4951
|
this.apiKey = config.apiKey;
|
|
4933
4952
|
this.baseUrl = config.baseUrl;
|
|
4934
4953
|
this.userId = config.userId;
|
|
4935
4954
|
this.jwt = config.jwt;
|
|
4936
|
-
this.clientAuthToken = config.clientAuthToken;
|
|
4955
|
+
this.clientAuthToken = (_a = config.clientAuthToken) !== null && _a !== void 0 ? _a : config.jwt;
|
|
4937
4956
|
this.options = config.options;
|
|
4938
4957
|
}
|
|
4939
4958
|
Object.defineProperty(Base.prototype, "deviceStorage", {
|
|
@@ -5009,6 +5028,9 @@ var Base = /** @class */ (function () {
|
|
|
5009
5028
|
else {
|
|
5010
5029
|
url = route.fullPath;
|
|
5011
5030
|
}
|
|
5031
|
+
if (options === null || options === void 0 ? void 0 : options.queryParams) {
|
|
5032
|
+
url += "?".concat(objectToQueryParams(options.queryParams));
|
|
5033
|
+
}
|
|
5012
5034
|
return [4 /*yield*/, this.getRequestHeaders(route.requiresAccessToken)];
|
|
5013
5035
|
case 1:
|
|
5014
5036
|
headers = _d.sent();
|
|
@@ -6128,12 +6150,13 @@ var Wallet = /** @class */ (function (_super) {
|
|
|
6128
6150
|
*
|
|
6129
6151
|
* @description Get all user assets across all wallets by specifying user id
|
|
6130
6152
|
* @param userId Wallaby's user ID
|
|
6153
|
+
* @param queryOptions Optional query options
|
|
6131
6154
|
* @returns {UserWalletsResponse} Returns an array of user assets by specifying user id
|
|
6132
6155
|
*/
|
|
6133
6156
|
Wallet.prototype.getUserAssets = function (_a) {
|
|
6134
6157
|
return __awaiter(this, arguments, void 0, function (_b) {
|
|
6135
6158
|
var response, error_10;
|
|
6136
|
-
var userId = _b.userId;
|
|
6159
|
+
var userId = _b.userId, queryOptions = _b.queryOptions;
|
|
6137
6160
|
return __generator(this, function (_c) {
|
|
6138
6161
|
switch (_c.label) {
|
|
6139
6162
|
case 0:
|
|
@@ -6143,6 +6166,7 @@ var Wallet = /** @class */ (function (_super) {
|
|
|
6143
6166
|
payload: {
|
|
6144
6167
|
userId: userId,
|
|
6145
6168
|
},
|
|
6169
|
+
queryParams: queryOptions,
|
|
6146
6170
|
})];
|
|
6147
6171
|
case 1:
|
|
6148
6172
|
response = _c.sent();
|
|
@@ -6168,7 +6192,7 @@ var Wallet = /** @class */ (function (_super) {
|
|
|
6168
6192
|
Wallet.prototype.getUserWallets = function (_a) {
|
|
6169
6193
|
return __awaiter(this, arguments, void 0, function (_b) {
|
|
6170
6194
|
var response, error_11;
|
|
6171
|
-
var userId = _b.userId;
|
|
6195
|
+
var userId = _b.userId, queryOptions = _b.queryOptions;
|
|
6172
6196
|
return __generator(this, function (_c) {
|
|
6173
6197
|
switch (_c.label) {
|
|
6174
6198
|
case 0:
|
|
@@ -6178,6 +6202,7 @@ var Wallet = /** @class */ (function (_super) {
|
|
|
6178
6202
|
payload: {
|
|
6179
6203
|
userId: userId,
|
|
6180
6204
|
},
|
|
6205
|
+
queryParams: queryOptions,
|
|
6181
6206
|
})];
|
|
6182
6207
|
case 1:
|
|
6183
6208
|
response = _c.sent();
|
|
@@ -6198,12 +6223,13 @@ var Wallet = /** @class */ (function (_super) {
|
|
|
6198
6223
|
*
|
|
6199
6224
|
* @description Get all assets that exist in a certain wallet, by specifying a wallet ID
|
|
6200
6225
|
* @param walletId Wallaby's wallet ID
|
|
6201
|
-
* @
|
|
6226
|
+
* @param { BasicQueryOptions } queryOptions Optional query options
|
|
6227
|
+
* @returns { WalletAssetsResponse } Returns all assets belonging in a certain wallet ID
|
|
6202
6228
|
*/
|
|
6203
6229
|
Wallet.prototype.getWalletAssets = function (_a) {
|
|
6204
6230
|
return __awaiter(this, arguments, void 0, function (_b) {
|
|
6205
6231
|
var response, error_12;
|
|
6206
|
-
var walletId = _b.walletId;
|
|
6232
|
+
var walletId = _b.walletId, queryOptions = _b.queryOptions;
|
|
6207
6233
|
return __generator(this, function (_c) {
|
|
6208
6234
|
switch (_c.label) {
|
|
6209
6235
|
case 0:
|
|
@@ -6213,6 +6239,7 @@ var Wallet = /** @class */ (function (_super) {
|
|
|
6213
6239
|
payload: {
|
|
6214
6240
|
walletId: walletId,
|
|
6215
6241
|
},
|
|
6242
|
+
queryParams: queryOptions,
|
|
6216
6243
|
})];
|
|
6217
6244
|
case 1:
|
|
6218
6245
|
response = _c.sent();
|