@typus/typus-perp-sdk 1.0.52 → 1.0.53-upgrade

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.
Files changed (112) hide show
  1. package/dist/src/_dependencies/source/0x2/bag/structs.d.ts +61 -0
  2. package/dist/src/_dependencies/source/0x2/bag/structs.js +229 -0
  3. package/dist/src/_dependencies/source/0x2/balance/structs.d.ts +88 -0
  4. package/dist/src/_dependencies/source/0x2/balance/structs.js +386 -0
  5. package/dist/src/_dependencies/source/0x2/coin/structs.d.ts +460 -0
  6. package/dist/src/_dependencies/source/0x2/coin/structs.js +1247 -0
  7. package/dist/src/_dependencies/source/0x2/linked-table/structs.d.ts +153 -0
  8. package/dist/src/_dependencies/source/0x2/linked-table/structs.js +438 -0
  9. package/dist/src/_dependencies/source/0x2/sui/structs.d.ts +46 -0
  10. package/dist/src/_dependencies/source/0x2/sui/structs.js +222 -0
  11. package/dist/src/_dependencies/source/0x2/table/structs.d.ts +61 -0
  12. package/dist/src/_dependencies/source/0x2/table/structs.js +248 -0
  13. package/dist/src/_dependencies/source/0x2/table-vec/structs.d.ts +68 -0
  14. package/dist/src/_dependencies/source/0x2/table-vec/structs.js +274 -0
  15. package/dist/src/_dependencies/source/0x2/token/structs.d.ts +449 -0
  16. package/dist/src/_dependencies/source/0x2/token/structs.js +1095 -0
  17. package/dist/src/_dependencies/source/0x2/transfer-policy/structs.d.ts +370 -0
  18. package/dist/src/_dependencies/source/0x2/transfer-policy/structs.js +1091 -0
  19. package/dist/src/_dependencies/source/0x2/url/structs.d.ts +53 -0
  20. package/dist/src/_dependencies/source/0x2/url/structs.js +223 -0
  21. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/airdrop/structs.d.ts +489 -0
  22. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/airdrop/structs.js +1084 -0
  23. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/big-vector/structs.d.ts +147 -0
  24. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/big-vector/structs.js +456 -0
  25. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/critbit/structs.d.ts +239 -0
  26. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/critbit/structs.js +653 -0
  27. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/ecosystem/structs.d.ts +405 -0
  28. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/ecosystem/structs.js +899 -0
  29. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/index.d.ts +8 -0
  30. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/index.js +11 -0
  31. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/init.d.ts +2 -0
  32. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/init.js +102 -0
  33. package/dist/src/_dependencies/source/{0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277 → 0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a}/keyed-big-vector/structs.d.ts +70 -70
  34. package/dist/src/_dependencies/source/{0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277 → 0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a}/keyed-big-vector/structs.js +174 -174
  35. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/leaderboard/structs.d.ts +699 -0
  36. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/leaderboard/structs.js +1459 -0
  37. package/dist/src/_dependencies/source/{0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277 → 0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a}/linked-object-table/structs.d.ts +62 -62
  38. package/dist/src/_dependencies/source/{0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277 → 0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a}/linked-object-table/structs.js +170 -170
  39. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-set/structs.d.ts +147 -0
  40. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-set/structs.js +430 -0
  41. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tails-staking/structs.d.ts +1071 -0
  42. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tails-staking/structs.js +2261 -0
  43. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tgld/structs.d.ts +279 -0
  44. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tgld/structs.js +733 -0
  45. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/user/structs.d.ts +328 -0
  46. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/user/structs.js +892 -0
  47. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/authority/structs.d.ts +88 -0
  48. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/authority/structs.js +263 -0
  49. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/balance-pool/structs.d.ts +347 -0
  50. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/balance-pool/structs.js +591 -0
  51. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/big-vector/structs.d.ts +73 -0
  52. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/big-vector/structs.js +258 -0
  53. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/dutch/structs.d.ts +876 -0
  54. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/dutch/structs.js +1721 -0
  55. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/i64/structs.d.ts +46 -0
  56. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/i64/structs.js +222 -0
  57. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/index.d.ts +3 -0
  58. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/index.js +6 -0
  59. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/init.d.ts +2 -0
  60. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/init.js +89 -0
  61. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/linked-list/structs.d.ts +155 -0
  62. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/linked-list/structs.js +444 -0
  63. package/dist/src/_dependencies/source/{0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded → 0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274}/vault/structs.d.ts +84 -84
  64. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/discount-mint/structs.d.ts +446 -0
  65. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/discount-mint/structs.js +844 -0
  66. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/index.d.ts +6 -0
  67. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/index.js +9 -0
  68. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/init.d.ts +2 -0
  69. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/init.js +69 -0
  70. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/royalty-rule/structs.d.ts +94 -0
  71. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/royalty-rule/structs.js +376 -0
  72. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/staking/structs.d.ts +454 -0
  73. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/staking/structs.js +881 -0
  74. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/table-vec/structs.d.ts +68 -0
  75. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/table-vec/structs.js +274 -0
  76. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/typus-nft/structs.d.ts +1117 -0
  77. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/typus-nft/structs.js +2387 -0
  78. package/dist/src/fetch.d.ts +1 -1
  79. package/dist/src/fetch.js +1 -1
  80. package/dist/src/index.js +18 -18
  81. package/dist/src/typus_perp/admin/structs.d.ts +67 -5
  82. package/dist/src/typus_perp/admin/structs.js +155 -1
  83. package/dist/src/typus_perp/escrow/functions.js +1 -1
  84. package/dist/src/typus_perp/escrow/structs.d.ts +2 -2
  85. package/dist/src/typus_perp/escrow/structs.js +1 -1
  86. package/dist/src/typus_perp/lp-pool/structs.d.ts +28 -28
  87. package/dist/src/typus_perp/position/functions.js +1 -1
  88. package/dist/src/typus_perp/position/structs.d.ts +6 -6
  89. package/dist/src/typus_perp/symbol/structs.d.ts +1 -1
  90. package/dist/src/typus_perp/tlp/structs.d.ts +2 -2
  91. package/dist/src/typus_perp/trading/functions.js +1 -1
  92. package/dist/src/typus_perp/trading/structs.d.ts +32 -32
  93. package/dist/src/typus_perp/trading/structs.js +2 -2
  94. package/dist/src/typus_perp/treasury-caps/structs.d.ts +1 -1
  95. package/dist/src/typus_stake_pool/admin/functions.d.ts +25 -25
  96. package/dist/src/typus_stake_pool/admin/functions.js +66 -53
  97. package/dist/src/typus_stake_pool/admin/structs.d.ts +191 -191
  98. package/dist/src/typus_stake_pool/admin/structs.js +179 -179
  99. package/dist/src/typus_stake_pool/stake-pool/functions.d.ts +50 -44
  100. package/dist/src/typus_stake_pool/stake-pool/functions.js +127 -88
  101. package/dist/src/typus_stake_pool/stake-pool/structs.d.ts +202 -202
  102. package/dist/src/typus_stake_pool/stake-pool/structs.js +432 -432
  103. package/dist/src/user/history.js +6 -4
  104. package/dist/src/user/order.js +34 -34
  105. package/package.json +1 -1
  106. package/dist/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/index.d.ts +0 -8
  107. package/dist/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/index.js +0 -11
  108. package/dist/src/_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/index.d.ts +0 -3
  109. package/dist/src/_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/index.js +0 -6
  110. package/dist/src/_dependencies/source/0x98670585b87e06628ef2d7f7cb1e7bee8ada65b43b82997935225a7e6e21d18e/index.d.ts +0 -3
  111. package/dist/src/_dependencies/source/0x98670585b87e06628ef2d7f7cb1e7bee8ada65b43b82997935225a7e6e21d18e/index.js +0 -6
  112. /package/dist/src/_dependencies/source/{0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded → 0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274}/vault/structs.js +0 -0
@@ -0,0 +1,733 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
46
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
47
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
48
+ return new (P || (P = Promise))(function (resolve, reject) {
49
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
50
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
51
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
52
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
53
+ });
54
+ };
55
+ var __generator = (this && this.__generator) || function (thisArg, body) {
56
+ 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);
57
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
58
+ function verb(n) { return function (v) { return step([n, v]); }; }
59
+ function step(op) {
60
+ if (f) throw new TypeError("Generator is already executing.");
61
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
62
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
63
+ if (y = 0, t) op = [op[0] & 2, t.value];
64
+ switch (op[0]) {
65
+ case 0: case 1: t = op; break;
66
+ case 4: _.label++; return { value: op[1], done: false };
67
+ case 5: _.label++; y = op[1]; op = [0]; continue;
68
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
69
+ default:
70
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
71
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
72
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
73
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
74
+ if (t[2]) _.ops.pop();
75
+ _.trys.pop(); continue;
76
+ }
77
+ op = body.call(thisArg, _);
78
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
79
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
80
+ }
81
+ };
82
+ var __read = (this && this.__read) || function (o, n) {
83
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
84
+ if (!m) return o;
85
+ var i = m.call(o), r, ar = [], e;
86
+ try {
87
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
88
+ }
89
+ catch (error) { e = { error: error }; }
90
+ finally {
91
+ try {
92
+ if (r && !r.done && (m = i["return"])) m.call(i);
93
+ }
94
+ finally { if (e) throw e.error; }
95
+ }
96
+ return ar;
97
+ };
98
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
99
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
100
+ if (ar || !(i in from)) {
101
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
102
+ ar[i] = from[i];
103
+ }
104
+ }
105
+ return to.concat(ar || Array.prototype.slice.call(from));
106
+ };
107
+ Object.defineProperty(exports, "__esModule", { value: true });
108
+ exports.TgldRegistry = exports.TGLD = exports.MintEvent = exports.BurnEvent = void 0;
109
+ exports.isBurnEvent = isBurnEvent;
110
+ exports.isMintEvent = isMintEvent;
111
+ exports.isTGLD = isTGLD;
112
+ exports.isTgldRegistry = isTgldRegistry;
113
+ var reified = __importStar(require("../../../../_framework/reified"));
114
+ var reified_1 = require("../../../../_framework/reified");
115
+ var util_1 = require("../../../../_framework/util");
116
+ var structs_1 = require("../../0x2/coin/structs");
117
+ var structs_2 = require("../../0x2/object/structs");
118
+ var structs_3 = require("../../0x2/token/structs");
119
+ var index_1 = require("../index");
120
+ var bcs_1 = require("@mysten/sui/bcs");
121
+ var utils_1 = require("@mysten/sui/utils");
122
+ /* ============================== BurnEvent =============================== */
123
+ function isBurnEvent(type) {
124
+ type = (0, util_1.compressSuiType)(type);
125
+ return type === "".concat(index_1.PKG_V1, "::tgld::BurnEvent");
126
+ }
127
+ var BurnEvent = /** @class */ (function () {
128
+ function BurnEvent(typeArgs, fields) {
129
+ this.__StructClass = true;
130
+ this.$typeName = BurnEvent.$typeName;
131
+ this.$isPhantom = BurnEvent.$isPhantom;
132
+ this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([BurnEvent.$typeName], __read(typeArgs), false));
133
+ this.$typeArgs = typeArgs;
134
+ this.log = fields.log;
135
+ this.bcsPadding = fields.bcsPadding;
136
+ }
137
+ BurnEvent.reified = function () {
138
+ var _this = this;
139
+ return {
140
+ typeName: BurnEvent.$typeName,
141
+ fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([BurnEvent.$typeName], [], false)),
142
+ typeArgs: [],
143
+ isPhantom: BurnEvent.$isPhantom,
144
+ reifiedTypeArgs: [],
145
+ fromFields: function (fields) { return BurnEvent.fromFields(fields); },
146
+ fromFieldsWithTypes: function (item) { return BurnEvent.fromFieldsWithTypes(item); },
147
+ fromBcs: function (data) { return BurnEvent.fromBcs(data); },
148
+ bcs: BurnEvent.bcs,
149
+ fromJSONField: function (field) { return BurnEvent.fromJSONField(field); },
150
+ fromJSON: function (json) { return BurnEvent.fromJSON(json); },
151
+ fromSuiParsedData: function (content) { return BurnEvent.fromSuiParsedData(content); },
152
+ fromSuiObjectData: function (content) { return BurnEvent.fromSuiObjectData(content); },
153
+ fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
154
+ return [2 /*return*/, BurnEvent.fetch(client, id)];
155
+ }); }); },
156
+ new: function (fields) {
157
+ return new BurnEvent([], fields);
158
+ },
159
+ kind: "StructClassReified",
160
+ };
161
+ };
162
+ Object.defineProperty(BurnEvent, "r", {
163
+ get: function () {
164
+ return BurnEvent.reified();
165
+ },
166
+ enumerable: false,
167
+ configurable: true
168
+ });
169
+ BurnEvent.phantom = function () {
170
+ return (0, reified_1.phantom)(BurnEvent.reified());
171
+ };
172
+ Object.defineProperty(BurnEvent, "p", {
173
+ get: function () {
174
+ return BurnEvent.phantom();
175
+ },
176
+ enumerable: false,
177
+ configurable: true
178
+ });
179
+ Object.defineProperty(BurnEvent, "bcs", {
180
+ get: function () {
181
+ return bcs_1.bcs.struct("BurnEvent", {
182
+ log: bcs_1.bcs.vector(bcs_1.bcs.u64()),
183
+ bcs_padding: bcs_1.bcs.vector(bcs_1.bcs.vector(bcs_1.bcs.u8())),
184
+ });
185
+ },
186
+ enumerable: false,
187
+ configurable: true
188
+ });
189
+ BurnEvent.fromFields = function (fields) {
190
+ return BurnEvent.reified().new({
191
+ log: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.log),
192
+ bcsPadding: (0, reified_1.decodeFromFields)(reified.vector(reified.vector("u8")), fields.bcs_padding),
193
+ });
194
+ };
195
+ BurnEvent.fromFieldsWithTypes = function (item) {
196
+ if (!isBurnEvent(item.type)) {
197
+ throw new Error("not a BurnEvent type");
198
+ }
199
+ return BurnEvent.reified().new({
200
+ log: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.log),
201
+ bcsPadding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector(reified.vector("u8")), item.fields.bcs_padding),
202
+ });
203
+ };
204
+ BurnEvent.fromBcs = function (data) {
205
+ return BurnEvent.fromFields(BurnEvent.bcs.parse(data));
206
+ };
207
+ BurnEvent.prototype.toJSONField = function () {
208
+ return {
209
+ log: (0, reified_1.fieldToJSON)("vector<u64>", this.log),
210
+ bcsPadding: (0, reified_1.fieldToJSON)("vector<vector<u8>>", this.bcsPadding),
211
+ };
212
+ };
213
+ BurnEvent.prototype.toJSON = function () {
214
+ return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
215
+ };
216
+ BurnEvent.fromJSONField = function (field) {
217
+ return BurnEvent.reified().new({
218
+ log: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.log),
219
+ bcsPadding: (0, reified_1.decodeFromJSONField)(reified.vector(reified.vector("u8")), field.bcsPadding),
220
+ });
221
+ };
222
+ BurnEvent.fromJSON = function (json) {
223
+ if (json.$typeName !== BurnEvent.$typeName) {
224
+ throw new Error("not a WithTwoGenerics json object");
225
+ }
226
+ return BurnEvent.fromJSONField(json);
227
+ };
228
+ BurnEvent.fromSuiParsedData = function (content) {
229
+ if (content.dataType !== "moveObject") {
230
+ throw new Error("not an object");
231
+ }
232
+ if (!isBurnEvent(content.type)) {
233
+ throw new Error("object at ".concat(content.fields.id, " is not a BurnEvent object"));
234
+ }
235
+ return BurnEvent.fromFieldsWithTypes(content);
236
+ };
237
+ BurnEvent.fromSuiObjectData = function (data) {
238
+ if (data.bcs) {
239
+ if (data.bcs.dataType !== "moveObject" || !isBurnEvent(data.bcs.type)) {
240
+ throw new Error("object at is not a BurnEvent object");
241
+ }
242
+ return BurnEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
243
+ }
244
+ if (data.content) {
245
+ return BurnEvent.fromSuiParsedData(data.content);
246
+ }
247
+ throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
248
+ };
249
+ BurnEvent.fetch = function (client, id) {
250
+ return __awaiter(this, void 0, void 0, function () {
251
+ var res;
252
+ var _a, _b;
253
+ return __generator(this, function (_c) {
254
+ switch (_c.label) {
255
+ case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
256
+ case 1:
257
+ res = _c.sent();
258
+ if (res.error) {
259
+ throw new Error("error fetching BurnEvent object at id ".concat(id, ": ").concat(res.error.code));
260
+ }
261
+ if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isBurnEvent(res.data.bcs.type)) {
262
+ throw new Error("object at id ".concat(id, " is not a BurnEvent object"));
263
+ }
264
+ return [2 /*return*/, BurnEvent.fromSuiObjectData(res.data)];
265
+ }
266
+ });
267
+ });
268
+ };
269
+ BurnEvent.$typeName = "".concat(index_1.PKG_V1, "::tgld::BurnEvent");
270
+ BurnEvent.$numTypeParams = 0;
271
+ BurnEvent.$isPhantom = [];
272
+ return BurnEvent;
273
+ }());
274
+ exports.BurnEvent = BurnEvent;
275
+ /* ============================== MintEvent =============================== */
276
+ function isMintEvent(type) {
277
+ type = (0, util_1.compressSuiType)(type);
278
+ return type === "".concat(index_1.PKG_V1, "::tgld::MintEvent");
279
+ }
280
+ var MintEvent = /** @class */ (function () {
281
+ function MintEvent(typeArgs, fields) {
282
+ this.__StructClass = true;
283
+ this.$typeName = MintEvent.$typeName;
284
+ this.$isPhantom = MintEvent.$isPhantom;
285
+ this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([MintEvent.$typeName], __read(typeArgs), false));
286
+ this.$typeArgs = typeArgs;
287
+ this.recipient = fields.recipient;
288
+ this.log = fields.log;
289
+ this.bcsPadding = fields.bcsPadding;
290
+ }
291
+ MintEvent.reified = function () {
292
+ var _this = this;
293
+ return {
294
+ typeName: MintEvent.$typeName,
295
+ fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([MintEvent.$typeName], [], false)),
296
+ typeArgs: [],
297
+ isPhantom: MintEvent.$isPhantom,
298
+ reifiedTypeArgs: [],
299
+ fromFields: function (fields) { return MintEvent.fromFields(fields); },
300
+ fromFieldsWithTypes: function (item) { return MintEvent.fromFieldsWithTypes(item); },
301
+ fromBcs: function (data) { return MintEvent.fromBcs(data); },
302
+ bcs: MintEvent.bcs,
303
+ fromJSONField: function (field) { return MintEvent.fromJSONField(field); },
304
+ fromJSON: function (json) { return MintEvent.fromJSON(json); },
305
+ fromSuiParsedData: function (content) { return MintEvent.fromSuiParsedData(content); },
306
+ fromSuiObjectData: function (content) { return MintEvent.fromSuiObjectData(content); },
307
+ fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
308
+ return [2 /*return*/, MintEvent.fetch(client, id)];
309
+ }); }); },
310
+ new: function (fields) {
311
+ return new MintEvent([], fields);
312
+ },
313
+ kind: "StructClassReified",
314
+ };
315
+ };
316
+ Object.defineProperty(MintEvent, "r", {
317
+ get: function () {
318
+ return MintEvent.reified();
319
+ },
320
+ enumerable: false,
321
+ configurable: true
322
+ });
323
+ MintEvent.phantom = function () {
324
+ return (0, reified_1.phantom)(MintEvent.reified());
325
+ };
326
+ Object.defineProperty(MintEvent, "p", {
327
+ get: function () {
328
+ return MintEvent.phantom();
329
+ },
330
+ enumerable: false,
331
+ configurable: true
332
+ });
333
+ Object.defineProperty(MintEvent, "bcs", {
334
+ get: function () {
335
+ return bcs_1.bcs.struct("MintEvent", {
336
+ recipient: bcs_1.bcs.bytes(32).transform({ input: function (val) { return (0, utils_1.fromHEX)(val); }, output: function (val) { return (0, utils_1.toHEX)(val); } }),
337
+ log: bcs_1.bcs.vector(bcs_1.bcs.u64()),
338
+ bcs_padding: bcs_1.bcs.vector(bcs_1.bcs.vector(bcs_1.bcs.u8())),
339
+ });
340
+ },
341
+ enumerable: false,
342
+ configurable: true
343
+ });
344
+ MintEvent.fromFields = function (fields) {
345
+ return MintEvent.reified().new({
346
+ recipient: (0, reified_1.decodeFromFields)("address", fields.recipient),
347
+ log: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.log),
348
+ bcsPadding: (0, reified_1.decodeFromFields)(reified.vector(reified.vector("u8")), fields.bcs_padding),
349
+ });
350
+ };
351
+ MintEvent.fromFieldsWithTypes = function (item) {
352
+ if (!isMintEvent(item.type)) {
353
+ throw new Error("not a MintEvent type");
354
+ }
355
+ return MintEvent.reified().new({
356
+ recipient: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.recipient),
357
+ log: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.log),
358
+ bcsPadding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector(reified.vector("u8")), item.fields.bcs_padding),
359
+ });
360
+ };
361
+ MintEvent.fromBcs = function (data) {
362
+ return MintEvent.fromFields(MintEvent.bcs.parse(data));
363
+ };
364
+ MintEvent.prototype.toJSONField = function () {
365
+ return {
366
+ recipient: this.recipient,
367
+ log: (0, reified_1.fieldToJSON)("vector<u64>", this.log),
368
+ bcsPadding: (0, reified_1.fieldToJSON)("vector<vector<u8>>", this.bcsPadding),
369
+ };
370
+ };
371
+ MintEvent.prototype.toJSON = function () {
372
+ return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
373
+ };
374
+ MintEvent.fromJSONField = function (field) {
375
+ return MintEvent.reified().new({
376
+ recipient: (0, reified_1.decodeFromJSONField)("address", field.recipient),
377
+ log: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.log),
378
+ bcsPadding: (0, reified_1.decodeFromJSONField)(reified.vector(reified.vector("u8")), field.bcsPadding),
379
+ });
380
+ };
381
+ MintEvent.fromJSON = function (json) {
382
+ if (json.$typeName !== MintEvent.$typeName) {
383
+ throw new Error("not a WithTwoGenerics json object");
384
+ }
385
+ return MintEvent.fromJSONField(json);
386
+ };
387
+ MintEvent.fromSuiParsedData = function (content) {
388
+ if (content.dataType !== "moveObject") {
389
+ throw new Error("not an object");
390
+ }
391
+ if (!isMintEvent(content.type)) {
392
+ throw new Error("object at ".concat(content.fields.id, " is not a MintEvent object"));
393
+ }
394
+ return MintEvent.fromFieldsWithTypes(content);
395
+ };
396
+ MintEvent.fromSuiObjectData = function (data) {
397
+ if (data.bcs) {
398
+ if (data.bcs.dataType !== "moveObject" || !isMintEvent(data.bcs.type)) {
399
+ throw new Error("object at is not a MintEvent object");
400
+ }
401
+ return MintEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
402
+ }
403
+ if (data.content) {
404
+ return MintEvent.fromSuiParsedData(data.content);
405
+ }
406
+ throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
407
+ };
408
+ MintEvent.fetch = function (client, id) {
409
+ return __awaiter(this, void 0, void 0, function () {
410
+ var res;
411
+ var _a, _b;
412
+ return __generator(this, function (_c) {
413
+ switch (_c.label) {
414
+ case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
415
+ case 1:
416
+ res = _c.sent();
417
+ if (res.error) {
418
+ throw new Error("error fetching MintEvent object at id ".concat(id, ": ").concat(res.error.code));
419
+ }
420
+ if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isMintEvent(res.data.bcs.type)) {
421
+ throw new Error("object at id ".concat(id, " is not a MintEvent object"));
422
+ }
423
+ return [2 /*return*/, MintEvent.fromSuiObjectData(res.data)];
424
+ }
425
+ });
426
+ });
427
+ };
428
+ MintEvent.$typeName = "".concat(index_1.PKG_V1, "::tgld::MintEvent");
429
+ MintEvent.$numTypeParams = 0;
430
+ MintEvent.$isPhantom = [];
431
+ return MintEvent;
432
+ }());
433
+ exports.MintEvent = MintEvent;
434
+ /* ============================== TGLD =============================== */
435
+ function isTGLD(type) {
436
+ type = (0, util_1.compressSuiType)(type);
437
+ return type === "".concat(index_1.PKG_V1, "::tgld::TGLD");
438
+ }
439
+ var TGLD = /** @class */ (function () {
440
+ function TGLD(typeArgs, fields) {
441
+ this.__StructClass = true;
442
+ this.$typeName = TGLD.$typeName;
443
+ this.$isPhantom = TGLD.$isPhantom;
444
+ this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([TGLD.$typeName], __read(typeArgs), false));
445
+ this.$typeArgs = typeArgs;
446
+ this.dummyField = fields.dummyField;
447
+ }
448
+ TGLD.reified = function () {
449
+ var _this = this;
450
+ return {
451
+ typeName: TGLD.$typeName,
452
+ fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([TGLD.$typeName], [], false)),
453
+ typeArgs: [],
454
+ isPhantom: TGLD.$isPhantom,
455
+ reifiedTypeArgs: [],
456
+ fromFields: function (fields) { return TGLD.fromFields(fields); },
457
+ fromFieldsWithTypes: function (item) { return TGLD.fromFieldsWithTypes(item); },
458
+ fromBcs: function (data) { return TGLD.fromBcs(data); },
459
+ bcs: TGLD.bcs,
460
+ fromJSONField: function (field) { return TGLD.fromJSONField(field); },
461
+ fromJSON: function (json) { return TGLD.fromJSON(json); },
462
+ fromSuiParsedData: function (content) { return TGLD.fromSuiParsedData(content); },
463
+ fromSuiObjectData: function (content) { return TGLD.fromSuiObjectData(content); },
464
+ fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
465
+ return [2 /*return*/, TGLD.fetch(client, id)];
466
+ }); }); },
467
+ new: function (fields) {
468
+ return new TGLD([], fields);
469
+ },
470
+ kind: "StructClassReified",
471
+ };
472
+ };
473
+ Object.defineProperty(TGLD, "r", {
474
+ get: function () {
475
+ return TGLD.reified();
476
+ },
477
+ enumerable: false,
478
+ configurable: true
479
+ });
480
+ TGLD.phantom = function () {
481
+ return (0, reified_1.phantom)(TGLD.reified());
482
+ };
483
+ Object.defineProperty(TGLD, "p", {
484
+ get: function () {
485
+ return TGLD.phantom();
486
+ },
487
+ enumerable: false,
488
+ configurable: true
489
+ });
490
+ Object.defineProperty(TGLD, "bcs", {
491
+ get: function () {
492
+ return bcs_1.bcs.struct("TGLD", {
493
+ dummy_field: bcs_1.bcs.bool(),
494
+ });
495
+ },
496
+ enumerable: false,
497
+ configurable: true
498
+ });
499
+ TGLD.fromFields = function (fields) {
500
+ return TGLD.reified().new({ dummyField: (0, reified_1.decodeFromFields)("bool", fields.dummy_field) });
501
+ };
502
+ TGLD.fromFieldsWithTypes = function (item) {
503
+ if (!isTGLD(item.type)) {
504
+ throw new Error("not a TGLD type");
505
+ }
506
+ return TGLD.reified().new({ dummyField: (0, reified_1.decodeFromFieldsWithTypes)("bool", item.fields.dummy_field) });
507
+ };
508
+ TGLD.fromBcs = function (data) {
509
+ return TGLD.fromFields(TGLD.bcs.parse(data));
510
+ };
511
+ TGLD.prototype.toJSONField = function () {
512
+ return {
513
+ dummyField: this.dummyField,
514
+ };
515
+ };
516
+ TGLD.prototype.toJSON = function () {
517
+ return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
518
+ };
519
+ TGLD.fromJSONField = function (field) {
520
+ return TGLD.reified().new({ dummyField: (0, reified_1.decodeFromJSONField)("bool", field.dummyField) });
521
+ };
522
+ TGLD.fromJSON = function (json) {
523
+ if (json.$typeName !== TGLD.$typeName) {
524
+ throw new Error("not a WithTwoGenerics json object");
525
+ }
526
+ return TGLD.fromJSONField(json);
527
+ };
528
+ TGLD.fromSuiParsedData = function (content) {
529
+ if (content.dataType !== "moveObject") {
530
+ throw new Error("not an object");
531
+ }
532
+ if (!isTGLD(content.type)) {
533
+ throw new Error("object at ".concat(content.fields.id, " is not a TGLD object"));
534
+ }
535
+ return TGLD.fromFieldsWithTypes(content);
536
+ };
537
+ TGLD.fromSuiObjectData = function (data) {
538
+ if (data.bcs) {
539
+ if (data.bcs.dataType !== "moveObject" || !isTGLD(data.bcs.type)) {
540
+ throw new Error("object at is not a TGLD object");
541
+ }
542
+ return TGLD.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
543
+ }
544
+ if (data.content) {
545
+ return TGLD.fromSuiParsedData(data.content);
546
+ }
547
+ throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
548
+ };
549
+ TGLD.fetch = function (client, id) {
550
+ return __awaiter(this, void 0, void 0, function () {
551
+ var res;
552
+ var _a, _b;
553
+ return __generator(this, function (_c) {
554
+ switch (_c.label) {
555
+ case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
556
+ case 1:
557
+ res = _c.sent();
558
+ if (res.error) {
559
+ throw new Error("error fetching TGLD object at id ".concat(id, ": ").concat(res.error.code));
560
+ }
561
+ if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isTGLD(res.data.bcs.type)) {
562
+ throw new Error("object at id ".concat(id, " is not a TGLD object"));
563
+ }
564
+ return [2 /*return*/, TGLD.fromSuiObjectData(res.data)];
565
+ }
566
+ });
567
+ });
568
+ };
569
+ TGLD.$typeName = "".concat(index_1.PKG_V1, "::tgld::TGLD");
570
+ TGLD.$numTypeParams = 0;
571
+ TGLD.$isPhantom = [];
572
+ return TGLD;
573
+ }());
574
+ exports.TGLD = TGLD;
575
+ /* ============================== TgldRegistry =============================== */
576
+ function isTgldRegistry(type) {
577
+ type = (0, util_1.compressSuiType)(type);
578
+ return type === "".concat(index_1.PKG_V1, "::tgld::TgldRegistry");
579
+ }
580
+ var TgldRegistry = /** @class */ (function () {
581
+ function TgldRegistry(typeArgs, fields) {
582
+ this.__StructClass = true;
583
+ this.$typeName = TgldRegistry.$typeName;
584
+ this.$isPhantom = TgldRegistry.$isPhantom;
585
+ this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([TgldRegistry.$typeName], __read(typeArgs), false));
586
+ this.$typeArgs = typeArgs;
587
+ this.id = fields.id;
588
+ this.treasuryCap = fields.treasuryCap;
589
+ this.tokenPolicyCap = fields.tokenPolicyCap;
590
+ }
591
+ TgldRegistry.reified = function () {
592
+ var _this = this;
593
+ return {
594
+ typeName: TgldRegistry.$typeName,
595
+ fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([TgldRegistry.$typeName], [], false)),
596
+ typeArgs: [],
597
+ isPhantom: TgldRegistry.$isPhantom,
598
+ reifiedTypeArgs: [],
599
+ fromFields: function (fields) { return TgldRegistry.fromFields(fields); },
600
+ fromFieldsWithTypes: function (item) { return TgldRegistry.fromFieldsWithTypes(item); },
601
+ fromBcs: function (data) { return TgldRegistry.fromBcs(data); },
602
+ bcs: TgldRegistry.bcs,
603
+ fromJSONField: function (field) { return TgldRegistry.fromJSONField(field); },
604
+ fromJSON: function (json) { return TgldRegistry.fromJSON(json); },
605
+ fromSuiParsedData: function (content) { return TgldRegistry.fromSuiParsedData(content); },
606
+ fromSuiObjectData: function (content) { return TgldRegistry.fromSuiObjectData(content); },
607
+ fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
608
+ return [2 /*return*/, TgldRegistry.fetch(client, id)];
609
+ }); }); },
610
+ new: function (fields) {
611
+ return new TgldRegistry([], fields);
612
+ },
613
+ kind: "StructClassReified",
614
+ };
615
+ };
616
+ Object.defineProperty(TgldRegistry, "r", {
617
+ get: function () {
618
+ return TgldRegistry.reified();
619
+ },
620
+ enumerable: false,
621
+ configurable: true
622
+ });
623
+ TgldRegistry.phantom = function () {
624
+ return (0, reified_1.phantom)(TgldRegistry.reified());
625
+ };
626
+ Object.defineProperty(TgldRegistry, "p", {
627
+ get: function () {
628
+ return TgldRegistry.phantom();
629
+ },
630
+ enumerable: false,
631
+ configurable: true
632
+ });
633
+ Object.defineProperty(TgldRegistry, "bcs", {
634
+ get: function () {
635
+ return bcs_1.bcs.struct("TgldRegistry", {
636
+ id: structs_2.UID.bcs,
637
+ treasury_cap: structs_1.TreasuryCap.bcs,
638
+ token_policy_cap: structs_3.TokenPolicyCap.bcs,
639
+ });
640
+ },
641
+ enumerable: false,
642
+ configurable: true
643
+ });
644
+ TgldRegistry.fromFields = function (fields) {
645
+ return TgldRegistry.reified().new({
646
+ id: (0, reified_1.decodeFromFields)(structs_2.UID.reified(), fields.id),
647
+ treasuryCap: (0, reified_1.decodeFromFields)(structs_1.TreasuryCap.reified(reified.phantom(TGLD.reified())), fields.treasury_cap),
648
+ tokenPolicyCap: (0, reified_1.decodeFromFields)(structs_3.TokenPolicyCap.reified(reified.phantom(TGLD.reified())), fields.token_policy_cap),
649
+ });
650
+ };
651
+ TgldRegistry.fromFieldsWithTypes = function (item) {
652
+ if (!isTgldRegistry(item.type)) {
653
+ throw new Error("not a TgldRegistry type");
654
+ }
655
+ return TgldRegistry.reified().new({
656
+ id: (0, reified_1.decodeFromFieldsWithTypes)(structs_2.UID.reified(), item.fields.id),
657
+ treasuryCap: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TreasuryCap.reified(reified.phantom(TGLD.reified())), item.fields.treasury_cap),
658
+ tokenPolicyCap: (0, reified_1.decodeFromFieldsWithTypes)(structs_3.TokenPolicyCap.reified(reified.phantom(TGLD.reified())), item.fields.token_policy_cap),
659
+ });
660
+ };
661
+ TgldRegistry.fromBcs = function (data) {
662
+ return TgldRegistry.fromFields(TgldRegistry.bcs.parse(data));
663
+ };
664
+ TgldRegistry.prototype.toJSONField = function () {
665
+ return {
666
+ id: this.id,
667
+ treasuryCap: this.treasuryCap.toJSONField(),
668
+ tokenPolicyCap: this.tokenPolicyCap.toJSONField(),
669
+ };
670
+ };
671
+ TgldRegistry.prototype.toJSON = function () {
672
+ return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
673
+ };
674
+ TgldRegistry.fromJSONField = function (field) {
675
+ return TgldRegistry.reified().new({
676
+ id: (0, reified_1.decodeFromJSONField)(structs_2.UID.reified(), field.id),
677
+ treasuryCap: (0, reified_1.decodeFromJSONField)(structs_1.TreasuryCap.reified(reified.phantom(TGLD.reified())), field.treasuryCap),
678
+ tokenPolicyCap: (0, reified_1.decodeFromJSONField)(structs_3.TokenPolicyCap.reified(reified.phantom(TGLD.reified())), field.tokenPolicyCap),
679
+ });
680
+ };
681
+ TgldRegistry.fromJSON = function (json) {
682
+ if (json.$typeName !== TgldRegistry.$typeName) {
683
+ throw new Error("not a WithTwoGenerics json object");
684
+ }
685
+ return TgldRegistry.fromJSONField(json);
686
+ };
687
+ TgldRegistry.fromSuiParsedData = function (content) {
688
+ if (content.dataType !== "moveObject") {
689
+ throw new Error("not an object");
690
+ }
691
+ if (!isTgldRegistry(content.type)) {
692
+ throw new Error("object at ".concat(content.fields.id, " is not a TgldRegistry object"));
693
+ }
694
+ return TgldRegistry.fromFieldsWithTypes(content);
695
+ };
696
+ TgldRegistry.fromSuiObjectData = function (data) {
697
+ if (data.bcs) {
698
+ if (data.bcs.dataType !== "moveObject" || !isTgldRegistry(data.bcs.type)) {
699
+ throw new Error("object at is not a TgldRegistry object");
700
+ }
701
+ return TgldRegistry.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
702
+ }
703
+ if (data.content) {
704
+ return TgldRegistry.fromSuiParsedData(data.content);
705
+ }
706
+ throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
707
+ };
708
+ TgldRegistry.fetch = function (client, id) {
709
+ return __awaiter(this, void 0, void 0, function () {
710
+ var res;
711
+ var _a, _b;
712
+ return __generator(this, function (_c) {
713
+ switch (_c.label) {
714
+ case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
715
+ case 1:
716
+ res = _c.sent();
717
+ if (res.error) {
718
+ throw new Error("error fetching TgldRegistry object at id ".concat(id, ": ").concat(res.error.code));
719
+ }
720
+ if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isTgldRegistry(res.data.bcs.type)) {
721
+ throw new Error("object at id ".concat(id, " is not a TgldRegistry object"));
722
+ }
723
+ return [2 /*return*/, TgldRegistry.fromSuiObjectData(res.data)];
724
+ }
725
+ });
726
+ });
727
+ };
728
+ TgldRegistry.$typeName = "".concat(index_1.PKG_V1, "::tgld::TgldRegistry");
729
+ TgldRegistry.$numTypeParams = 0;
730
+ TgldRegistry.$isPhantom = [];
731
+ return TgldRegistry;
732
+ }());
733
+ exports.TgldRegistry = TgldRegistry;