@eluvio/elv-client-js 3.1.91 → 3.1.94

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.
@@ -25,9 +25,8 @@ var _require = require("../Validation"),
25
25
  * @methodGroup Minting
26
26
  * @namedParams
27
27
  * @param {string} tenantId - The ID of the tenant
28
- * @param {string=} email - The email of the NFT recipient
29
28
  * @param {string=} address - The address of the NFT recipient
30
- * @param {string} collectionId - The ID of the NFT collection containing the NFT
29
+ * @param {string} marketplaceId - The ID of the marketplace containing the NFT
31
30
  * @param {Array<Object>} items - List of items
32
31
  * @param {string} items.sku - SKU of the NFT
33
32
  * @param {number=} items.quantity=1 - Number to mint
@@ -40,59 +39,22 @@ var _require = require("../Validation"),
40
39
 
41
40
 
42
41
  exports.MintNFT = function _callee(_ref) {
43
- var tenantId, email, address, collectionId, items, _ref$extraData, extraData, accountInitializationBody, accountInitializationSignature, _ref2, addr, requestBody, transactionId, mintSignature;
42
+ var tenantId, address, marketplaceId, items, _ref$extraData, extraData, requestBody, transactionId, mintSignature;
44
43
 
45
44
  return _regeneratorRuntime.async(function _callee$(_context) {
46
45
  while (1) {
47
46
  switch (_context.prev = _context.next) {
48
47
  case 0:
49
- tenantId = _ref.tenantId, email = _ref.email, address = _ref.address, collectionId = _ref.collectionId, items = _ref.items, _ref$extraData = _ref.extraData, extraData = _ref$extraData === void 0 ? {} : _ref$extraData;
48
+ tenantId = _ref.tenantId, address = _ref.address, marketplaceId = _ref.marketplaceId, items = _ref.items, _ref$extraData = _ref.extraData, extraData = _ref$extraData === void 0 ? {} : _ref$extraData;
50
49
  ValidatePresence("tenantId", tenantId);
51
- ValidatePresence("email or address", email || address);
52
- ValidatePresence("collectionId", collectionId);
50
+ ValidatePresence("address", address);
51
+ ValidatePresence("marketplaceId", marketplaceId);
53
52
  ValidatePresence("items", items);
54
- ValidateObject(collectionId); // If address not specified, make call to initialize address for email
55
-
56
- accountInitializationBody = {
57
- ts: Date.now()
58
- };
59
-
60
- if (email) {
61
- accountInitializationBody.email = email;
62
- } else {
63
- accountInitializationBody.addr = address;
64
- }
65
-
66
- _context.next = 10;
67
- return _regeneratorRuntime.awrap(this.Sign(JSON.stringify(accountInitializationBody)));
68
-
69
- case 10:
70
- accountInitializationSignature = _context.sent;
71
- _context.t0 = _regeneratorRuntime;
72
- _context.t1 = this.utils;
73
- _context.next = 15;
74
- return _regeneratorRuntime.awrap(this.authClient.MakeAuthServiceRequest({
75
- method: "POST",
76
- path: "/as/tnt/prov/eth/".concat(tenantId),
77
- body: accountInitializationBody,
78
- headers: {
79
- "Authorization": "Bearer ".concat(accountInitializationSignature)
80
- }
81
- }));
82
-
83
- case 15:
84
- _context.t2 = _context.sent;
85
- _context.t3 = _context.t1.ResponseToJson.call(_context.t1, _context.t2);
86
- _context.next = 19;
87
- return _context.t0.awrap.call(_context.t0, _context.t3);
88
-
89
- case 19:
90
- _ref2 = _context.sent;
91
- addr = _ref2.addr;
92
- address = this.utils.FormatAddress(addr);
53
+ ValidateObject(marketplaceId);
54
+ ValidateAddress(address);
93
55
  requestBody = {
94
- "tickets": null,
95
- "products": items.map(function (item) {
56
+ tickets: null,
57
+ products: items.map(function (item) {
96
58
  return {
97
59
  sku: item.sku,
98
60
  quant: item.quantity || 1,
@@ -101,44 +63,37 @@ exports.MintNFT = function _callee(_ref) {
101
63
  }) : _objectSpread({}, item.extraData || {})
102
64
  };
103
65
  }),
104
- "ident": email || address,
105
- "cust_name": email || address,
106
- "extra": _objectSpread({}, extraData)
66
+ ident: address,
67
+ cust_name: address,
68
+ extra: _objectSpread({}, extraData, {
69
+ elv_addr: address
70
+ })
107
71
  };
108
- ValidateAddress(address);
109
-
110
- if (email) {
111
- requestBody.email = email;
112
- } else {
113
- requestBody.addr = address;
114
- }
115
-
116
- requestBody.extra.elv_addr = address;
117
72
  transactionId = this.utils.B58(UUID.parse(UUID.v4()));
118
73
  requestBody.ts = Date.now();
119
74
  requestBody.trans_id = transactionId;
120
- _context.next = 31;
75
+ _context.next = 13;
121
76
  return _regeneratorRuntime.awrap(this.Sign(JSON.stringify(requestBody)));
122
77
 
123
- case 31:
78
+ case 13:
124
79
  mintSignature = _context.sent;
125
- _context.next = 34;
80
+ _context.next = 16;
126
81
  return _regeneratorRuntime.awrap(this.authClient.MakeAuthServiceRequest({
127
82
  method: "POST",
128
- path: "/as/otp/webhook/base/".concat(tenantId, "/").concat(collectionId),
83
+ path: UrlJoin("/as/tnt/trans/base", tenantId, marketplaceId),
129
84
  body: requestBody,
130
85
  headers: {
131
86
  "Authorization": "Bearer ".concat(mintSignature)
132
87
  }
133
88
  }));
134
89
 
135
- case 34:
90
+ case 16:
136
91
  return _context.abrupt("return", {
137
92
  address: address,
138
93
  transactionId: transactionId
139
94
  });
140
95
 
141
- case 35:
96
+ case 17:
142
97
  case "end":
143
98
  return _context.stop();
144
99
  }
@@ -163,14 +118,14 @@ exports.MintNFT = function _callee(_ref) {
163
118
  */
164
119
 
165
120
 
166
- exports.CollectionTransactions = function _callee2(_ref3) {
167
- var tenantId, collectionId, _ref3$filterOptions, filterOptions, ts, queryParams, allowedOptions, path, signature;
121
+ exports.CollectionTransactions = function _callee2(_ref2) {
122
+ var tenantId, collectionId, _ref2$filterOptions, filterOptions, ts, queryParams, allowedOptions, path, signature;
168
123
 
169
124
  return _regeneratorRuntime.async(function _callee2$(_context2) {
170
125
  while (1) {
171
126
  switch (_context2.prev = _context2.next) {
172
127
  case 0:
173
- tenantId = _ref3.tenantId, collectionId = _ref3.collectionId, _ref3$filterOptions = _ref3.filterOptions, filterOptions = _ref3$filterOptions === void 0 ? {} : _ref3$filterOptions;
128
+ tenantId = _ref2.tenantId, collectionId = _ref2.collectionId, _ref2$filterOptions = _ref2.filterOptions, filterOptions = _ref2$filterOptions === void 0 ? {} : _ref2$filterOptions;
174
129
  ts = Date.now();
175
130
  queryParams = {
176
131
  ts: ts