@ututrust/web-components 1.2.2 → 1.2.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/dist/index.js CHANGED
@@ -9595,11 +9595,11 @@
9595
9595
  var ATTR_ENDORSEMENT_NETWORK = "endorsement-network";
9596
9596
  var ATTR_TRANSACTION_ID = "transaction-id"; // API BASE URLs
9597
9597
 
9598
- var UTU_API_BASE_URL_PRODUCTION = "https://api.ututrust.com/";
9599
- var UTU_API_BASE_URL_TEST = "https://stage-api.ututrust.com/";
9600
- var CORE_API_BASE = "core-api";
9601
- var UPLOADER_API_BASE = "uploader-api";
9602
- var VIDEO_PUBLISHED_BASE = "published-videos"; // API resource paths
9598
+ var UTU_API_BASE_URL_PRODUCTION = "https://api.ututrust.com";
9599
+ var UTU_API_BASE_URL_TEST = "https://stage-api.ututrust.com";
9600
+ var CORE_API_BASE = "/core-api";
9601
+ var UPLOADER_API_BASE = "/uploader-api";
9602
+ var VIDEO_PUBLISHED_BASE = "/published-videos"; // API resource paths
9603
9603
 
9604
9604
  var API_RANKING = "/ranking";
9605
9605
  var API_FEEDBACK = "/feedback";
@@ -9610,10 +9610,14 @@
9610
9610
  var EVENT_UTU_CONFIG = "utuConfig";
9611
9611
  var EVENT_UTU_IDENTITY_DATA_READY = "utuIdentityDataReady"; // Local Storage Keys
9612
9612
 
9613
- var LOCAL_STORAGE_KEY_UTU_IDENTITY_DATA = "utu-identity-data"; // UTT Endorsement Contracts
9613
+ var LOCAL_STORAGE_KEY_UTU_IDENTITY_DATA = "utu-identity-data"; // Supported UTT networks
9614
9614
 
9615
- var UTT_CONTRACT_ADDRESS_TEST = "0x19bc90FfBDCaD53c48eF0b08A67B0D2563AEE2a8";
9616
- var UTT_CONTRACT_ADDRESS_PRODUCTION = "0xbA6de5f4a98d2AEbb289d1136194D05Ee24C426f";
9615
+ var NETWORK_NAME;
9616
+
9617
+ (function (NETWORK_NAME) {
9618
+ NETWORK_NAME["polygon_mainnet"] = "polygon_mainnet";
9619
+ NETWORK_NAME["polygon_mumbai"] = "polygon_mumbai";
9620
+ })(NETWORK_NAME || (NETWORK_NAME = {}));
9617
9621
 
9618
9622
  function e$1(e) {
9619
9623
  this.message = e;
@@ -25001,7 +25005,7 @@
25001
25005
  _defaultProvider: etcDefaultProvider("https://www.ethercluster.com/mordor", "classicMordor")
25002
25006
  }; // See: https://chainlist.org
25003
25007
 
25004
- const networks$1 = {
25008
+ const networks = {
25005
25009
  unspecified: {
25006
25010
  chainId: 0,
25007
25011
  name: "unspecified"
@@ -25113,8 +25117,8 @@
25113
25117
  }
25114
25118
 
25115
25119
  if (typeof network === "number") {
25116
- for (const name in networks$1) {
25117
- const standard = networks$1[name];
25120
+ for (const name in networks) {
25121
+ const standard = networks[name];
25118
25122
 
25119
25123
  if (standard.chainId === network) {
25120
25124
  return {
@@ -25133,7 +25137,7 @@
25133
25137
  }
25134
25138
 
25135
25139
  if (typeof network === "string") {
25136
- const standard = networks$1[network];
25140
+ const standard = networks[network];
25137
25141
 
25138
25142
  if (standard == null) {
25139
25143
  return null;
@@ -25147,7 +25151,7 @@
25147
25151
  };
25148
25152
  }
25149
25153
 
25150
- const standard = networks$1[network.name]; // Not a standard network; check that it is a valid network in general
25154
+ const standard = networks[network.name]; // Not a standard network; check that it is a valid network in general
25151
25155
 
25152
25156
  if (!standard) {
25153
25157
  if (typeof network.chainId !== "number") {
@@ -29970,6 +29974,111 @@
29970
29974
 
29971
29975
  }
29972
29976
 
29977
+ // eslint-disable-next-line es-x/no-object-assign -- safe
29978
+
29979
+
29980
+ var $assign = Object.assign; // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
29981
+
29982
+ var defineProperty$2 = Object.defineProperty;
29983
+ var concat = functionUncurryThis([].concat); // `Object.assign` method
29984
+ // https://tc39.es/ecma262/#sec-object.assign
29985
+
29986
+ var objectAssign$1 = !$assign || fails(function () {
29987
+ // should have correct order of operations (Edge bug)
29988
+ if (descriptors && $assign({
29989
+ b: 1
29990
+ }, $assign(defineProperty$2({}, 'a', {
29991
+ enumerable: true,
29992
+ get: function () {
29993
+ defineProperty$2(this, 'b', {
29994
+ value: 3,
29995
+ enumerable: false
29996
+ });
29997
+ }
29998
+ }), {
29999
+ b: 2
30000
+ })).b !== 1) return true; // should work with symbols and should have deterministic property order (V8 bug)
30001
+
30002
+ var A = {};
30003
+ var B = {}; // eslint-disable-next-line es-x/no-symbol -- safe
30004
+
30005
+ var symbol = Symbol();
30006
+ var alphabet = 'abcdefghijklmnopqrst';
30007
+ A[symbol] = 7;
30008
+ alphabet.split('').forEach(function (chr) {
30009
+ B[chr] = chr;
30010
+ });
30011
+ return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
30012
+ }) ? function assign(target, source) {
30013
+ // eslint-disable-line no-unused-vars -- required for `.length`
30014
+ var T = toObject$1(target);
30015
+ var argumentsLength = arguments.length;
30016
+ var index = 1;
30017
+ var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
30018
+ var propertyIsEnumerable = objectPropertyIsEnumerable.f;
30019
+
30020
+ while (argumentsLength > index) {
30021
+ var S = indexedObject(arguments[index++]);
30022
+ var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
30023
+ var length = keys.length;
30024
+ var j = 0;
30025
+ var key;
30026
+
30027
+ while (length > j) {
30028
+ key = keys[j++];
30029
+ if (!descriptors || functionCall(propertyIsEnumerable, S, key)) T[key] = S[key];
30030
+ }
30031
+ }
30032
+
30033
+ return T;
30034
+ } : $assign;
30035
+
30036
+ // `Object.assign` method
30037
+ // https://tc39.es/ecma262/#sec-object.assign
30038
+ // eslint-disable-next-line es-x/no-object-assign -- required for testing
30039
+
30040
+
30041
+ _export({
30042
+ target: 'Object',
30043
+ stat: true,
30044
+ arity: 2,
30045
+ forced: Object.assign !== objectAssign$1
30046
+ }, {
30047
+ assign: objectAssign$1
30048
+ });
30049
+
30050
+ var config = {
30051
+ production: false
30052
+ };
30053
+ window.addEventListener(EVENT_UTU_CONFIG, function (event) {
30054
+ console.log("UTU SDK received config:", JSON.stringify(event.detail));
30055
+ Object.assign(config, event.detail);
30056
+ });
30057
+ function getBaseProps(props, componentName) {
30058
+ var apiUrlDefault = config.production ? UTU_API_BASE_URL_PRODUCTION : UTU_API_BASE_URL_TEST;
30059
+ var apiUrl = props[ATTR_API_URL] || undefined || apiUrlDefault;
30060
+
30061
+ if (!apiUrl) {
30062
+ throw new Error("".concat(ATTR_API_URL, " attribute of ").concat(componentName, " was not set"));
30063
+ }
30064
+
30065
+ return {
30066
+ apiUrl: apiUrl
30067
+ };
30068
+ }
30069
+ function BaseComponent(_ref) {
30070
+ var children = _ref.children,
30071
+ forwardedRef = _ref.forwardedRef,
30072
+ className = _ref.className,
30073
+ style = _ref.style,
30074
+ excludeBootstrap = _ref.excludeBootstrap,
30075
+ excludeFonts = _ref.excludeFonts;
30076
+ return h$2("div", {
30077
+ ref: forwardedRef,
30078
+ className: className
30079
+ }, h$2("style", null, !excludeFonts && h$2(p$1, null, "@import \"https://fonts.googleapis.com/css2?family=Roboto:wght@300;500&display=swap\";"), !excludeBootstrap && h$2(p$1, null, "@import \"https://getbootstrap.com/docs/5.0/dist/css/bootstrap-reboot.min.css\"; @import \"https://getbootstrap.com/docs/5.0/dist/css/bootstrap-grid.min.css\"; @import \"https://getbootstrap.com/docs/5.0/dist/css/bootstrap-utilities.min.css\";"), style), children);
30080
+ }
30081
+
29973
30082
  function useAuth() {
29974
30083
  var _useState = p(getAccessTokenFromLocalStorage()),
29975
30084
  _useState2 = _slicedToArray(_useState, 2),
@@ -29991,16 +30100,18 @@
29991
30100
  accessToken: accessToken
29992
30101
  };
29993
30102
  }
29994
- function addressSignatureVerification(_x) {
30103
+ function addressSignatureVerification() {
29995
30104
  return _addressSignatureVerification.apply(this, arguments);
29996
30105
  }
29997
30106
 
29998
30107
  function _addressSignatureVerification() {
29999
- _addressSignatureVerification = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(apiUrl) {
30108
+ _addressSignatureVerification = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
30000
30109
  var _window;
30001
30110
 
30002
- var walletProvider,
30111
+ var overrideApiUrl,
30112
+ walletProvider,
30003
30113
  cookies,
30114
+ utuApiBase,
30004
30115
  provider,
30005
30116
  signer,
30006
30117
  address,
@@ -30013,48 +30124,50 @@
30013
30124
  while (1) {
30014
30125
  switch (_context.prev = _context.next) {
30015
30126
  case 0:
30127
+ overrideApiUrl = _args.length > 0 && _args[0] !== undefined ? _args[0] : null;
30016
30128
  walletProvider = _args.length > 1 && _args[1] !== undefined ? _args[1] : null;
30017
30129
  cookies = _args.length > 2 && _args[2] !== undefined ? _args[2] : false;
30130
+ utuApiBase = (overrideApiUrl !== null && overrideApiUrl !== void 0 ? overrideApiUrl : config.production) ? UTU_API_BASE_URL_PRODUCTION : UTU_API_BASE_URL_TEST; // @ts-ignore
30018
30131
 
30019
30132
  if (!(!((_window = window) !== null && _window !== void 0 && _window.ethereum) && !walletProvider)) {
30020
- _context.next = 4;
30133
+ _context.next = 6;
30021
30134
  break;
30022
30135
  }
30023
30136
 
30024
30137
  return _context.abrupt("return", null);
30025
30138
 
30026
- case 4:
30139
+ case 6:
30027
30140
  // @ts-ignore
30028
30141
  provider = new Web3Provider(walletProvider || window.ethereum);
30029
30142
  signer = provider.getSigner();
30030
- _context.next = 8;
30143
+ _context.next = 10;
30031
30144
  return signer.getAddress();
30032
30145
 
30033
- case 8:
30146
+ case 10:
30034
30147
  address = _context.sent;
30035
- _context.next = 11;
30148
+ _context.next = 13;
30036
30149
  return signer.signMessage("Sign in at UTU");
30037
30150
 
30038
- case 11:
30151
+ case 13:
30039
30152
  signature = _context.sent;
30040
- _context.next = 14;
30041
- return axios.post("".concat(apiUrl).concat(API_VERIFY_ADDRESS), {
30153
+ _context.next = 16;
30154
+ return axios.post("".concat(utuApiBase).concat(API_VERIFY_ADDRESS), {
30042
30155
  address: address,
30043
30156
  signature: signature
30044
30157
  }, {
30045
30158
  withCredentials: !!cookies
30046
30159
  });
30047
30160
 
30048
- case 14:
30161
+ case 16:
30049
30162
  _yield$axios$post = _context.sent;
30050
30163
  data = _yield$axios$post.data;
30051
- _context.next = 18;
30164
+ _context.next = 20;
30052
30165
  return localStorage.setItem(LOCAL_STORAGE_KEY_UTU_IDENTITY_DATA, JSON.stringify(data));
30053
30166
 
30054
- case 18:
30167
+ case 20:
30055
30168
  return _context.abrupt("return", data);
30056
30169
 
30057
- case 20:
30170
+ case 22:
30058
30171
  case "end":
30059
30172
  return _context.stop();
30060
30173
  }
@@ -30343,110 +30456,6 @@
30343
30456
  };
30344
30457
  }
30345
30458
 
30346
- // eslint-disable-next-line es-x/no-object-assign -- safe
30347
-
30348
-
30349
- var $assign = Object.assign; // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
30350
-
30351
- var defineProperty$2 = Object.defineProperty;
30352
- var concat = functionUncurryThis([].concat); // `Object.assign` method
30353
- // https://tc39.es/ecma262/#sec-object.assign
30354
-
30355
- var objectAssign$1 = !$assign || fails(function () {
30356
- // should have correct order of operations (Edge bug)
30357
- if (descriptors && $assign({
30358
- b: 1
30359
- }, $assign(defineProperty$2({}, 'a', {
30360
- enumerable: true,
30361
- get: function () {
30362
- defineProperty$2(this, 'b', {
30363
- value: 3,
30364
- enumerable: false
30365
- });
30366
- }
30367
- }), {
30368
- b: 2
30369
- })).b !== 1) return true; // should work with symbols and should have deterministic property order (V8 bug)
30370
-
30371
- var A = {};
30372
- var B = {}; // eslint-disable-next-line es-x/no-symbol -- safe
30373
-
30374
- var symbol = Symbol();
30375
- var alphabet = 'abcdefghijklmnopqrst';
30376
- A[symbol] = 7;
30377
- alphabet.split('').forEach(function (chr) {
30378
- B[chr] = chr;
30379
- });
30380
- return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
30381
- }) ? function assign(target, source) {
30382
- // eslint-disable-line no-unused-vars -- required for `.length`
30383
- var T = toObject$1(target);
30384
- var argumentsLength = arguments.length;
30385
- var index = 1;
30386
- var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
30387
- var propertyIsEnumerable = objectPropertyIsEnumerable.f;
30388
-
30389
- while (argumentsLength > index) {
30390
- var S = indexedObject(arguments[index++]);
30391
- var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
30392
- var length = keys.length;
30393
- var j = 0;
30394
- var key;
30395
-
30396
- while (length > j) {
30397
- key = keys[j++];
30398
- if (!descriptors || functionCall(propertyIsEnumerable, S, key)) T[key] = S[key];
30399
- }
30400
- }
30401
-
30402
- return T;
30403
- } : $assign;
30404
-
30405
- // `Object.assign` method
30406
- // https://tc39.es/ecma262/#sec-object.assign
30407
- // eslint-disable-next-line es-x/no-object-assign -- required for testing
30408
-
30409
-
30410
- _export({
30411
- target: 'Object',
30412
- stat: true,
30413
- arity: 2,
30414
- forced: Object.assign !== objectAssign$1
30415
- }, {
30416
- assign: objectAssign$1
30417
- });
30418
-
30419
- var config = {
30420
- production: false
30421
- };
30422
- window.addEventListener(EVENT_UTU_CONFIG, function (event) {
30423
- return Object.assign(config, event.detail);
30424
- });
30425
- function getBaseProps(props, componentName) {
30426
- var apiUrlDefault = config.production ? UTU_API_BASE_URL_PRODUCTION : UTU_API_BASE_URL_TEST;
30427
- var apiUrl = props[ATTR_API_URL] || undefined || apiUrlDefault;
30428
-
30429
- if (!apiUrl) {
30430
- throw new Error("".concat(ATTR_API_URL, " attribute of ").concat(componentName, " was not set"));
30431
- }
30432
-
30433
- return {
30434
- apiUrl: apiUrl
30435
- };
30436
- }
30437
- function BaseComponent(_ref) {
30438
- var children = _ref.children,
30439
- forwardedRef = _ref.forwardedRef,
30440
- className = _ref.className,
30441
- style = _ref.style,
30442
- excludeBootstrap = _ref.excludeBootstrap,
30443
- excludeFonts = _ref.excludeFonts;
30444
- return h$2("div", {
30445
- ref: forwardedRef,
30446
- className: className
30447
- }, h$2("style", null, !excludeFonts && h$2(p$1, null, "@import \"https://fonts.googleapis.com/css2?family=Roboto:wght@300;500&display=swap\";"), !excludeBootstrap && h$2(p$1, null, "@import \"https://getbootstrap.com/docs/5.0/dist/css/bootstrap-reboot.min.css\"; @import \"https://getbootstrap.com/docs/5.0/dist/css/bootstrap-grid.min.css\"; @import \"https://getbootstrap.com/docs/5.0/dist/css/bootstrap-utilities.min.css\";"), style), children);
30448
- }
30449
-
30450
30459
  function styleInject(css, ref) {
30451
30460
  if (ref === void 0) ref = {};
30452
30461
  var insertAt = ref.insertAt;
@@ -33204,66 +33213,6 @@
33204
33213
  }, "Submit")));
33205
33214
  }
33206
33215
 
33207
- // a string of all valid unicode whitespaces
33208
- var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' + '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
33209
-
33210
- var replace = functionUncurryThis(''.replace);
33211
- var whitespace = '[' + whitespaces + ']';
33212
- var ltrim = RegExp('^' + whitespace + whitespace + '*');
33213
- var rtrim = RegExp(whitespace + whitespace + '*$'); // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
33214
-
33215
- var createMethod = function (TYPE) {
33216
- return function ($this) {
33217
- var string = toString$2(requireObjectCoercible($this));
33218
- if (TYPE & 1) string = replace(string, ltrim, '');
33219
- if (TYPE & 2) string = replace(string, rtrim, '');
33220
- return string;
33221
- };
33222
- };
33223
-
33224
- var stringTrim = {
33225
- // `String.prototype.{ trimLeft, trimStart }` methods
33226
- // https://tc39.es/ecma262/#sec-string.prototype.trimstart
33227
- start: createMethod(1),
33228
- // `String.prototype.{ trimRight, trimEnd }` methods
33229
- // https://tc39.es/ecma262/#sec-string.prototype.trimend
33230
- end: createMethod(2),
33231
- // `String.prototype.trim` method
33232
- // https://tc39.es/ecma262/#sec-string.prototype.trim
33233
- trim: createMethod(3)
33234
- };
33235
-
33236
- var PROPER_FUNCTION_NAME = functionName.PROPER;
33237
-
33238
-
33239
-
33240
-
33241
-
33242
- var non = '\u200B\u0085\u180E'; // check that a method works with the correct list
33243
- // of whitespaces and has a correct name
33244
-
33245
- var stringTrimForced = function (METHOD_NAME) {
33246
- return fails(function () {
33247
- return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() !== non || PROPER_FUNCTION_NAME && whitespaces[METHOD_NAME].name !== METHOD_NAME;
33248
- });
33249
- };
33250
-
33251
- var $trim = stringTrim.trim;
33252
-
33253
- // `String.prototype.trim` method
33254
- // https://tc39.es/ecma262/#sec-string.prototype.trim
33255
-
33256
-
33257
- _export({
33258
- target: 'String',
33259
- proto: true,
33260
- forced: stringTrimForced('trim')
33261
- }, {
33262
- trim: function trim() {
33263
- return $trim(this);
33264
- }
33265
- });
33266
-
33267
33216
  var $includes = arrayIncludes.includes;
33268
33217
 
33269
33218
 
@@ -33334,6 +33283,192 @@
33334
33283
  }
33335
33284
  });
33336
33285
 
33286
+ var $String = String;
33287
+ var $TypeError = TypeError;
33288
+
33289
+ var aPossiblePrototype = function (argument) {
33290
+ if (typeof argument == 'object' || isCallable(argument)) return argument;
33291
+ throw $TypeError("Can't set " + $String(argument) + ' as a prototype');
33292
+ };
33293
+
33294
+ /* eslint-disable no-proto -- safe */
33295
+
33296
+ // `Object.setPrototypeOf` method
33297
+ // https://tc39.es/ecma262/#sec-object.setprototypeof
33298
+ // Works with __proto__ only. Old v8 can't work with null proto objects.
33299
+ // eslint-disable-next-line es-x/no-object-setprototypeof -- safe
33300
+
33301
+
33302
+ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
33303
+ var CORRECT_SETTER = false;
33304
+ var test = {};
33305
+ var setter;
33306
+
33307
+ try {
33308
+ // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
33309
+ setter = functionUncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
33310
+ setter(test, []);
33311
+ CORRECT_SETTER = test instanceof Array;
33312
+ } catch (error) {
33313
+ /* empty */
33314
+ }
33315
+
33316
+ return function setPrototypeOf(O, proto) {
33317
+ anObject(O);
33318
+ aPossiblePrototype(proto);
33319
+ if (CORRECT_SETTER) setter(O, proto);else O.__proto__ = proto;
33320
+ return O;
33321
+ };
33322
+ }() : undefined);
33323
+
33324
+ // makes subclassing work correct for wrapped built-ins
33325
+
33326
+
33327
+ var inheritIfRequired = function ($this, dummy, Wrapper) {
33328
+ var NewTarget, NewTargetPrototype;
33329
+ if ( // it can work only with native `setPrototypeOf`
33330
+ objectSetPrototypeOf && // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
33331
+ isCallable(NewTarget = dummy.constructor) && NewTarget !== Wrapper && isObject$2(NewTargetPrototype = NewTarget.prototype) && NewTargetPrototype !== Wrapper.prototype) objectSetPrototypeOf($this, NewTargetPrototype);
33332
+ return $this;
33333
+ };
33334
+
33335
+ // `thisNumberValue` abstract operation
33336
+ // https://tc39.es/ecma262/#sec-thisnumbervalue
33337
+
33338
+
33339
+ var thisNumberValue = functionUncurryThis(1.0.valueOf);
33340
+
33341
+ // a string of all valid unicode whitespaces
33342
+ var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' + '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
33343
+
33344
+ var replace = functionUncurryThis(''.replace);
33345
+ var whitespace = '[' + whitespaces + ']';
33346
+ var ltrim = RegExp('^' + whitespace + whitespace + '*');
33347
+ var rtrim = RegExp(whitespace + whitespace + '*$'); // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
33348
+
33349
+ var createMethod = function (TYPE) {
33350
+ return function ($this) {
33351
+ var string = toString$2(requireObjectCoercible($this));
33352
+ if (TYPE & 1) string = replace(string, ltrim, '');
33353
+ if (TYPE & 2) string = replace(string, rtrim, '');
33354
+ return string;
33355
+ };
33356
+ };
33357
+
33358
+ var stringTrim = {
33359
+ // `String.prototype.{ trimLeft, trimStart }` methods
33360
+ // https://tc39.es/ecma262/#sec-string.prototype.trimstart
33361
+ start: createMethod(1),
33362
+ // `String.prototype.{ trimRight, trimEnd }` methods
33363
+ // https://tc39.es/ecma262/#sec-string.prototype.trimend
33364
+ end: createMethod(2),
33365
+ // `String.prototype.trim` method
33366
+ // https://tc39.es/ecma262/#sec-string.prototype.trim
33367
+ trim: createMethod(3)
33368
+ };
33369
+
33370
+ var getOwnPropertyNames = objectGetOwnPropertyNames.f;
33371
+
33372
+ var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
33373
+
33374
+ var defineProperty = objectDefineProperty.f;
33375
+
33376
+
33377
+
33378
+ var trim = stringTrim.trim;
33379
+
33380
+ var NUMBER = 'Number';
33381
+ var NativeNumber = global$1[NUMBER];
33382
+ var NumberPrototype = NativeNumber.prototype;
33383
+ var TypeError$1 = global$1.TypeError;
33384
+ var arraySlice = functionUncurryThis(''.slice);
33385
+ var charCodeAt = functionUncurryThis(''.charCodeAt); // `ToNumeric` abstract operation
33386
+ // https://tc39.es/ecma262/#sec-tonumeric
33387
+
33388
+ var toNumeric = function (value) {
33389
+ var primValue = toPrimitive(value, 'number');
33390
+ return typeof primValue == 'bigint' ? primValue : toNumber(primValue);
33391
+ }; // `ToNumber` abstract operation
33392
+ // https://tc39.es/ecma262/#sec-tonumber
33393
+
33394
+
33395
+ var toNumber = function (argument) {
33396
+ var it = toPrimitive(argument, 'number');
33397
+ var first, third, radix, maxCode, digits, length, index, code;
33398
+ if (isSymbol$1(it)) throw TypeError$1('Cannot convert a Symbol value to a number');
33399
+
33400
+ if (typeof it == 'string' && it.length > 2) {
33401
+ it = trim(it);
33402
+ first = charCodeAt(it, 0);
33403
+
33404
+ if (first === 43 || first === 45) {
33405
+ third = charCodeAt(it, 2);
33406
+ if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
33407
+ } else if (first === 48) {
33408
+ switch (charCodeAt(it, 1)) {
33409
+ case 66:
33410
+ case 98:
33411
+ radix = 2;
33412
+ maxCode = 49;
33413
+ break;
33414
+ // fast equal of /^0b[01]+$/i
33415
+
33416
+ case 79:
33417
+ case 111:
33418
+ radix = 8;
33419
+ maxCode = 55;
33420
+ break;
33421
+ // fast equal of /^0o[0-7]+$/i
33422
+
33423
+ default:
33424
+ return +it;
33425
+ }
33426
+
33427
+ digits = arraySlice(it, 2);
33428
+ length = digits.length;
33429
+
33430
+ for (index = 0; index < length; index++) {
33431
+ code = charCodeAt(digits, index); // parseInt parses a string to a first unavailable symbol
33432
+ // but ToNumber should return NaN if a string contains unavailable symbols
33433
+
33434
+ if (code < 48 || code > maxCode) return NaN;
33435
+ }
33436
+
33437
+ return parseInt(digits, radix);
33438
+ }
33439
+ }
33440
+
33441
+ return +it;
33442
+ }; // `Number` constructor
33443
+ // https://tc39.es/ecma262/#sec-number-constructor
33444
+
33445
+
33446
+ if (isForced_1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
33447
+ var NumberWrapper = function Number(value) {
33448
+ var n = arguments.length < 1 ? 0 : NativeNumber(toNumeric(value));
33449
+ var dummy = this; // check on 1..constructor(foo) case
33450
+
33451
+ return objectIsPrototypeOf(NumberPrototype, dummy) && fails(function () {
33452
+ thisNumberValue(dummy);
33453
+ }) ? inheritIfRequired(Object(n), dummy, NumberWrapper) : n;
33454
+ };
33455
+
33456
+ for (var keys = descriptors ? getOwnPropertyNames(NativeNumber) : ( // ES3:
33457
+ 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + // ES2015 (in case, if modules with ES2015 Number statics required before):
33458
+ 'EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,' + // ESNext
33459
+ 'fromString,range').split(','), j = 0, key; keys.length > j; j++) {
33460
+ if (hasOwnProperty_1(NativeNumber, key = keys[j]) && !hasOwnProperty_1(NumberWrapper, key)) {
33461
+ defineProperty(NumberWrapper, key, getOwnPropertyDescriptor(NativeNumber, key));
33462
+ }
33463
+ }
33464
+
33465
+ NumberWrapper.prototype = NumberPrototype;
33466
+ NumberPrototype.constructor = NumberWrapper;
33467
+ defineBuiltIn(global$1, NUMBER, NumberWrapper, {
33468
+ constructor: true
33469
+ });
33470
+ }
33471
+
33337
33472
  var abi = [
33338
33473
  {
33339
33474
  inputs: [
@@ -34201,46 +34336,109 @@
34201
34336
  var css_248z$f = "body {\n overflow: scroll;\n}\n\nh3 {\n text-transform: capitalize;\n font-weight: 500;\n font-size: 14px;\n}\n\n.error {\n color: #e80054;\n}\n\n:host {\n margin: 0;\n font-family: Roboto, system-ui, -apple-system, \"Segoe UI\", \"Helvetica Neue\", Arial, \"Noto Sans\", \"Liberation Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";\n font-size: 14px;\n font-weight: 300;\n line-height: 1.5;\n color: #000000;\n -webkit-text-size-adjust: 100%;\n -webkit-tap-highlight-color: #000000;\n}\n\n.utu-section-light {\n border-bottom: 1px solid rgb(155, 152, 152);\n background: rgb(253, 253, 253);\n}\n.utu-section-dark {\n border-bottom: 1px solid rgb(235, 232, 232);\n background: rgb(36, 35, 35);\n}\n.utu-section-no-border-light {\n background: rgb(253, 253, 253);\n}\n.utu-section-no-border-dark {\n background: rgb(36, 35, 35);\n}\n.utu-section-no-border-mid-light {\n background: #e5e5e5;\n}\n.utu-section-no-border-mid-dark {\n background: #494949;\n}\n\n.btn {\n padding: 12px;\n border: none;\n font-size: 14px;\n font-weight: 500;\n font-family: Roboto, system-ui, -apple-system, \"Segoe UI\", \"Helvetica Neue\", Arial, \"Noto Sans\", \"Liberation Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";\n}\n.btn-light {\n background-color: rgb(251, 201, 61);\n color: #000000 !important;\n}\n.btn-dark {\n background-color: rgb(251, 201, 61);\n color: #000000 !important;\n}\n.btn-round {\n color: \"white\" !important;\n}\n.btn-round-text {\n color: \"white\" !important;\n}\n\n.icon-btn {\n border: none;\n background: none;\n padding: 0;\n font-family: Roboto, system-ui, -apple-system, \"Segoe UI\", \"Helvetica Neue\", Arial, \"Noto Sans\", \"Liberation Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";\n font-weight: 500;\n font-size: 14px;\n}\n.icon-btn svg {\n width: 60px;\n height: 60px;\n}\n\nbutton.p {\n color: \"white\";\n}\n\n.logo-position {\n position: absolute;\n top: -1rem;\n right: 6rem;\n z-index: 0;\n width: 0.5rem;\n}\n.logo-position-details {\n position: absolute;\n top: -2rem;\n right: 6rem;\n z-index: 0;\n width: 0.5rem;\n}\n.logo-position-player {\n position: absolute;\n bottom: -0.5rem;\n left: 22rem;\n z-index: 0;\n display: none;\n width: 0.5rem;\n}\n.logo-position-mobile {\n position: absolute;\n top: -1rem;\n right: 4rem;\n z-index: 2;\n width: 0.5rem;\n}\n.logo-section {\n position: relative;\n}\n.logo-section-mobile {\n position: relative;\n}\n.logo-size {\n width: 3rem;\n}\n.logo-video-section {\n position: relative;\n}\n.logo-video-position {\n position: absolute;\n z-index: 0;\n display: none;\n width: 5rem;\n left: 21rem;\n top: 35.6rem;\n}\n\n.text-area {\n resize: vertical;\n min-height: 8rem;\n border-radius: 10px;\n border: none;\n padding: 16px;\n font-weight: 300;\n font-size: 0.9rem;\n background-color: #fcf8e5;\n}\n\nsvg.video-icon {\n width: 1.5rem;\n height: 2.4rem;\n padding-top: 0.3rem;\n}\nsvg.video-icon-dark {\n fill: #000000;\n}\nsvg.video-icon-light {\n fill: #000000;\n}\n\n/* ----------- Large screens ----------- */\n@media only screen and (min-width: 768px) {\n .utu-section-light {\n border-bottom: 0px;\n background-color: #fcf8e5;\n }\n .utu-section-dark {\n border-bottom: 0px;\n background: rgb(36, 35, 35);\n background-color: #3d3d3c;\n }\n .utu-section-no-border-light {\n background-color: #fcf8e5;\n }\n .utu-section-no-border-dark {\n background-color: #3d3d3c;\n }\n .utu-section-no-border-mid-light {\n background-color: #fcf8e5;\n }\n .utu-section-no-border-mid-dark {\n background-color: #3d3d3c;\n }\n .text-area {\n background-color: rgb(253, 253, 253);\n }\n .logo-position-video {\n top: 41.2rem;\n position: absolute;\n left: 21rem;\n }\n .logo-section {\n position: relative;\n }\n}\n.endor-input-form {\n display: flex;\n flex-direction: row;\n justify-items: center;\n justify-content: center;\n align-items: center;\n padding-top: 3rem;\n padding-bottom: 3rem;\n width: 50%;\n}\n.endor-input-form-text-area {\n height: 3rem;\n width: 100%;\n margin-right: 1rem;\n border-radius: 10px;\n border: none;\n padding: 16px;\n font-weight: 300;\n font-size: 0.8rem;\n align-items: center;\n align-content: center;\n background-color: #fcf8e5;\n overflow: hidden;\n}\n.endor-input-section {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n padding: 1rem 2rem;\n width: 100%;\n}\n.endor-text {\n font-size: 1.5rem;\n width: 50%;\n}\n.endor-text-light {\n color: black;\n}\n.endor-text-dark {\n color: white;\n}\n.endor-text-area {\n display: flex;\n flex-direction: row;\n}\n.endor-text-info {\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: rgb(251, 201, 61);\n width: 1rem;\n height: 1rem;\n margin-left: 1rem;\n font-size: 0.8rem;\n border-radius: 50%;\n cursor: pointer;\n margin-left: 0.5rem;\n transition-timing-function: ease-in-out;\n transition-duration: 2s;\n transition: width 2s, height 4s;\n}\n.endor-text-body {\n font-size: 1rem;\n}\n.endor-text-title {\n font-size: 1rem;\n}\n.endor-btn {\n border-radius: 10px;\n}\n\n/* ----------- Large screens ----------- */\n@media only screen and (min-width: 768px) {\n .endor-input-section {\n padding-left: 0rem;\n padding-right: 0rem;\n }\n .endor-input-form {\n width: 45%;\n padding: 2rem;\n }\n .endor-input-form-text-area {\n background-color: rgb(253, 253, 253);\n font-size: 1rem;\n }\n .endor-input-form-section {\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n width: 100%;\n }\n .endor-text {\n padding: 2rem;\n width: 45%;\n }\n .endor-text-info {\n font-size: 1rem;\n }\n}\n@media only screen and (min-width: 830px) {\n .endor-input-form-text-area {\n font-size: 1rem;\n }\n}";
34202
34337
  styleInject(css_248z$f);
34203
34338
 
34204
- var networks = {
34205
- mainnet: {
34206
- chainId: 1
34207
- },
34208
- matic: {
34209
- chainId: 137,
34210
- // 80001
34211
- chainName: "Polygon",
34212
- nativeCurrency: {
34213
- name: "MATIC",
34214
- symbol: "MATIC",
34215
- decimals: 18
34216
- },
34217
- rpcUrls: ["https://polygon-rpc.com"],
34218
- blockExplorerUrls: ["https://polygonscan.com"]
34339
+ var _SWITCH_CHAIN_PARAMS, _ADD_CHAIN_PARAMS, _UTT_CONTRACT_ADDRESS;
34340
+ /**
34341
+ * Parameter interface definition for wallet_addEthereumChain
34342
+ * Copied from https://docs.metamask.io/guide/rpc-api.html#unrestricted-methods
34343
+ */
34344
+
34345
+ /**
34346
+ * Convers a number to a 0x-prefixed hexadecimal string
34347
+ * @param n
34348
+ */
34349
+ function toHexString(n) {
34350
+ return hexStripZeros(hexlify(n));
34351
+ }
34352
+
34353
+ var SWITCH_CHAIN_PARAMS = (_SWITCH_CHAIN_PARAMS = {}, _defineProperty$2(_SWITCH_CHAIN_PARAMS, NETWORK_NAME.polygon_mainnet, {
34354
+ chainId: toHexString(137)
34355
+ }), _defineProperty$2(_SWITCH_CHAIN_PARAMS, NETWORK_NAME.polygon_mumbai, {
34356
+ chainId: toHexString(80001)
34357
+ }), _SWITCH_CHAIN_PARAMS);
34358
+ var ADD_CHAIN_PARAMS = (_ADD_CHAIN_PARAMS = {}, _defineProperty$2(_ADD_CHAIN_PARAMS, NETWORK_NAME.polygon_mainnet, {
34359
+ chainId: SWITCH_CHAIN_PARAMS[NETWORK_NAME.polygon_mainnet].chainId,
34360
+ chainName: "Polygon",
34361
+ nativeCurrency: {
34362
+ name: "MATIC",
34363
+ symbol: "MATIC",
34364
+ decimals: 18
34219
34365
  },
34220
- mumbai: {
34221
- chainId: 80001,
34222
- // 80001
34223
- chainName: "Mumbai",
34224
- nativeCurrency: {
34225
- name: "MATIC",
34226
- symbol: "MATIC",
34227
- decimals: 18
34228
- },
34229
- rpcUrls: ["https://rpc-mumbai.maticvigil.com"],
34230
- blockExplorerUrls: ["https://mumbai.polygonscan.com"]
34366
+ rpcUrls: ["https://polygon-rpc.com"],
34367
+ blockExplorerUrls: ["https://polygonscan.com"]
34368
+ }), _defineProperty$2(_ADD_CHAIN_PARAMS, NETWORK_NAME.polygon_mumbai, {
34369
+ chainId: SWITCH_CHAIN_PARAMS[NETWORK_NAME.polygon_mumbai].chainId,
34370
+ chainName: "Mumbai",
34371
+ nativeCurrency: {
34372
+ name: "MATIC",
34373
+ symbol: "MATIC",
34374
+ decimals: 18
34231
34375
  },
34232
- goerli: {
34233
- chainId: 5
34234
- }
34235
- };
34236
- var DEFAULT_NETWORK = "mumbai";
34237
- var getDefaultNetwork = function getDefaultNetwork() {
34238
- return networks[config.production ? "matic" : "mumbai"];
34239
- };
34240
- var getUTTContractAddress = function getUTTContractAddress(chain) {
34241
- if (chain !== "matic") return UTT_CONTRACT_ADDRESS_TEST;
34242
- return UTT_CONTRACT_ADDRESS_PRODUCTION;
34243
- };
34376
+ rpcUrls: ["https://rpc-mumbai.maticvigil.com"],
34377
+ blockExplorerUrls: ["https://mumbai.polygonscan.com"]
34378
+ }), _ADD_CHAIN_PARAMS);
34379
+ var UTT_CONTRACT_ADDRESS = (_UTT_CONTRACT_ADDRESS = {}, _defineProperty$2(_UTT_CONTRACT_ADDRESS, NETWORK_NAME.polygon_mainnet, "0xbA6de5f4a98d2AEbb289d1136194D05Ee24C426f"), _defineProperty$2(_UTT_CONTRACT_ADDRESS, NETWORK_NAME.polygon_mumbai, "0x19bc90FfBDCaD53c48eF0b08A67B0D2563AEE2a8"), _UTT_CONTRACT_ADDRESS);
34380
+ function addNetwork(_x, _x2) {
34381
+ return _addNetwork.apply(this, arguments);
34382
+ }
34383
+
34384
+ function _addNetwork() {
34385
+ _addNetwork = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(provider, networkName) {
34386
+ var network;
34387
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
34388
+ while (1) {
34389
+ switch (_context.prev = _context.next) {
34390
+ case 0:
34391
+ network = ADD_CHAIN_PARAMS[networkName];
34392
+ _context.next = 3;
34393
+ return provider.request({
34394
+ method: "wallet_addEthereumChain",
34395
+ params: [network]
34396
+ });
34397
+
34398
+ case 3:
34399
+ case "end":
34400
+ return _context.stop();
34401
+ }
34402
+ }
34403
+ }, _callee);
34404
+ }));
34405
+ return _addNetwork.apply(this, arguments);
34406
+ }
34407
+
34408
+ function requestNetworkChange(_x3, _x4) {
34409
+ return _requestNetworkChange.apply(this, arguments);
34410
+ }
34411
+
34412
+ function _requestNetworkChange() {
34413
+ _requestNetworkChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(provider, networkName) {
34414
+ var network;
34415
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
34416
+ while (1) {
34417
+ switch (_context2.prev = _context2.next) {
34418
+ case 0:
34419
+ network = SWITCH_CHAIN_PARAMS[networkName];
34420
+ _context2.next = 3;
34421
+ return provider.request({
34422
+ method: "wallet_switchEthereumChain",
34423
+ params: [network]
34424
+ });
34425
+
34426
+ case 3:
34427
+ case "end":
34428
+ return _context2.stop();
34429
+ }
34430
+ }
34431
+ }, _callee2);
34432
+ }));
34433
+ return _requestNetworkChange.apply(this, arguments);
34434
+ }
34435
+
34436
+ function getDefaultNetworkName() {
34437
+ return config.production ? NETWORK_NAME.polygon_mainnet : NETWORK_NAME.polygon_mumbai;
34438
+ }
34439
+ function getUTTContractAddress(networkName) {
34440
+ return UTT_CONTRACT_ADDRESS[networkName];
34441
+ }
34244
34442
 
34245
34443
  function EndorsementForm(props) {
34246
34444
  var _window, _window2;
@@ -34272,172 +34470,221 @@
34272
34470
 
34273
34471
  if (!((_window = window) !== null && _window !== void 0 && _window.ethereum || (_window2 = window) !== null && _window2 !== void 0 && _window2.web3 || window.utuWeb3Provider) || !props[ATTR_TARGET_UUID] || !isAddress(props[ATTR_TARGET_UUID]) || !props[ATTR_TRANSACTION_ID]) return null;
34274
34472
 
34275
- var getProvider = function getProvider() {
34473
+ function getProvider() {
34276
34474
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
34277
34475
  // @ts-ignore
34278
34476
  return window.utuWeb3Provider || window.ethereum;
34279
- };
34477
+ }
34478
+ /**
34479
+ * Determines which network to use for endorsements.
34480
+ */
34481
+
34280
34482
 
34281
- var requestNetworkChange = /*#__PURE__*/function () {
34282
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(provider, selectedNetwork) {
34483
+ function getEndorsementNetwork() {
34484
+ var _props$ATTR_ENDORSEME;
34485
+
34486
+ return (_props$ATTR_ENDORSEME = props[ATTR_ENDORSEMENT_NETWORK]) !== null && _props$ATTR_ENDORSEME !== void 0 ? _props$ATTR_ENDORSEME : getDefaultNetworkName();
34487
+ }
34488
+ /**
34489
+ * Switches to the given network, adding it if necessary.
34490
+ */
34491
+
34492
+
34493
+ function switchNetwork(_x) {
34494
+ return _switchNetwork.apply(this, arguments);
34495
+ }
34496
+ /**
34497
+ * return the UTU contract instance on the given network
34498
+ */
34499
+
34500
+
34501
+ function _switchNetwork() {
34502
+ _switchNetwork = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(network) {
34503
+ var provider;
34283
34504
  return _regeneratorRuntime().wrap(function _callee$(_context) {
34284
34505
  while (1) {
34285
34506
  switch (_context.prev = _context.next) {
34286
34507
  case 0:
34287
- _context.next = 2;
34288
- return provider.request({
34289
- method: "wallet_switchEthereumChain",
34290
- params: [{
34291
- chainId: hexStripZeros(hexlify(selectedNetwork.chainId))
34292
- }]
34293
- });
34508
+ provider = getProvider();
34509
+ _context.prev = 1;
34510
+ _context.next = 4;
34511
+ return requestNetworkChange(provider, network);
34294
34512
 
34295
- case 2:
34513
+ case 4:
34514
+ _context.next = 14;
34515
+ break;
34516
+
34517
+ case 6:
34518
+ _context.prev = 6;
34519
+ _context.t0 = _context["catch"](1);
34520
+ console.log(_context.t0, _context.t0.message);
34521
+
34522
+ if (!(_context.t0.code === 4902 || _context.t0.message.toLowerCase().includes("unrecognized"))) {
34523
+ _context.next = 14;
34524
+ break;
34525
+ }
34526
+
34527
+ _context.next = 12;
34528
+ return addNetwork(provider, network);
34529
+
34530
+ case 12:
34531
+ _context.next = 14;
34532
+ return requestNetworkChange(provider, network);
34533
+
34534
+ case 14:
34296
34535
  case "end":
34297
34536
  return _context.stop();
34298
34537
  }
34299
34538
  }
34300
- }, _callee);
34539
+ }, _callee, null, [[1, 6]]);
34301
34540
  }));
34541
+ return _switchNetwork.apply(this, arguments);
34542
+ }
34302
34543
 
34303
- return function requestNetworkChange(_x, _x2) {
34304
- return _ref.apply(this, arguments);
34305
- };
34306
- }();
34544
+ function getContractInstance(_x2) {
34545
+ return _getContractInstance.apply(this, arguments);
34546
+ }
34547
+ /**
34548
+ * returns the current connected address
34549
+ */
34307
34550
 
34308
- var addNetwork = /*#__PURE__*/function () {
34309
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(provider, selectedNetwork) {
34551
+
34552
+ function _getContractInstance() {
34553
+ _getContractInstance = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(network) {
34554
+ var UTT_CONTRACT_ADDRESS, web3Provider, signer;
34310
34555
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
34311
34556
  while (1) {
34312
34557
  switch (_context2.prev = _context2.next) {
34313
34558
  case 0:
34314
- _context2.next = 2;
34315
- return provider.request({
34316
- method: "wallet_addEthereumChain",
34317
- params: [_objectSpread2(_objectSpread2({}, selectedNetwork), {}, {
34318
- chainId: hexStripZeros(hexlify(selectedNetwork.chainId))
34319
- })]
34320
- });
34559
+ UTT_CONTRACT_ADDRESS = getUTTContractAddress(network);
34560
+ _context2.next = 3;
34561
+ return new Web3Provider(getProvider());
34321
34562
 
34322
- case 2:
34563
+ case 3:
34564
+ web3Provider = _context2.sent;
34565
+ signer = web3Provider.getSigner();
34566
+ return _context2.abrupt("return", new Contract(UTT_CONTRACT_ADDRESS, abi, signer));
34567
+
34568
+ case 6:
34323
34569
  case "end":
34324
34570
  return _context2.stop();
34325
34571
  }
34326
34572
  }
34327
34573
  }, _callee2);
34328
34574
  }));
34575
+ return _getContractInstance.apply(this, arguments);
34576
+ }
34329
34577
 
34330
- return function addNetwork(_x3, _x4) {
34331
- return _ref2.apply(this, arguments);
34332
- };
34333
- }();
34578
+ function getConnectedAddress() {
34579
+ return _getConnectedAddress.apply(this, arguments);
34580
+ }
34581
+ /**
34582
+ * Creates an endorsement transaction
34583
+ * @param address the target address of the endorsement
34584
+ * @param amount the amount of UTT to stake on the endorsement
34585
+ * @param transactionId the business transaction id (might or might not be an Ethereum tx id) to record with the
34586
+ * endorsement, if any
34587
+ */
34334
34588
 
34335
- var CURRENT_NETWORK = String(props[ATTR_ENDORSEMENT_NETWORK]).toLowerCase().trim();
34336
34589
 
34337
- var switchNetwork = /*#__PURE__*/function () {
34338
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
34339
- var provider, selectedNetwork;
34590
+ function _getConnectedAddress() {
34591
+ _getConnectedAddress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
34592
+ var web3Provider, signer;
34340
34593
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
34341
34594
  while (1) {
34342
34595
  switch (_context3.prev = _context3.next) {
34343
34596
  case 0:
34344
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
34345
- // @ts-ignore
34346
- provider = getProvider();
34347
- selectedNetwork = networks[CURRENT_NETWORK] || getDefaultNetwork();
34348
- _context3.prev = 2;
34349
- _context3.next = 5;
34350
- return requestNetworkChange(provider, selectedNetwork);
34351
-
34352
- case 5:
34353
- _context3.next = 15;
34354
- break;
34355
-
34356
- case 7:
34357
- _context3.prev = 7;
34358
- _context3.t0 = _context3["catch"](2);
34359
- console.log(_context3.t0, _context3.t0.message);
34360
-
34361
- if (!(_context3.t0.code === 4902 || _context3.t0.message.toLowerCase().includes("unrecognized"))) {
34362
- _context3.next = 15;
34363
- break;
34364
- }
34365
-
34366
- _context3.next = 13;
34367
- return addNetwork(provider, selectedNetwork);
34597
+ _context3.next = 2;
34598
+ return new Web3Provider(getProvider());
34368
34599
 
34369
- case 13:
34370
- _context3.next = 15;
34371
- return requestNetworkChange(provider, selectedNetwork);
34600
+ case 2:
34601
+ web3Provider = _context3.sent;
34602
+ signer = web3Provider.getSigner();
34603
+ return _context3.abrupt("return", signer.getAddress());
34372
34604
 
34373
- case 15:
34605
+ case 5:
34374
34606
  case "end":
34375
34607
  return _context3.stop();
34376
34608
  }
34377
34609
  }
34378
- }, _callee3, null, [[2, 7]]);
34610
+ }, _callee3);
34379
34611
  }));
34612
+ return _getConnectedAddress.apply(this, arguments);
34613
+ }
34380
34614
 
34381
- return function switchNetwork() {
34382
- return _ref3.apply(this, arguments);
34383
- };
34384
- }();
34615
+ function endorse(_x3, _x4, _x5) {
34616
+ return _endorse.apply(this, arguments);
34617
+ }
34385
34618
 
34386
- var sendTransaction = /*#__PURE__*/function () {
34387
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(address, amount, transactionId) {
34388
- var UTT_CONTRACT_ADDRESS, web3Provider, signer, contract, transaction;
34619
+ function _endorse() {
34620
+ _endorse = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(address, amount, transactionId) {
34621
+ var network, contract, connectedAddress, utuBalance, transaction;
34389
34622
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
34390
34623
  while (1) {
34391
34624
  switch (_context4.prev = _context4.next) {
34392
34625
  case 0:
34393
- _context4.next = 2;
34394
- return switchNetwork();
34626
+ network = getEndorsementNetwork();
34627
+ _context4.next = 3;
34628
+ return switchNetwork(network);
34395
34629
 
34396
- case 2:
34397
- UTT_CONTRACT_ADDRESS = getUTTContractAddress(CURRENT_NETWORK || DEFAULT_NETWORK);
34630
+ case 3:
34398
34631
  _context4.next = 5;
34399
- return new Web3Provider(getProvider());
34632
+ return getContractInstance(network);
34400
34633
 
34401
34634
  case 5:
34402
- web3Provider = _context4.sent;
34403
- signer = web3Provider.getSigner();
34404
- contract = new Contract(UTT_CONTRACT_ADDRESS, abi, signer);
34405
- _context4.next = 10;
34635
+ contract = _context4.sent;
34636
+ _context4.next = 8;
34637
+ return getConnectedAddress();
34638
+
34639
+ case 8:
34640
+ connectedAddress = _context4.sent;
34641
+ _context4.next = 11;
34642
+ return contract.balanceOf(connectedAddress);
34643
+
34644
+ case 11:
34645
+ utuBalance = _context4.sent;
34646
+
34647
+ if (!(Number(utuBalance) < Number(amount))) {
34648
+ _context4.next = 14;
34649
+ break;
34650
+ }
34651
+
34652
+ throw new Error("Insufficient UTU tokens");
34653
+
34654
+ case 14:
34655
+ _context4.next = 16;
34406
34656
  return contract.endorse(address, String(amount), transactionId);
34407
34657
 
34408
- case 10:
34658
+ case 16:
34409
34659
  transaction = _context4.sent;
34410
- _context4.next = 13;
34660
+ _context4.next = 19;
34411
34661
  return transaction.wait();
34412
34662
 
34413
- case 13:
34663
+ case 19:
34414
34664
  return _context4.abrupt("return", transaction);
34415
34665
 
34416
- case 14:
34666
+ case 20:
34417
34667
  case "end":
34418
34668
  return _context4.stop();
34419
34669
  }
34420
34670
  }
34421
34671
  }, _callee4);
34422
34672
  }));
34673
+ return _endorse.apply(this, arguments);
34674
+ }
34423
34675
 
34424
- return function sendTransaction(_x5, _x6, _x7) {
34425
- return _ref4.apply(this, arguments);
34426
- };
34427
- }();
34428
-
34429
- function onSubmit(_x8) {
34676
+ function onSubmit(_x6) {
34430
34677
  return _onSubmit.apply(this, arguments);
34431
34678
  }
34432
34679
 
34433
34680
  function _onSubmit() {
34434
- _onSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref5) {
34681
+ _onSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref) {
34435
34682
  var amount;
34436
34683
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
34437
34684
  while (1) {
34438
34685
  switch (_context5.prev = _context5.next) {
34439
34686
  case 0:
34440
- amount = _ref5.amount;
34687
+ amount = _ref.amount;
34441
34688
 
34442
34689
  if (amount) {
34443
34690
  _context5.next = 3;
@@ -34450,7 +34697,7 @@
34450
34697
  setTxError("");
34451
34698
  _context5.prev = 4;
34452
34699
  _context5.next = 7;
34453
- return sendTransaction(props[ATTR_TARGET_UUID], amount, props[ATTR_TRANSACTION_ID]);
34700
+ return endorse(props[ATTR_TARGET_UUID], amount, props[ATTR_TRANSACTION_ID]);
34454
34701
 
34455
34702
  case 7:
34456
34703
  _context5.next = 13;
@@ -34472,8 +34719,8 @@
34472
34719
  return _onSubmit.apply(this, arguments);
34473
34720
  }
34474
34721
 
34475
- var showError = function showError(_ref6) {
34476
- var amount = _ref6.amount;
34722
+ var showError = function showError(_ref2) {
34723
+ var amount = _ref2.amount;
34477
34724
 
34478
34725
  switch (amount === null || amount === void 0 ? void 0 : amount.type) {
34479
34726
  case "required":
@@ -34506,7 +34753,7 @@
34506
34753
  }, "Would you like to Endorse ?"), h$2("p", {
34507
34754
  className: "endor-text-info",
34508
34755
  "data-bs-toggle": "tooltip",
34509
- title: " To endorse, you need to have some UTT in your account. Make sure you have a sufficient balance in your account"
34756
+ title: " To endorse, you need to have some UTT in your account. Make sure you have a sufficient balance in your account"
34510
34757
  }, "i")), h$2("p", {
34511
34758
  className: "endor-text-body"
34512
34759
  }, "When you endorse a platform, it means you have personally had a good experience and want to back your rating by staking an amount of UTT (UTU trust token) on the platform.")), h$2("form", {
@@ -45187,163 +45434,6 @@
45187
45434
  }));
45188
45435
  }
45189
45436
 
45190
- var $String = String;
45191
- var $TypeError = TypeError;
45192
-
45193
- var aPossiblePrototype = function (argument) {
45194
- if (typeof argument == 'object' || isCallable(argument)) return argument;
45195
- throw $TypeError("Can't set " + $String(argument) + ' as a prototype');
45196
- };
45197
-
45198
- /* eslint-disable no-proto -- safe */
45199
-
45200
- // `Object.setPrototypeOf` method
45201
- // https://tc39.es/ecma262/#sec-object.setprototypeof
45202
- // Works with __proto__ only. Old v8 can't work with null proto objects.
45203
- // eslint-disable-next-line es-x/no-object-setprototypeof -- safe
45204
-
45205
-
45206
- var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
45207
- var CORRECT_SETTER = false;
45208
- var test = {};
45209
- var setter;
45210
-
45211
- try {
45212
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
45213
- setter = functionUncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
45214
- setter(test, []);
45215
- CORRECT_SETTER = test instanceof Array;
45216
- } catch (error) {
45217
- /* empty */
45218
- }
45219
-
45220
- return function setPrototypeOf(O, proto) {
45221
- anObject(O);
45222
- aPossiblePrototype(proto);
45223
- if (CORRECT_SETTER) setter(O, proto);else O.__proto__ = proto;
45224
- return O;
45225
- };
45226
- }() : undefined);
45227
-
45228
- // makes subclassing work correct for wrapped built-ins
45229
-
45230
-
45231
- var inheritIfRequired = function ($this, dummy, Wrapper) {
45232
- var NewTarget, NewTargetPrototype;
45233
- if ( // it can work only with native `setPrototypeOf`
45234
- objectSetPrototypeOf && // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
45235
- isCallable(NewTarget = dummy.constructor) && NewTarget !== Wrapper && isObject$2(NewTargetPrototype = NewTarget.prototype) && NewTargetPrototype !== Wrapper.prototype) objectSetPrototypeOf($this, NewTargetPrototype);
45236
- return $this;
45237
- };
45238
-
45239
- // `thisNumberValue` abstract operation
45240
- // https://tc39.es/ecma262/#sec-thisnumbervalue
45241
-
45242
-
45243
- var thisNumberValue = functionUncurryThis(1.0.valueOf);
45244
-
45245
- var getOwnPropertyNames = objectGetOwnPropertyNames.f;
45246
-
45247
- var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
45248
-
45249
- var defineProperty = objectDefineProperty.f;
45250
-
45251
-
45252
-
45253
- var trim = stringTrim.trim;
45254
-
45255
- var NUMBER = 'Number';
45256
- var NativeNumber = global$1[NUMBER];
45257
- var NumberPrototype = NativeNumber.prototype;
45258
- var TypeError$1 = global$1.TypeError;
45259
- var arraySlice = functionUncurryThis(''.slice);
45260
- var charCodeAt = functionUncurryThis(''.charCodeAt); // `ToNumeric` abstract operation
45261
- // https://tc39.es/ecma262/#sec-tonumeric
45262
-
45263
- var toNumeric = function (value) {
45264
- var primValue = toPrimitive(value, 'number');
45265
- return typeof primValue == 'bigint' ? primValue : toNumber(primValue);
45266
- }; // `ToNumber` abstract operation
45267
- // https://tc39.es/ecma262/#sec-tonumber
45268
-
45269
-
45270
- var toNumber = function (argument) {
45271
- var it = toPrimitive(argument, 'number');
45272
- var first, third, radix, maxCode, digits, length, index, code;
45273
- if (isSymbol$1(it)) throw TypeError$1('Cannot convert a Symbol value to a number');
45274
-
45275
- if (typeof it == 'string' && it.length > 2) {
45276
- it = trim(it);
45277
- first = charCodeAt(it, 0);
45278
-
45279
- if (first === 43 || first === 45) {
45280
- third = charCodeAt(it, 2);
45281
- if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
45282
- } else if (first === 48) {
45283
- switch (charCodeAt(it, 1)) {
45284
- case 66:
45285
- case 98:
45286
- radix = 2;
45287
- maxCode = 49;
45288
- break;
45289
- // fast equal of /^0b[01]+$/i
45290
-
45291
- case 79:
45292
- case 111:
45293
- radix = 8;
45294
- maxCode = 55;
45295
- break;
45296
- // fast equal of /^0o[0-7]+$/i
45297
-
45298
- default:
45299
- return +it;
45300
- }
45301
-
45302
- digits = arraySlice(it, 2);
45303
- length = digits.length;
45304
-
45305
- for (index = 0; index < length; index++) {
45306
- code = charCodeAt(digits, index); // parseInt parses a string to a first unavailable symbol
45307
- // but ToNumber should return NaN if a string contains unavailable symbols
45308
-
45309
- if (code < 48 || code > maxCode) return NaN;
45310
- }
45311
-
45312
- return parseInt(digits, radix);
45313
- }
45314
- }
45315
-
45316
- return +it;
45317
- }; // `Number` constructor
45318
- // https://tc39.es/ecma262/#sec-number-constructor
45319
-
45320
-
45321
- if (isForced_1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
45322
- var NumberWrapper = function Number(value) {
45323
- var n = arguments.length < 1 ? 0 : NativeNumber(toNumeric(value));
45324
- var dummy = this; // check on 1..constructor(foo) case
45325
-
45326
- return objectIsPrototypeOf(NumberPrototype, dummy) && fails(function () {
45327
- thisNumberValue(dummy);
45328
- }) ? inheritIfRequired(Object(n), dummy, NumberWrapper) : n;
45329
- };
45330
-
45331
- for (var keys = descriptors ? getOwnPropertyNames(NativeNumber) : ( // ES3:
45332
- 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + // ES2015 (in case, if modules with ES2015 Number statics required before):
45333
- 'EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,' + // ESNext
45334
- 'fromString,range').split(','), j = 0, key; keys.length > j; j++) {
45335
- if (hasOwnProperty_1(NativeNumber, key = keys[j]) && !hasOwnProperty_1(NumberWrapper, key)) {
45336
- defineProperty(NumberWrapper, key, getOwnPropertyDescriptor(NativeNumber, key));
45337
- }
45338
- }
45339
-
45340
- NumberWrapper.prototype = NumberPrototype;
45341
- NumberPrototype.constructor = NumberWrapper;
45342
- defineBuiltIn(global$1, NUMBER, NumberWrapper, {
45343
- constructor: true
45344
- });
45345
- }
45346
-
45347
45437
  var css_248z$b = "@import url(https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css);\n.trust-video {\n border: none;\n width: 100%;\n height: auto;\n transform: rotateY(180deg);\n -webkit-transform: rotateY(180deg); /* Safari and Chrome */\n -moz-transform: rotateY(180deg); /* Firefox */\n}\n.trust-video-wrapper {\n width: 100%;\n margin-top: -80%;\n align-items: center;\n}\n.trust-video-wrapper:hover .trust-video-controls {\n visibility: visible;\n opacity: 1;\n}\n.trust-video-msg {\n display: flex;\n align-items: center;\n}\n.trust-video-controls {\n position: absolute;\n bottom: 0;\n width: 100%;\n margin-top: 35%;\n transform: translate(0, -50%);\n padding-left: 36px;\n border-radius: 10px;\n height: 4em;\n align-items: center;\n justify-content: space-between;\n visibility: hidden;\n opacity: 0;\n transition: all 0.25s ease-out;\n display: none;\n}\n.trust-video-controls.show {\n display: flex;\n}\n.trust-video-play {\n border-color: transparent;\n transition: 0.3s;\n font-size: 3em;\n margin: auto;\n line-height: 1.5em;\n width: 3em;\n height: 3em;\n padding: 0;\n cursor: pointer;\n opacity: 1;\n background-color: #ffdd33;\n border-radius: 50%;\n font: normal normal normal 18px/1 FontAwesome;\n}\n.trust-video-play:before {\n content: \"\\f04b\";\n}\n.trust-video-play.paused:before {\n content: \"\\f04c\";\n}\n.trust-video-volume {\n border-color: transparent;\n color: rgba(43, 51, 63, 0.7);\n font-size: 3em;\n border-radius: 20%;\n line-height: 1.5em;\n width: 2em;\n height: 1.5em;\n font: normal normal normal 18px/1 FontAwesome;\n background-color: rgba(255, 221, 51, 0.7);\n left: 20px;\n}\n.trust-video-volume:before {\n content: \"\\f028\";\n}\n.trust-video-volume.off:before {\n content: \"\\f026\";\n}\n.trust-video-fullscreen {\n border-color: transparent;\n color: rgba(43, 51, 63, 0.7);\n font-size: 3em;\n line-height: 2.5rem;\n width: 3em;\n border-radius: 20%;\n height: 2.5rem;\n margin-right: 5%;\n font: normal normal normal 18px/1 FontAwesome;\n background-color: rgba(255, 221, 51, 0.7);\n right: 20px;\n}\n.trust-video-fullscreen:before {\n content: \"\\f065\";\n}\n\n/* ----------- Large screens ----------- */\n@media only screen and (min-width: 768px) {\n .trust-video-wrapper {\n margin-top: 20%;\n }\n}\n@media only screen and (max-width: 768px) {\n .trust-video {\n border: none;\n width: 70%;\n }\n}";
45348
45438
  styleInject(css_248z$b);
45349
45439