@story-protocol/core-sdk 0.0.1-beta-rc.1
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/README.md +85 -0
- package/dist/declarations/src/client.d.ts +76 -0
- package/dist/declarations/src/client.d.ts.map +1 -0
- package/dist/declarations/src/constants/common.d.ts +3 -0
- package/dist/declarations/src/constants/common.d.ts.map +1 -0
- package/dist/declarations/src/enums/ActionType.d.ts +11 -0
- package/dist/declarations/src/enums/ActionType.d.ts.map +1 -0
- package/dist/declarations/src/enums/ResourceType.d.ts +15 -0
- package/dist/declarations/src/enums/ResourceType.d.ts.map +1 -0
- package/dist/declarations/src/index.d.ts +19 -0
- package/dist/declarations/src/index.d.ts.map +1 -0
- package/dist/declarations/src/resources/ipAsset.d.ts +23 -0
- package/dist/declarations/src/resources/ipAsset.d.ts.map +1 -0
- package/dist/declarations/src/resources/ipAssetReadOnly.d.ts +26 -0
- package/dist/declarations/src/resources/ipAssetReadOnly.d.ts.map +1 -0
- package/dist/declarations/src/resources/moduleReadOnly.d.ts +25 -0
- package/dist/declarations/src/resources/moduleReadOnly.d.ts.map +1 -0
- package/dist/declarations/src/resources/permission.d.ts +16 -0
- package/dist/declarations/src/resources/permission.d.ts.map +1 -0
- package/dist/declarations/src/resources/permissionReadOnly.d.ts +25 -0
- package/dist/declarations/src/resources/permissionReadOnly.d.ts.map +1 -0
- package/dist/declarations/src/resources/tagging.d.ts +11 -0
- package/dist/declarations/src/resources/tagging.d.ts.map +1 -0
- package/dist/declarations/src/resources/taggingReadOnly.d.ts +24 -0
- package/dist/declarations/src/resources/taggingReadOnly.d.ts.map +1 -0
- package/dist/declarations/src/resources/transaction.d.ts +11 -0
- package/dist/declarations/src/resources/transaction.d.ts.map +1 -0
- package/dist/declarations/src/resources/transactionReadOnly.d.ts +25 -0
- package/dist/declarations/src/resources/transactionReadOnly.d.ts.map +1 -0
- package/dist/declarations/src/types/client.d.ts +23 -0
- package/dist/declarations/src/types/client.d.ts.map +1 -0
- package/dist/declarations/src/types/common.d.ts +6 -0
- package/dist/declarations/src/types/common.d.ts.map +1 -0
- package/dist/declarations/src/types/config.d.ts +19 -0
- package/dist/declarations/src/types/config.d.ts.map +1 -0
- package/dist/declarations/src/types/options.d.ts +12 -0
- package/dist/declarations/src/types/options.d.ts.map +1 -0
- package/dist/declarations/src/types/resources/ipAsset.d.ts +144 -0
- package/dist/declarations/src/types/resources/ipAsset.d.ts.map +1 -0
- package/dist/declarations/src/types/resources/module.d.ts +43 -0
- package/dist/declarations/src/types/resources/module.d.ts.map +1 -0
- package/dist/declarations/src/types/resources/permission.d.ts +35 -0
- package/dist/declarations/src/types/resources/permission.d.ts.map +1 -0
- package/dist/declarations/src/types/resources/tagging.d.ts +35 -0
- package/dist/declarations/src/types/resources/tagging.d.ts.map +1 -0
- package/dist/declarations/src/types/resources/transaction.d.ts +52 -0
- package/dist/declarations/src/types/resources/transaction.d.ts.map +1 -0
- package/dist/declarations/src/utils/platform.d.ts +17 -0
- package/dist/declarations/src/utils/platform.d.ts.map +1 -0
- package/dist/story-protocol-core-sdk.cjs.d.ts +2 -0
- package/dist/story-protocol-core-sdk.cjs.d.ts.map +1 -0
- package/dist/story-protocol-core-sdk.cjs.dev.js +2367 -0
- package/dist/story-protocol-core-sdk.cjs.js +7 -0
- package/dist/story-protocol-core-sdk.cjs.prod.js +2367 -0
- package/dist/story-protocol-core-sdk.esm.js +2328 -0
- package/package.json +91 -0
@@ -0,0 +1,2367 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
var axios = require('axios');
|
6
|
+
var viem = require('viem');
|
7
|
+
var chains = require('viem/chains');
|
8
|
+
var dotenv = require('dotenv');
|
9
|
+
var abitype = require('abitype');
|
10
|
+
|
11
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
12
|
+
|
13
|
+
function _interopNamespace(e) {
|
14
|
+
if (e && e.__esModule) return e;
|
15
|
+
var n = Object.create(null);
|
16
|
+
if (e) {
|
17
|
+
Object.keys(e).forEach(function (k) {
|
18
|
+
if (k !== 'default') {
|
19
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
20
|
+
Object.defineProperty(n, k, d.get ? d : {
|
21
|
+
enumerable: true,
|
22
|
+
get: function () { return e[k]; }
|
23
|
+
});
|
24
|
+
}
|
25
|
+
});
|
26
|
+
}
|
27
|
+
n["default"] = e;
|
28
|
+
return Object.freeze(n);
|
29
|
+
}
|
30
|
+
|
31
|
+
var axios__default = /*#__PURE__*/_interopDefault(axios);
|
32
|
+
var dotenv__namespace = /*#__PURE__*/_interopNamespace(dotenv);
|
33
|
+
|
34
|
+
function _toPrimitive(input, hint) {
|
35
|
+
if (typeof input !== "object" || input === null) return input;
|
36
|
+
var prim = input[Symbol.toPrimitive];
|
37
|
+
if (prim !== undefined) {
|
38
|
+
var res = prim.call(input, hint || "default");
|
39
|
+
if (typeof res !== "object") return res;
|
40
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
41
|
+
}
|
42
|
+
return (hint === "string" ? String : Number)(input);
|
43
|
+
}
|
44
|
+
|
45
|
+
function _toPropertyKey(arg) {
|
46
|
+
var key = _toPrimitive(arg, "string");
|
47
|
+
return typeof key === "symbol" ? key : String(key);
|
48
|
+
}
|
49
|
+
|
50
|
+
function _defineProperty(obj, key, value) {
|
51
|
+
key = _toPropertyKey(key);
|
52
|
+
if (key in obj) {
|
53
|
+
Object.defineProperty(obj, key, {
|
54
|
+
value: value,
|
55
|
+
enumerable: true,
|
56
|
+
configurable: true,
|
57
|
+
writable: true
|
58
|
+
});
|
59
|
+
} else {
|
60
|
+
obj[key] = value;
|
61
|
+
}
|
62
|
+
return obj;
|
63
|
+
}
|
64
|
+
|
65
|
+
function ownKeys(e, r) {
|
66
|
+
var t = Object.keys(e);
|
67
|
+
if (Object.getOwnPropertySymbols) {
|
68
|
+
var o = Object.getOwnPropertySymbols(e);
|
69
|
+
r && (o = o.filter(function (r) {
|
70
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
71
|
+
})), t.push.apply(t, o);
|
72
|
+
}
|
73
|
+
return t;
|
74
|
+
}
|
75
|
+
function _objectSpread2(e) {
|
76
|
+
for (var r = 1; r < arguments.length; r++) {
|
77
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
78
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
79
|
+
_defineProperty(e, r, t[r]);
|
80
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
81
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
82
|
+
});
|
83
|
+
}
|
84
|
+
return e;
|
85
|
+
}
|
86
|
+
|
87
|
+
function _classCallCheck(instance, Constructor) {
|
88
|
+
if (!(instance instanceof Constructor)) {
|
89
|
+
throw new TypeError("Cannot call a class as a function");
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
function _defineProperties(target, props) {
|
94
|
+
for (var i = 0; i < props.length; i++) {
|
95
|
+
var descriptor = props[i];
|
96
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
97
|
+
descriptor.configurable = true;
|
98
|
+
if ("value" in descriptor) descriptor.writable = true;
|
99
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
100
|
+
}
|
101
|
+
}
|
102
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
103
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
104
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
105
|
+
Object.defineProperty(Constructor, "prototype", {
|
106
|
+
writable: false
|
107
|
+
});
|
108
|
+
return Constructor;
|
109
|
+
}
|
110
|
+
|
111
|
+
function _setPrototypeOf(o, p) {
|
112
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
113
|
+
o.__proto__ = p;
|
114
|
+
return o;
|
115
|
+
};
|
116
|
+
return _setPrototypeOf(o, p);
|
117
|
+
}
|
118
|
+
|
119
|
+
function _inherits(subClass, superClass) {
|
120
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
121
|
+
throw new TypeError("Super expression must either be null or a function");
|
122
|
+
}
|
123
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
124
|
+
constructor: {
|
125
|
+
value: subClass,
|
126
|
+
writable: true,
|
127
|
+
configurable: true
|
128
|
+
}
|
129
|
+
});
|
130
|
+
Object.defineProperty(subClass, "prototype", {
|
131
|
+
writable: false
|
132
|
+
});
|
133
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
134
|
+
}
|
135
|
+
|
136
|
+
function _getPrototypeOf(o) {
|
137
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
138
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
139
|
+
};
|
140
|
+
return _getPrototypeOf(o);
|
141
|
+
}
|
142
|
+
|
143
|
+
function _isNativeReflectConstruct() {
|
144
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
145
|
+
if (Reflect.construct.sham) return false;
|
146
|
+
if (typeof Proxy === "function") return true;
|
147
|
+
try {
|
148
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
149
|
+
return true;
|
150
|
+
} catch (e) {
|
151
|
+
return false;
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
155
|
+
function _assertThisInitialized(self) {
|
156
|
+
if (self === void 0) {
|
157
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
158
|
+
}
|
159
|
+
return self;
|
160
|
+
}
|
161
|
+
|
162
|
+
function _possibleConstructorReturn(self, call) {
|
163
|
+
if (call && (typeof call === "object" || typeof call === "function")) {
|
164
|
+
return call;
|
165
|
+
} else if (call !== void 0) {
|
166
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
167
|
+
}
|
168
|
+
return _assertThisInitialized(self);
|
169
|
+
}
|
170
|
+
|
171
|
+
function _createSuper(Derived) {
|
172
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
173
|
+
return function _createSuperInternal() {
|
174
|
+
var Super = _getPrototypeOf(Derived),
|
175
|
+
result;
|
176
|
+
if (hasNativeReflectConstruct) {
|
177
|
+
var NewTarget = _getPrototypeOf(this).constructor;
|
178
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
179
|
+
} else {
|
180
|
+
result = Super.apply(this, arguments);
|
181
|
+
}
|
182
|
+
return _possibleConstructorReturn(this, result);
|
183
|
+
};
|
184
|
+
}
|
185
|
+
|
186
|
+
function _regeneratorRuntime() {
|
187
|
+
_regeneratorRuntime = function () {
|
188
|
+
return e;
|
189
|
+
};
|
190
|
+
var t,
|
191
|
+
e = {},
|
192
|
+
r = Object.prototype,
|
193
|
+
n = r.hasOwnProperty,
|
194
|
+
o = Object.defineProperty || function (t, e, r) {
|
195
|
+
t[e] = r.value;
|
196
|
+
},
|
197
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
198
|
+
a = i.iterator || "@@iterator",
|
199
|
+
c = i.asyncIterator || "@@asyncIterator",
|
200
|
+
u = i.toStringTag || "@@toStringTag";
|
201
|
+
function define(t, e, r) {
|
202
|
+
return Object.defineProperty(t, e, {
|
203
|
+
value: r,
|
204
|
+
enumerable: !0,
|
205
|
+
configurable: !0,
|
206
|
+
writable: !0
|
207
|
+
}), t[e];
|
208
|
+
}
|
209
|
+
try {
|
210
|
+
define({}, "");
|
211
|
+
} catch (t) {
|
212
|
+
define = function (t, e, r) {
|
213
|
+
return t[e] = r;
|
214
|
+
};
|
215
|
+
}
|
216
|
+
function wrap(t, e, r, n) {
|
217
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
218
|
+
a = Object.create(i.prototype),
|
219
|
+
c = new Context(n || []);
|
220
|
+
return o(a, "_invoke", {
|
221
|
+
value: makeInvokeMethod(t, r, c)
|
222
|
+
}), a;
|
223
|
+
}
|
224
|
+
function tryCatch(t, e, r) {
|
225
|
+
try {
|
226
|
+
return {
|
227
|
+
type: "normal",
|
228
|
+
arg: t.call(e, r)
|
229
|
+
};
|
230
|
+
} catch (t) {
|
231
|
+
return {
|
232
|
+
type: "throw",
|
233
|
+
arg: t
|
234
|
+
};
|
235
|
+
}
|
236
|
+
}
|
237
|
+
e.wrap = wrap;
|
238
|
+
var h = "suspendedStart",
|
239
|
+
l = "suspendedYield",
|
240
|
+
f = "executing",
|
241
|
+
s = "completed",
|
242
|
+
y = {};
|
243
|
+
function Generator() {}
|
244
|
+
function GeneratorFunction() {}
|
245
|
+
function GeneratorFunctionPrototype() {}
|
246
|
+
var p = {};
|
247
|
+
define(p, a, function () {
|
248
|
+
return this;
|
249
|
+
});
|
250
|
+
var d = Object.getPrototypeOf,
|
251
|
+
v = d && d(d(values([])));
|
252
|
+
v && v !== r && n.call(v, a) && (p = v);
|
253
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
254
|
+
function defineIteratorMethods(t) {
|
255
|
+
["next", "throw", "return"].forEach(function (e) {
|
256
|
+
define(t, e, function (t) {
|
257
|
+
return this._invoke(e, t);
|
258
|
+
});
|
259
|
+
});
|
260
|
+
}
|
261
|
+
function AsyncIterator(t, e) {
|
262
|
+
function invoke(r, o, i, a) {
|
263
|
+
var c = tryCatch(t[r], t, o);
|
264
|
+
if ("throw" !== c.type) {
|
265
|
+
var u = c.arg,
|
266
|
+
h = u.value;
|
267
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
268
|
+
invoke("next", t, i, a);
|
269
|
+
}, function (t) {
|
270
|
+
invoke("throw", t, i, a);
|
271
|
+
}) : e.resolve(h).then(function (t) {
|
272
|
+
u.value = t, i(u);
|
273
|
+
}, function (t) {
|
274
|
+
return invoke("throw", t, i, a);
|
275
|
+
});
|
276
|
+
}
|
277
|
+
a(c.arg);
|
278
|
+
}
|
279
|
+
var r;
|
280
|
+
o(this, "_invoke", {
|
281
|
+
value: function (t, n) {
|
282
|
+
function callInvokeWithMethodAndArg() {
|
283
|
+
return new e(function (e, r) {
|
284
|
+
invoke(t, n, e, r);
|
285
|
+
});
|
286
|
+
}
|
287
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
288
|
+
}
|
289
|
+
});
|
290
|
+
}
|
291
|
+
function makeInvokeMethod(e, r, n) {
|
292
|
+
var o = h;
|
293
|
+
return function (i, a) {
|
294
|
+
if (o === f) throw new Error("Generator is already running");
|
295
|
+
if (o === s) {
|
296
|
+
if ("throw" === i) throw a;
|
297
|
+
return {
|
298
|
+
value: t,
|
299
|
+
done: !0
|
300
|
+
};
|
301
|
+
}
|
302
|
+
for (n.method = i, n.arg = a;;) {
|
303
|
+
var c = n.delegate;
|
304
|
+
if (c) {
|
305
|
+
var u = maybeInvokeDelegate(c, n);
|
306
|
+
if (u) {
|
307
|
+
if (u === y) continue;
|
308
|
+
return u;
|
309
|
+
}
|
310
|
+
}
|
311
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
312
|
+
if (o === h) throw o = s, n.arg;
|
313
|
+
n.dispatchException(n.arg);
|
314
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
315
|
+
o = f;
|
316
|
+
var p = tryCatch(e, r, n);
|
317
|
+
if ("normal" === p.type) {
|
318
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
319
|
+
return {
|
320
|
+
value: p.arg,
|
321
|
+
done: n.done
|
322
|
+
};
|
323
|
+
}
|
324
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
325
|
+
}
|
326
|
+
};
|
327
|
+
}
|
328
|
+
function maybeInvokeDelegate(e, r) {
|
329
|
+
var n = r.method,
|
330
|
+
o = e.iterator[n];
|
331
|
+
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
332
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
333
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
334
|
+
var a = i.arg;
|
335
|
+
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
336
|
+
}
|
337
|
+
function pushTryEntry(t) {
|
338
|
+
var e = {
|
339
|
+
tryLoc: t[0]
|
340
|
+
};
|
341
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
342
|
+
}
|
343
|
+
function resetTryEntry(t) {
|
344
|
+
var e = t.completion || {};
|
345
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
346
|
+
}
|
347
|
+
function Context(t) {
|
348
|
+
this.tryEntries = [{
|
349
|
+
tryLoc: "root"
|
350
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
351
|
+
}
|
352
|
+
function values(e) {
|
353
|
+
if (e || "" === e) {
|
354
|
+
var r = e[a];
|
355
|
+
if (r) return r.call(e);
|
356
|
+
if ("function" == typeof e.next) return e;
|
357
|
+
if (!isNaN(e.length)) {
|
358
|
+
var o = -1,
|
359
|
+
i = function next() {
|
360
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
361
|
+
return next.value = t, next.done = !0, next;
|
362
|
+
};
|
363
|
+
return i.next = i;
|
364
|
+
}
|
365
|
+
}
|
366
|
+
throw new TypeError(typeof e + " is not iterable");
|
367
|
+
}
|
368
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
369
|
+
value: GeneratorFunctionPrototype,
|
370
|
+
configurable: !0
|
371
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
372
|
+
value: GeneratorFunction,
|
373
|
+
configurable: !0
|
374
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
375
|
+
var e = "function" == typeof t && t.constructor;
|
376
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
377
|
+
}, e.mark = function (t) {
|
378
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
379
|
+
}, e.awrap = function (t) {
|
380
|
+
return {
|
381
|
+
__await: t
|
382
|
+
};
|
383
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
384
|
+
return this;
|
385
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
386
|
+
void 0 === i && (i = Promise);
|
387
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
388
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
389
|
+
return t.done ? t.value : a.next();
|
390
|
+
});
|
391
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
392
|
+
return this;
|
393
|
+
}), define(g, "toString", function () {
|
394
|
+
return "[object Generator]";
|
395
|
+
}), e.keys = function (t) {
|
396
|
+
var e = Object(t),
|
397
|
+
r = [];
|
398
|
+
for (var n in e) r.push(n);
|
399
|
+
return r.reverse(), function next() {
|
400
|
+
for (; r.length;) {
|
401
|
+
var t = r.pop();
|
402
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
403
|
+
}
|
404
|
+
return next.done = !0, next;
|
405
|
+
};
|
406
|
+
}, e.values = values, Context.prototype = {
|
407
|
+
constructor: Context,
|
408
|
+
reset: function (e) {
|
409
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
410
|
+
},
|
411
|
+
stop: function () {
|
412
|
+
this.done = !0;
|
413
|
+
var t = this.tryEntries[0].completion;
|
414
|
+
if ("throw" === t.type) throw t.arg;
|
415
|
+
return this.rval;
|
416
|
+
},
|
417
|
+
dispatchException: function (e) {
|
418
|
+
if (this.done) throw e;
|
419
|
+
var r = this;
|
420
|
+
function handle(n, o) {
|
421
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
422
|
+
}
|
423
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
424
|
+
var i = this.tryEntries[o],
|
425
|
+
a = i.completion;
|
426
|
+
if ("root" === i.tryLoc) return handle("end");
|
427
|
+
if (i.tryLoc <= this.prev) {
|
428
|
+
var c = n.call(i, "catchLoc"),
|
429
|
+
u = n.call(i, "finallyLoc");
|
430
|
+
if (c && u) {
|
431
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
432
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
433
|
+
} else if (c) {
|
434
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
435
|
+
} else {
|
436
|
+
if (!u) throw new Error("try statement without catch or finally");
|
437
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
438
|
+
}
|
439
|
+
}
|
440
|
+
}
|
441
|
+
},
|
442
|
+
abrupt: function (t, e) {
|
443
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
444
|
+
var o = this.tryEntries[r];
|
445
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
446
|
+
var i = o;
|
447
|
+
break;
|
448
|
+
}
|
449
|
+
}
|
450
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
451
|
+
var a = i ? i.completion : {};
|
452
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
453
|
+
},
|
454
|
+
complete: function (t, e) {
|
455
|
+
if ("throw" === t.type) throw t.arg;
|
456
|
+
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
457
|
+
},
|
458
|
+
finish: function (t) {
|
459
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
460
|
+
var r = this.tryEntries[e];
|
461
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
462
|
+
}
|
463
|
+
},
|
464
|
+
catch: function (t) {
|
465
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
466
|
+
var r = this.tryEntries[e];
|
467
|
+
if (r.tryLoc === t) {
|
468
|
+
var n = r.completion;
|
469
|
+
if ("throw" === n.type) {
|
470
|
+
var o = n.arg;
|
471
|
+
resetTryEntry(r);
|
472
|
+
}
|
473
|
+
return o;
|
474
|
+
}
|
475
|
+
}
|
476
|
+
throw new Error("illegal catch attempt");
|
477
|
+
},
|
478
|
+
delegateYield: function (e, r, n) {
|
479
|
+
return this.delegate = {
|
480
|
+
iterator: values(e),
|
481
|
+
resultName: r,
|
482
|
+
nextLoc: n
|
483
|
+
}, "next" === this.method && (this.arg = t), y;
|
484
|
+
}
|
485
|
+
}, e;
|
486
|
+
}
|
487
|
+
|
488
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
489
|
+
try {
|
490
|
+
var info = gen[key](arg);
|
491
|
+
var value = info.value;
|
492
|
+
} catch (error) {
|
493
|
+
reject(error);
|
494
|
+
return;
|
495
|
+
}
|
496
|
+
if (info.done) {
|
497
|
+
resolve(value);
|
498
|
+
} else {
|
499
|
+
Promise.resolve(value).then(_next, _throw);
|
500
|
+
}
|
501
|
+
}
|
502
|
+
function _asyncToGenerator(fn) {
|
503
|
+
return function () {
|
504
|
+
var self = this,
|
505
|
+
args = arguments;
|
506
|
+
return new Promise(function (resolve, reject) {
|
507
|
+
var gen = fn.apply(self, args);
|
508
|
+
function _next(value) {
|
509
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
510
|
+
}
|
511
|
+
function _throw(err) {
|
512
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
513
|
+
}
|
514
|
+
_next(undefined);
|
515
|
+
});
|
516
|
+
};
|
517
|
+
}
|
518
|
+
|
519
|
+
function handleError(error, msg) {
|
520
|
+
if (error instanceof Error) {
|
521
|
+
throw new Error("".concat(msg, ": ").concat(error.message));
|
522
|
+
}
|
523
|
+
throw new Error("".concat(msg, ": Unknown error type"));
|
524
|
+
}
|
525
|
+
|
526
|
+
/**
|
527
|
+
* TransactionClient allows you to view and monitor transactions on Story Protocol.
|
528
|
+
*/
|
529
|
+
var TransactionReadOnlyClient = /*#__PURE__*/function () {
|
530
|
+
function TransactionReadOnlyClient(httpClient, rpcClient) {
|
531
|
+
_classCallCheck(this, TransactionReadOnlyClient);
|
532
|
+
this.httpClient = httpClient;
|
533
|
+
this.rpcClient = rpcClient;
|
534
|
+
}
|
535
|
+
|
536
|
+
/**
|
537
|
+
* Get transaction data based on the specified transaction id.
|
538
|
+
*
|
539
|
+
* @param request - the request object for getting the transaction
|
540
|
+
* @returns the response object that contains the fetched transaction object
|
541
|
+
*/
|
542
|
+
_createClass(TransactionReadOnlyClient, [{
|
543
|
+
key: "get",
|
544
|
+
value: function () {
|
545
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
|
546
|
+
var response;
|
547
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
548
|
+
while (1) switch (_context.prev = _context.next) {
|
549
|
+
case 0:
|
550
|
+
_context.prev = 0;
|
551
|
+
_context.next = 3;
|
552
|
+
return this.httpClient.get("/protocol/transaction/".concat(request.transactionId));
|
553
|
+
case 3:
|
554
|
+
response = _context.sent;
|
555
|
+
return _context.abrupt("return", response.data);
|
556
|
+
case 7:
|
557
|
+
_context.prev = 7;
|
558
|
+
_context.t0 = _context["catch"](0);
|
559
|
+
handleError(_context.t0, "Failed to get transaction");
|
560
|
+
case 10:
|
561
|
+
case "end":
|
562
|
+
return _context.stop();
|
563
|
+
}
|
564
|
+
}, _callee, this, [[0, 7]]);
|
565
|
+
}));
|
566
|
+
function get(_x) {
|
567
|
+
return _get.apply(this, arguments);
|
568
|
+
}
|
569
|
+
return get;
|
570
|
+
}()
|
571
|
+
/**
|
572
|
+
* List Transactions.
|
573
|
+
*
|
574
|
+
* @returns the response object that contains a list of transactions
|
575
|
+
*/
|
576
|
+
}, {
|
577
|
+
key: "list",
|
578
|
+
value: function () {
|
579
|
+
var _list = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
|
580
|
+
var response;
|
581
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
582
|
+
while (1) switch (_context2.prev = _context2.next) {
|
583
|
+
case 0:
|
584
|
+
_context2.prev = 0;
|
585
|
+
_context2.next = 3;
|
586
|
+
return this.httpClient.post("/protocol/transaction", request || {});
|
587
|
+
case 3:
|
588
|
+
response = _context2.sent;
|
589
|
+
return _context2.abrupt("return", response.data);
|
590
|
+
case 7:
|
591
|
+
_context2.prev = 7;
|
592
|
+
_context2.t0 = _context2["catch"](0);
|
593
|
+
handleError(_context2.t0, "Failed to list transactions");
|
594
|
+
case 10:
|
595
|
+
case "end":
|
596
|
+
return _context2.stop();
|
597
|
+
}
|
598
|
+
}, _callee2, this, [[0, 7]]);
|
599
|
+
}));
|
600
|
+
function list(_x2) {
|
601
|
+
return _list.apply(this, arguments);
|
602
|
+
}
|
603
|
+
return list;
|
604
|
+
}()
|
605
|
+
}]);
|
606
|
+
return TransactionReadOnlyClient;
|
607
|
+
}();
|
608
|
+
|
609
|
+
/**
|
610
|
+
* TransactionClient allows you to view and monitor transactions on Story Protocol.
|
611
|
+
*/
|
612
|
+
var TransactionClient = /*#__PURE__*/function (_TransactionReadOnlyC) {
|
613
|
+
_inherits(TransactionClient, _TransactionReadOnlyC);
|
614
|
+
var _super = _createSuper(TransactionClient);
|
615
|
+
function TransactionClient(httpClient, rpcClient, wallet) {
|
616
|
+
var _this;
|
617
|
+
_classCallCheck(this, TransactionClient);
|
618
|
+
_this = _super.call(this, httpClient, rpcClient);
|
619
|
+
_this.wallet = wallet;
|
620
|
+
return _this;
|
621
|
+
}
|
622
|
+
return _createClass(TransactionClient);
|
623
|
+
}(TransactionReadOnlyClient);
|
624
|
+
|
625
|
+
/**
|
626
|
+
* Default timeout value for http clients.
|
627
|
+
*/
|
628
|
+
var HTTP_TIMEOUT = 5000;
|
629
|
+
|
630
|
+
var PlatformClient = /*#__PURE__*/function () {
|
631
|
+
function PlatformClient(httpClient) {
|
632
|
+
_classCallCheck(this, PlatformClient);
|
633
|
+
this.httpClient = httpClient;
|
634
|
+
}
|
635
|
+
|
636
|
+
/**
|
637
|
+
* Upload a file to Arweave.
|
638
|
+
*
|
639
|
+
* @param file - the file binary data to upload
|
640
|
+
* @param mimeType - the mime type of the file
|
641
|
+
* @returns the response object that contains the uri of the uploaded file
|
642
|
+
*/
|
643
|
+
_createClass(PlatformClient, [{
|
644
|
+
key: "uploadFile",
|
645
|
+
value: function () {
|
646
|
+
var _uploadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file, mimeType) {
|
647
|
+
var preSignUrlResp, data, uploadResp, confirmResp;
|
648
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
649
|
+
while (1) switch (_context.prev = _context.next) {
|
650
|
+
case 0:
|
651
|
+
_context.prev = 0;
|
652
|
+
_context.next = 3;
|
653
|
+
return this.httpClient.post("/platform/file-upload/request");
|
654
|
+
case 3:
|
655
|
+
preSignUrlResp = _context.sent;
|
656
|
+
data = preSignUrlResp.data; // upload the file to s3
|
657
|
+
_context.next = 7;
|
658
|
+
return this.httpClient.put(data.url, file, {
|
659
|
+
timeout: 0,
|
660
|
+
headers: {
|
661
|
+
"Content-Type": mimeType
|
662
|
+
}
|
663
|
+
});
|
664
|
+
case 7:
|
665
|
+
uploadResp = _context.sent;
|
666
|
+
if (!(uploadResp.status !== 200)) {
|
667
|
+
_context.next = 10;
|
668
|
+
break;
|
669
|
+
}
|
670
|
+
throw new Error("Failed to upload file to s3. Status: ".concat(uploadResp.status));
|
671
|
+
case 10:
|
672
|
+
_context.next = 12;
|
673
|
+
return this.httpClient.post("/platform/file-upload/confirm", {
|
674
|
+
key: data.key
|
675
|
+
});
|
676
|
+
case 12:
|
677
|
+
confirmResp = _context.sent;
|
678
|
+
return _context.abrupt("return", confirmResp.data);
|
679
|
+
case 16:
|
680
|
+
_context.prev = 16;
|
681
|
+
_context.t0 = _context["catch"](0);
|
682
|
+
return _context.abrupt("return", handleError(_context.t0, "Failed to upload file"));
|
683
|
+
case 19:
|
684
|
+
case "end":
|
685
|
+
return _context.stop();
|
686
|
+
}
|
687
|
+
}, _callee, this, [[0, 16]]);
|
688
|
+
}));
|
689
|
+
function uploadFile(_x, _x2) {
|
690
|
+
return _uploadFile.apply(this, arguments);
|
691
|
+
}
|
692
|
+
return uploadFile;
|
693
|
+
}()
|
694
|
+
}]);
|
695
|
+
return PlatformClient;
|
696
|
+
}();
|
697
|
+
|
698
|
+
/**
|
699
|
+
* ModuleReadOnlyClient allows you to view and search modules on Story Protocol.
|
700
|
+
*/
|
701
|
+
var ModuleReadOnlyClient = /*#__PURE__*/function () {
|
702
|
+
function ModuleReadOnlyClient(httpClient, rpcClient) {
|
703
|
+
_classCallCheck(this, ModuleReadOnlyClient);
|
704
|
+
this.httpClient = httpClient;
|
705
|
+
this.rpcClient = rpcClient;
|
706
|
+
}
|
707
|
+
|
708
|
+
/**
|
709
|
+
* Get an module based on the module name.
|
710
|
+
*
|
711
|
+
* @param request - the request object for getting a module.
|
712
|
+
* @returns the response object the contains the fetched module.
|
713
|
+
*/
|
714
|
+
_createClass(ModuleReadOnlyClient, [{
|
715
|
+
key: "get",
|
716
|
+
value: function () {
|
717
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
|
718
|
+
var response;
|
719
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
720
|
+
while (1) switch (_context.prev = _context.next) {
|
721
|
+
case 0:
|
722
|
+
_context.prev = 0;
|
723
|
+
_context.next = 3;
|
724
|
+
return this.httpClient.get("/modules/".concat(request.name));
|
725
|
+
case 3:
|
726
|
+
response = _context.sent;
|
727
|
+
return _context.abrupt("return", response.data);
|
728
|
+
case 7:
|
729
|
+
_context.prev = 7;
|
730
|
+
_context.t0 = _context["catch"](0);
|
731
|
+
handleError(_context.t0, "Failed to get module");
|
732
|
+
case 10:
|
733
|
+
case "end":
|
734
|
+
return _context.stop();
|
735
|
+
}
|
736
|
+
}, _callee, this, [[0, 7]]);
|
737
|
+
}));
|
738
|
+
function get(_x) {
|
739
|
+
return _get.apply(this, arguments);
|
740
|
+
}
|
741
|
+
return get;
|
742
|
+
}()
|
743
|
+
/**
|
744
|
+
* List modules.
|
745
|
+
*
|
746
|
+
* @returns the response object that contains results from listing query.
|
747
|
+
*/
|
748
|
+
}, {
|
749
|
+
key: "list",
|
750
|
+
value: function () {
|
751
|
+
var _list = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
|
752
|
+
var response;
|
753
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
754
|
+
while (1) switch (_context2.prev = _context2.next) {
|
755
|
+
case 0:
|
756
|
+
_context2.prev = 0;
|
757
|
+
_context2.next = 3;
|
758
|
+
return this.httpClient.post("/modules", request || {});
|
759
|
+
case 3:
|
760
|
+
response = _context2.sent;
|
761
|
+
return _context2.abrupt("return", response.data);
|
762
|
+
case 7:
|
763
|
+
_context2.prev = 7;
|
764
|
+
_context2.t0 = _context2["catch"](0);
|
765
|
+
handleError(_context2.t0, "Failed to list modules.");
|
766
|
+
case 10:
|
767
|
+
case "end":
|
768
|
+
return _context2.stop();
|
769
|
+
}
|
770
|
+
}, _callee2, this, [[0, 7]]);
|
771
|
+
}));
|
772
|
+
function list(_x2) {
|
773
|
+
return _list.apply(this, arguments);
|
774
|
+
}
|
775
|
+
return list;
|
776
|
+
}()
|
777
|
+
}]);
|
778
|
+
return ModuleReadOnlyClient;
|
779
|
+
}();
|
780
|
+
|
781
|
+
var TaggingModuleABI = [{
|
782
|
+
inputs: [{
|
783
|
+
internalType: "string",
|
784
|
+
name: "tag",
|
785
|
+
type: "string"
|
786
|
+
}, {
|
787
|
+
internalType: "address",
|
788
|
+
name: "ipId",
|
789
|
+
type: "address"
|
790
|
+
}],
|
791
|
+
name: "removeTag",
|
792
|
+
outputs: [{
|
793
|
+
internalType: "bool",
|
794
|
+
name: "removed",
|
795
|
+
type: "bool"
|
796
|
+
}],
|
797
|
+
stateMutability: "nonpayable",
|
798
|
+
type: "function"
|
799
|
+
}, {
|
800
|
+
inputs: [{
|
801
|
+
internalType: "string",
|
802
|
+
name: "tag",
|
803
|
+
type: "string"
|
804
|
+
}, {
|
805
|
+
internalType: "address",
|
806
|
+
name: "ipId",
|
807
|
+
type: "address"
|
808
|
+
}],
|
809
|
+
name: "setTag",
|
810
|
+
outputs: [{
|
811
|
+
internalType: "bool",
|
812
|
+
name: "added",
|
813
|
+
type: "bool"
|
814
|
+
}],
|
815
|
+
stateMutability: "nonpayable",
|
816
|
+
type: "function"
|
817
|
+
}];
|
818
|
+
|
819
|
+
var TaggingModuleRaw = TaggingModuleABI;
|
820
|
+
abitype.formatAbi(TaggingModuleRaw);
|
821
|
+
var TaggingModuleConfig = {
|
822
|
+
abi: TaggingModuleRaw,
|
823
|
+
address: viem.getAddress(process.env.TAGGING_MODULE || process.env.NEXT_PUBLIC_TAGGING_MODULE || "")
|
824
|
+
};
|
825
|
+
|
826
|
+
/**
|
827
|
+
* TaggingReadOnlyClient allows you to view and search IP Assets on Story Protocol.
|
828
|
+
*/
|
829
|
+
var TaggingReadOnlyClient = /*#__PURE__*/function () {
|
830
|
+
function TaggingReadOnlyClient(httpClient, rpcClient) {
|
831
|
+
_classCallCheck(this, TaggingReadOnlyClient);
|
832
|
+
this.httpClient = httpClient;
|
833
|
+
this.rpcClient = rpcClient;
|
834
|
+
}
|
835
|
+
|
836
|
+
/**
|
837
|
+
* Get tags.
|
838
|
+
*
|
839
|
+
* @returns the response object that contains results from get tag query.
|
840
|
+
*/
|
841
|
+
_createClass(TaggingReadOnlyClient, [{
|
842
|
+
key: "get",
|
843
|
+
value: function () {
|
844
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
|
845
|
+
var response;
|
846
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
847
|
+
while (1) switch (_context.prev = _context.next) {
|
848
|
+
case 0:
|
849
|
+
_context.prev = 0;
|
850
|
+
_context.next = 3;
|
851
|
+
return this.httpClient.get("/tags/".concat(request.id));
|
852
|
+
case 3:
|
853
|
+
response = _context.sent;
|
854
|
+
return _context.abrupt("return", response.data);
|
855
|
+
case 7:
|
856
|
+
_context.prev = 7;
|
857
|
+
_context.t0 = _context["catch"](0);
|
858
|
+
handleError(_context.t0, "Failed to get tags.");
|
859
|
+
case 10:
|
860
|
+
case "end":
|
861
|
+
return _context.stop();
|
862
|
+
}
|
863
|
+
}, _callee, this, [[0, 7]]);
|
864
|
+
}));
|
865
|
+
function get(_x) {
|
866
|
+
return _get.apply(this, arguments);
|
867
|
+
}
|
868
|
+
return get;
|
869
|
+
}()
|
870
|
+
/**
|
871
|
+
* List tags.
|
872
|
+
*
|
873
|
+
* @returns the response object that contains results from list tags query.
|
874
|
+
*/
|
875
|
+
}, {
|
876
|
+
key: "list",
|
877
|
+
value: function () {
|
878
|
+
var _list = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
|
879
|
+
var response;
|
880
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
881
|
+
while (1) switch (_context2.prev = _context2.next) {
|
882
|
+
case 0:
|
883
|
+
_context2.prev = 0;
|
884
|
+
_context2.next = 3;
|
885
|
+
return this.httpClient.post("/tags", request || {});
|
886
|
+
case 3:
|
887
|
+
response = _context2.sent;
|
888
|
+
return _context2.abrupt("return", response.data);
|
889
|
+
case 7:
|
890
|
+
_context2.prev = 7;
|
891
|
+
_context2.t0 = _context2["catch"](0);
|
892
|
+
handleError(_context2.t0, "Failed to list tags.");
|
893
|
+
case 10:
|
894
|
+
case "end":
|
895
|
+
return _context2.stop();
|
896
|
+
}
|
897
|
+
}, _callee2, this, [[0, 7]]);
|
898
|
+
}));
|
899
|
+
function list(_x2) {
|
900
|
+
return _list.apply(this, arguments);
|
901
|
+
}
|
902
|
+
return list;
|
903
|
+
}()
|
904
|
+
}]);
|
905
|
+
return TaggingReadOnlyClient;
|
906
|
+
}();
|
907
|
+
|
908
|
+
var TaggingClient = /*#__PURE__*/function (_TaggingReadOnlyClien) {
|
909
|
+
_inherits(TaggingClient, _TaggingReadOnlyClien);
|
910
|
+
var _super = _createSuper(TaggingClient);
|
911
|
+
function TaggingClient(httpClient, rpcClient, wallet) {
|
912
|
+
var _this;
|
913
|
+
_classCallCheck(this, TaggingClient);
|
914
|
+
_this = _super.call(this, httpClient, rpcClient);
|
915
|
+
_this.wallet = wallet;
|
916
|
+
return _this;
|
917
|
+
}
|
918
|
+
_createClass(TaggingClient, [{
|
919
|
+
key: "setTag",
|
920
|
+
value: function () {
|
921
|
+
var _setTag = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
|
922
|
+
var _yield$this$rpcClient, call, txHash;
|
923
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
924
|
+
while (1) switch (_context.prev = _context.next) {
|
925
|
+
case 0:
|
926
|
+
_context.prev = 0;
|
927
|
+
_context.next = 3;
|
928
|
+
return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, TaggingModuleConfig), {}, {
|
929
|
+
functionName: "setTag",
|
930
|
+
args: [request.tag, request.ipId]
|
931
|
+
}));
|
932
|
+
case 3:
|
933
|
+
_yield$this$rpcClient = _context.sent;
|
934
|
+
call = _yield$this$rpcClient.request;
|
935
|
+
_context.next = 7;
|
936
|
+
return this.wallet.writeContract(call);
|
937
|
+
case 7:
|
938
|
+
txHash = _context.sent;
|
939
|
+
return _context.abrupt("return", {
|
940
|
+
txHash: txHash
|
941
|
+
});
|
942
|
+
case 11:
|
943
|
+
_context.prev = 11;
|
944
|
+
_context.t0 = _context["catch"](0);
|
945
|
+
handleError(_context.t0, "Failed to set tag");
|
946
|
+
case 14:
|
947
|
+
case "end":
|
948
|
+
return _context.stop();
|
949
|
+
}
|
950
|
+
}, _callee, this, [[0, 11]]);
|
951
|
+
}));
|
952
|
+
function setTag(_x) {
|
953
|
+
return _setTag.apply(this, arguments);
|
954
|
+
}
|
955
|
+
return setTag;
|
956
|
+
}()
|
957
|
+
}, {
|
958
|
+
key: "removeTag",
|
959
|
+
value: function () {
|
960
|
+
var _removeTag = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
|
961
|
+
var _yield$this$rpcClient2, call, txHash;
|
962
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
963
|
+
while (1) switch (_context2.prev = _context2.next) {
|
964
|
+
case 0:
|
965
|
+
_context2.prev = 0;
|
966
|
+
_context2.next = 3;
|
967
|
+
return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, TaggingModuleConfig), {}, {
|
968
|
+
functionName: "removeTag",
|
969
|
+
args: [request.tag, request.ipId]
|
970
|
+
}));
|
971
|
+
case 3:
|
972
|
+
_yield$this$rpcClient2 = _context2.sent;
|
973
|
+
call = _yield$this$rpcClient2.request;
|
974
|
+
_context2.next = 7;
|
975
|
+
return this.wallet.writeContract(call);
|
976
|
+
case 7:
|
977
|
+
txHash = _context2.sent;
|
978
|
+
return _context2.abrupt("return", {
|
979
|
+
txHash: txHash
|
980
|
+
});
|
981
|
+
case 11:
|
982
|
+
_context2.prev = 11;
|
983
|
+
_context2.t0 = _context2["catch"](0);
|
984
|
+
handleError(_context2.t0, "Failed to remove tag");
|
985
|
+
case 14:
|
986
|
+
case "end":
|
987
|
+
return _context2.stop();
|
988
|
+
}
|
989
|
+
}, _callee2, this, [[0, 11]]);
|
990
|
+
}));
|
991
|
+
function removeTag(_x2) {
|
992
|
+
return _removeTag.apply(this, arguments);
|
993
|
+
}
|
994
|
+
return removeTag;
|
995
|
+
}()
|
996
|
+
}]);
|
997
|
+
return TaggingClient;
|
998
|
+
}(TaggingReadOnlyClient);
|
999
|
+
|
1000
|
+
/**
|
1001
|
+
* IPAssetReadOnlyClient allows you to view and search IP Assets on Story Protocol.
|
1002
|
+
*/
|
1003
|
+
var IPAssetReadOnlyClient = /*#__PURE__*/function () {
|
1004
|
+
function IPAssetReadOnlyClient(httpClient, rpcClient) {
|
1005
|
+
_classCallCheck(this, IPAssetReadOnlyClient);
|
1006
|
+
this.httpClient = httpClient;
|
1007
|
+
this.rpcClient = rpcClient;
|
1008
|
+
}
|
1009
|
+
|
1010
|
+
/**
|
1011
|
+
* Get an IP Asset based on the specified IP asset ID.
|
1012
|
+
*
|
1013
|
+
* @param request - the request object for getting an IP Asset.
|
1014
|
+
* @returns the response object the contains the fetched IP Asset.
|
1015
|
+
*/
|
1016
|
+
_createClass(IPAssetReadOnlyClient, [{
|
1017
|
+
key: "get",
|
1018
|
+
value: function () {
|
1019
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
|
1020
|
+
var response;
|
1021
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
1022
|
+
while (1) switch (_context.prev = _context.next) {
|
1023
|
+
case 0:
|
1024
|
+
_context.prev = 0;
|
1025
|
+
if (viem.isAddress(request.ipId)) {
|
1026
|
+
_context.next = 3;
|
1027
|
+
break;
|
1028
|
+
}
|
1029
|
+
throw new Error("Invalid ip id. Must be an address. But get: ".concat(request.ipId));
|
1030
|
+
case 3:
|
1031
|
+
_context.next = 5;
|
1032
|
+
return this.httpClient.get("/accounts/".concat(request.ipId));
|
1033
|
+
case 5:
|
1034
|
+
response = _context.sent;
|
1035
|
+
return _context.abrupt("return", response.data);
|
1036
|
+
case 9:
|
1037
|
+
_context.prev = 9;
|
1038
|
+
_context.t0 = _context["catch"](0);
|
1039
|
+
handleError(_context.t0, "Failed to get IP account");
|
1040
|
+
case 12:
|
1041
|
+
case "end":
|
1042
|
+
return _context.stop();
|
1043
|
+
}
|
1044
|
+
}, _callee, this, [[0, 9]]);
|
1045
|
+
}));
|
1046
|
+
function get(_x) {
|
1047
|
+
return _get.apply(this, arguments);
|
1048
|
+
}
|
1049
|
+
return get;
|
1050
|
+
}()
|
1051
|
+
/**
|
1052
|
+
* List IP accounts.
|
1053
|
+
*
|
1054
|
+
* @returns the response object that contains results from listing query.
|
1055
|
+
*/
|
1056
|
+
}, {
|
1057
|
+
key: "list",
|
1058
|
+
value: function () {
|
1059
|
+
var _list = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
|
1060
|
+
var response;
|
1061
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
1062
|
+
while (1) switch (_context2.prev = _context2.next) {
|
1063
|
+
case 0:
|
1064
|
+
_context2.prev = 0;
|
1065
|
+
_context2.next = 3;
|
1066
|
+
return this.httpClient.post("/accounts", request || {});
|
1067
|
+
case 3:
|
1068
|
+
response = _context2.sent;
|
1069
|
+
return _context2.abrupt("return", response.data);
|
1070
|
+
case 7:
|
1071
|
+
_context2.prev = 7;
|
1072
|
+
_context2.t0 = _context2["catch"](0);
|
1073
|
+
handleError(_context2.t0, "Failed to list IP Asset.");
|
1074
|
+
case 10:
|
1075
|
+
case "end":
|
1076
|
+
return _context2.stop();
|
1077
|
+
}
|
1078
|
+
}, _callee2, this, [[0, 7]]);
|
1079
|
+
}));
|
1080
|
+
function list(_x2) {
|
1081
|
+
return _list.apply(this, arguments);
|
1082
|
+
}
|
1083
|
+
return list;
|
1084
|
+
}()
|
1085
|
+
}, {
|
1086
|
+
key: "getIpId",
|
1087
|
+
value: function () {
|
1088
|
+
var _getIpId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
1089
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
1090
|
+
while (1) switch (_context3.prev = _context3.next) {
|
1091
|
+
case 0:
|
1092
|
+
case "end":
|
1093
|
+
return _context3.stop();
|
1094
|
+
}
|
1095
|
+
}, _callee3);
|
1096
|
+
}));
|
1097
|
+
function getIpId() {
|
1098
|
+
return _getIpId.apply(this, arguments);
|
1099
|
+
}
|
1100
|
+
return getIpId;
|
1101
|
+
}()
|
1102
|
+
}]);
|
1103
|
+
return IPAssetReadOnlyClient;
|
1104
|
+
}();
|
1105
|
+
|
1106
|
+
var IPAccountRegistryABI = [{
|
1107
|
+
inputs: [{
|
1108
|
+
internalType: "uint256",
|
1109
|
+
name: "chainId_",
|
1110
|
+
type: "uint256"
|
1111
|
+
}, {
|
1112
|
+
internalType: "address",
|
1113
|
+
name: "tokenContract_",
|
1114
|
+
type: "address"
|
1115
|
+
}, {
|
1116
|
+
internalType: "uint256",
|
1117
|
+
name: "tokenId_",
|
1118
|
+
type: "uint256"
|
1119
|
+
}],
|
1120
|
+
name: "ipAsset",
|
1121
|
+
outputs: [{
|
1122
|
+
internalType: "address",
|
1123
|
+
name: "",
|
1124
|
+
type: "address"
|
1125
|
+
}],
|
1126
|
+
stateMutability: "view",
|
1127
|
+
type: "function"
|
1128
|
+
}, {
|
1129
|
+
anonymous: false,
|
1130
|
+
inputs: [{
|
1131
|
+
indexed: true,
|
1132
|
+
internalType: "address",
|
1133
|
+
name: "account",
|
1134
|
+
type: "address"
|
1135
|
+
}, {
|
1136
|
+
indexed: true,
|
1137
|
+
internalType: "address",
|
1138
|
+
name: "implementation",
|
1139
|
+
type: "address"
|
1140
|
+
}, {
|
1141
|
+
indexed: true,
|
1142
|
+
internalType: "uint256",
|
1143
|
+
name: "chainId",
|
1144
|
+
type: "uint256"
|
1145
|
+
}, {
|
1146
|
+
indexed: false,
|
1147
|
+
internalType: "address",
|
1148
|
+
name: "tokenContract",
|
1149
|
+
type: "address"
|
1150
|
+
}, {
|
1151
|
+
indexed: false,
|
1152
|
+
internalType: "uint256",
|
1153
|
+
name: "tokenId",
|
1154
|
+
type: "uint256"
|
1155
|
+
}],
|
1156
|
+
name: "IPAccountRegistered",
|
1157
|
+
type: "event"
|
1158
|
+
}];
|
1159
|
+
|
1160
|
+
if (typeof process !== "undefined") {
|
1161
|
+
dotenv__namespace.config();
|
1162
|
+
}
|
1163
|
+
var IPAccountRegistryRaw = IPAccountRegistryABI;
|
1164
|
+
abitype.formatAbi(IPAccountRegistryRaw);
|
1165
|
+
var IPAccountRegistryConfig = {
|
1166
|
+
abi: IPAccountRegistryRaw,
|
1167
|
+
address: viem.getAddress(process.env.IP_ACCOUNT_REGISTRY || process.env.NEXT_PUBLIC_IP_ACCOUNT_REGISTRY || "")
|
1168
|
+
};
|
1169
|
+
|
1170
|
+
function _arrayLikeToArray(arr, len) {
|
1171
|
+
if (len == null || len > arr.length) len = arr.length;
|
1172
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
1173
|
+
return arr2;
|
1174
|
+
}
|
1175
|
+
|
1176
|
+
function _unsupportedIterableToArray(o, minLen) {
|
1177
|
+
if (!o) return;
|
1178
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
1179
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
1180
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
1181
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
1182
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
1183
|
+
}
|
1184
|
+
|
1185
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
1186
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
1187
|
+
if (!it) {
|
1188
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
1189
|
+
if (it) o = it;
|
1190
|
+
var i = 0;
|
1191
|
+
var F = function () {};
|
1192
|
+
return {
|
1193
|
+
s: F,
|
1194
|
+
n: function () {
|
1195
|
+
if (i >= o.length) return {
|
1196
|
+
done: true
|
1197
|
+
};
|
1198
|
+
return {
|
1199
|
+
done: false,
|
1200
|
+
value: o[i++]
|
1201
|
+
};
|
1202
|
+
},
|
1203
|
+
e: function (e) {
|
1204
|
+
throw e;
|
1205
|
+
},
|
1206
|
+
f: F
|
1207
|
+
};
|
1208
|
+
}
|
1209
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
1210
|
+
}
|
1211
|
+
var normalCompletion = true,
|
1212
|
+
didErr = false,
|
1213
|
+
err;
|
1214
|
+
return {
|
1215
|
+
s: function () {
|
1216
|
+
it = it.call(o);
|
1217
|
+
},
|
1218
|
+
n: function () {
|
1219
|
+
var step = it.next();
|
1220
|
+
normalCompletion = step.done;
|
1221
|
+
return step;
|
1222
|
+
},
|
1223
|
+
e: function (e) {
|
1224
|
+
didErr = true;
|
1225
|
+
err = e;
|
1226
|
+
},
|
1227
|
+
f: function () {
|
1228
|
+
try {
|
1229
|
+
if (!normalCompletion && it.return != null) it.return();
|
1230
|
+
} finally {
|
1231
|
+
if (didErr) throw err;
|
1232
|
+
}
|
1233
|
+
}
|
1234
|
+
};
|
1235
|
+
}
|
1236
|
+
|
1237
|
+
function parseToBigInt(num) {
|
1238
|
+
return BigInt(num);
|
1239
|
+
}
|
1240
|
+
function waitTxAndFilterLog(_x, _x2, _x3) {
|
1241
|
+
return _waitTxAndFilterLog.apply(this, arguments);
|
1242
|
+
}
|
1243
|
+
function _waitTxAndFilterLog() {
|
1244
|
+
_waitTxAndFilterLog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(client, txHash, params) {
|
1245
|
+
var txReceipt, _iterator, _step, log;
|
1246
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
1247
|
+
while (1) switch (_context.prev = _context.next) {
|
1248
|
+
case 0:
|
1249
|
+
_context.next = 2;
|
1250
|
+
return client.waitForTransactionReceipt({
|
1251
|
+
hash: txHash,
|
1252
|
+
confirmations: params.confirmations,
|
1253
|
+
pollingInterval: params.pollingInterval,
|
1254
|
+
timeout: params.timeout
|
1255
|
+
});
|
1256
|
+
case 2:
|
1257
|
+
txReceipt = _context.sent;
|
1258
|
+
_iterator = _createForOfIteratorHelper(txReceipt.logs);
|
1259
|
+
_context.prev = 4;
|
1260
|
+
_iterator.s();
|
1261
|
+
case 6:
|
1262
|
+
if ((_step = _iterator.n()).done) {
|
1263
|
+
_context.next = 17;
|
1264
|
+
break;
|
1265
|
+
}
|
1266
|
+
log = _step.value;
|
1267
|
+
_context.prev = 8;
|
1268
|
+
return _context.abrupt("return", viem.decodeEventLog({
|
1269
|
+
abi: params.abi,
|
1270
|
+
eventName: params.eventName,
|
1271
|
+
data: log.data,
|
1272
|
+
topics: log.topics
|
1273
|
+
}));
|
1274
|
+
case 12:
|
1275
|
+
_context.prev = 12;
|
1276
|
+
_context.t0 = _context["catch"](8);
|
1277
|
+
return _context.abrupt("continue", 15);
|
1278
|
+
case 15:
|
1279
|
+
_context.next = 6;
|
1280
|
+
break;
|
1281
|
+
case 17:
|
1282
|
+
_context.next = 22;
|
1283
|
+
break;
|
1284
|
+
case 19:
|
1285
|
+
_context.prev = 19;
|
1286
|
+
_context.t1 = _context["catch"](4);
|
1287
|
+
_iterator.e(_context.t1);
|
1288
|
+
case 22:
|
1289
|
+
_context.prev = 22;
|
1290
|
+
_iterator.f();
|
1291
|
+
return _context.finish(22);
|
1292
|
+
case 25:
|
1293
|
+
throw new Error("not found event ".concat(params.eventName, " in target transaction"));
|
1294
|
+
case 26:
|
1295
|
+
case "end":
|
1296
|
+
return _context.stop();
|
1297
|
+
}
|
1298
|
+
}, _callee, null, [[4, 19, 22, 25], [8, 12]]);
|
1299
|
+
}));
|
1300
|
+
return _waitTxAndFilterLog.apply(this, arguments);
|
1301
|
+
}
|
1302
|
+
|
1303
|
+
function _arrayWithoutHoles(arr) {
|
1304
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
1305
|
+
}
|
1306
|
+
|
1307
|
+
function _iterableToArray(iter) {
|
1308
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
1309
|
+
}
|
1310
|
+
|
1311
|
+
function _nonIterableSpread() {
|
1312
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
1313
|
+
}
|
1314
|
+
|
1315
|
+
function _toConsumableArray(arr) {
|
1316
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
1317
|
+
}
|
1318
|
+
|
1319
|
+
var RegistrationModuleABI = [{
|
1320
|
+
inputs: [{
|
1321
|
+
internalType: "uint256",
|
1322
|
+
name: "licenseId",
|
1323
|
+
type: "uint256"
|
1324
|
+
}, {
|
1325
|
+
internalType: "address",
|
1326
|
+
name: "tokenContract",
|
1327
|
+
type: "address"
|
1328
|
+
}, {
|
1329
|
+
internalType: "uint256",
|
1330
|
+
name: "tokenId",
|
1331
|
+
type: "uint256"
|
1332
|
+
}, {
|
1333
|
+
internalType: "string",
|
1334
|
+
name: "ipName",
|
1335
|
+
type: "string"
|
1336
|
+
}, {
|
1337
|
+
internalType: "string",
|
1338
|
+
name: "ipDescription",
|
1339
|
+
type: "string"
|
1340
|
+
}, {
|
1341
|
+
internalType: "bytes32",
|
1342
|
+
name: "contentHash",
|
1343
|
+
type: "bytes32"
|
1344
|
+
}],
|
1345
|
+
name: "registerDerivativeIp",
|
1346
|
+
outputs: [],
|
1347
|
+
stateMutability: "nonpayable",
|
1348
|
+
type: "function"
|
1349
|
+
}, {
|
1350
|
+
inputs: [{
|
1351
|
+
internalType: "uint256",
|
1352
|
+
name: "policyId",
|
1353
|
+
type: "uint256"
|
1354
|
+
}, {
|
1355
|
+
internalType: "address",
|
1356
|
+
name: "tokenContract",
|
1357
|
+
type: "address"
|
1358
|
+
}, {
|
1359
|
+
internalType: "uint256",
|
1360
|
+
name: "tokenId",
|
1361
|
+
type: "uint256"
|
1362
|
+
}],
|
1363
|
+
name: "registerRootIp",
|
1364
|
+
outputs: [{
|
1365
|
+
internalType: "address",
|
1366
|
+
name: "",
|
1367
|
+
type: "address"
|
1368
|
+
}],
|
1369
|
+
stateMutability: "nonpayable",
|
1370
|
+
type: "function"
|
1371
|
+
}];
|
1372
|
+
|
1373
|
+
var errorsJson = [
|
1374
|
+
{
|
1375
|
+
inputs: [
|
1376
|
+
],
|
1377
|
+
name: "AccessController__CallerIsNotIPAccount",
|
1378
|
+
type: "error"
|
1379
|
+
},
|
1380
|
+
{
|
1381
|
+
inputs: [
|
1382
|
+
],
|
1383
|
+
name: "AccessController__IPAccountIsNotValid",
|
1384
|
+
type: "error"
|
1385
|
+
},
|
1386
|
+
{
|
1387
|
+
inputs: [
|
1388
|
+
],
|
1389
|
+
name: "AccessController__IPAccountIsZeroAddress",
|
1390
|
+
type: "error"
|
1391
|
+
},
|
1392
|
+
{
|
1393
|
+
inputs: [
|
1394
|
+
],
|
1395
|
+
name: "AccessController__PermissionIsNotValid",
|
1396
|
+
type: "error"
|
1397
|
+
},
|
1398
|
+
{
|
1399
|
+
inputs: [
|
1400
|
+
],
|
1401
|
+
name: "AccessController__SignerIsZeroAddress",
|
1402
|
+
type: "error"
|
1403
|
+
},
|
1404
|
+
{
|
1405
|
+
inputs: [
|
1406
|
+
],
|
1407
|
+
name: "ArbitrationPolicySP__NotDisputeModule",
|
1408
|
+
type: "error"
|
1409
|
+
},
|
1410
|
+
{
|
1411
|
+
inputs: [
|
1412
|
+
],
|
1413
|
+
name: "ArbitrationPolicySP__ZeroDisputeModule",
|
1414
|
+
type: "error"
|
1415
|
+
},
|
1416
|
+
{
|
1417
|
+
inputs: [
|
1418
|
+
],
|
1419
|
+
name: "ArbitrationPolicySP__ZeroPaymentToken",
|
1420
|
+
type: "error"
|
1421
|
+
},
|
1422
|
+
{
|
1423
|
+
inputs: [
|
1424
|
+
],
|
1425
|
+
name: "DisputeModule__NotDisputeInitiator",
|
1426
|
+
type: "error"
|
1427
|
+
},
|
1428
|
+
{
|
1429
|
+
inputs: [
|
1430
|
+
],
|
1431
|
+
name: "DisputeModule__NotWhitelistedArbitrationPolicy",
|
1432
|
+
type: "error"
|
1433
|
+
},
|
1434
|
+
{
|
1435
|
+
inputs: [
|
1436
|
+
],
|
1437
|
+
name: "DisputeModule__NotWhitelistedArbitrationRelayer",
|
1438
|
+
type: "error"
|
1439
|
+
},
|
1440
|
+
{
|
1441
|
+
inputs: [
|
1442
|
+
],
|
1443
|
+
name: "DisputeModule__NotWhitelistedDisputeTag",
|
1444
|
+
type: "error"
|
1445
|
+
},
|
1446
|
+
{
|
1447
|
+
inputs: [
|
1448
|
+
],
|
1449
|
+
name: "DisputeModule__ZeroArbitrationPolicy",
|
1450
|
+
type: "error"
|
1451
|
+
},
|
1452
|
+
{
|
1453
|
+
inputs: [
|
1454
|
+
],
|
1455
|
+
name: "DisputeModule__ZeroArbitrationRelayer",
|
1456
|
+
type: "error"
|
1457
|
+
},
|
1458
|
+
{
|
1459
|
+
inputs: [
|
1460
|
+
],
|
1461
|
+
name: "DisputeModule__ZeroDisputeTag",
|
1462
|
+
type: "error"
|
1463
|
+
},
|
1464
|
+
{
|
1465
|
+
inputs: [
|
1466
|
+
],
|
1467
|
+
name: "DisputeModule__ZeroLinkToDisputeSummary",
|
1468
|
+
type: "error"
|
1469
|
+
},
|
1470
|
+
{
|
1471
|
+
inputs: [
|
1472
|
+
],
|
1473
|
+
name: "IPRecordRegistry_AlreadyRegistered",
|
1474
|
+
type: "error"
|
1475
|
+
},
|
1476
|
+
{
|
1477
|
+
inputs: [
|
1478
|
+
],
|
1479
|
+
name: "IPRecordRegistry_IPAccountAlreadyCreated",
|
1480
|
+
type: "error"
|
1481
|
+
},
|
1482
|
+
{
|
1483
|
+
inputs: [
|
1484
|
+
],
|
1485
|
+
name: "IPRecordRegistry_NotYetRegistered",
|
1486
|
+
type: "error"
|
1487
|
+
},
|
1488
|
+
{
|
1489
|
+
inputs: [
|
1490
|
+
],
|
1491
|
+
name: "IPRecordRegistry_ResolverInvalid",
|
1492
|
+
type: "error"
|
1493
|
+
},
|
1494
|
+
{
|
1495
|
+
inputs: [
|
1496
|
+
],
|
1497
|
+
name: "IPRecordRegistry_Unauthorized",
|
1498
|
+
type: "error"
|
1499
|
+
},
|
1500
|
+
{
|
1501
|
+
inputs: [
|
1502
|
+
],
|
1503
|
+
name: "IPResolver_InvalidIP",
|
1504
|
+
type: "error"
|
1505
|
+
},
|
1506
|
+
{
|
1507
|
+
inputs: [
|
1508
|
+
],
|
1509
|
+
name: "IPResolver_Unauthorized",
|
1510
|
+
type: "error"
|
1511
|
+
},
|
1512
|
+
{
|
1513
|
+
inputs: [
|
1514
|
+
],
|
1515
|
+
name: "LicenseRegistry__EmptyLicenseUrl",
|
1516
|
+
type: "error"
|
1517
|
+
},
|
1518
|
+
{
|
1519
|
+
inputs: [
|
1520
|
+
],
|
1521
|
+
name: "LicenseRegistry__FrameworkNotFound",
|
1522
|
+
type: "error"
|
1523
|
+
},
|
1524
|
+
{
|
1525
|
+
inputs: [
|
1526
|
+
],
|
1527
|
+
name: "LicenseRegistry__InvalidParamVerifierType",
|
1528
|
+
type: "error"
|
1529
|
+
},
|
1530
|
+
{
|
1531
|
+
inputs: [
|
1532
|
+
],
|
1533
|
+
name: "LicenseRegistry__LicensorDoesntHaveThisPolicy",
|
1534
|
+
type: "error"
|
1535
|
+
},
|
1536
|
+
{
|
1537
|
+
inputs: [
|
1538
|
+
],
|
1539
|
+
name: "LicenseRegistry__LinkParentParamFailed",
|
1540
|
+
type: "error"
|
1541
|
+
},
|
1542
|
+
{
|
1543
|
+
inputs: [
|
1544
|
+
],
|
1545
|
+
name: "LicenseRegistry__MintParamFailed",
|
1546
|
+
type: "error"
|
1547
|
+
},
|
1548
|
+
{
|
1549
|
+
inputs: [
|
1550
|
+
],
|
1551
|
+
name: "LicenseRegistry__NotLicensee",
|
1552
|
+
type: "error"
|
1553
|
+
},
|
1554
|
+
{
|
1555
|
+
inputs: [
|
1556
|
+
],
|
1557
|
+
name: "LicenseRegistry__ParamVerifierLengthMismatch",
|
1558
|
+
type: "error"
|
1559
|
+
},
|
1560
|
+
{
|
1561
|
+
inputs: [
|
1562
|
+
],
|
1563
|
+
name: "LicenseRegistry__ParentIdEqualThanChild",
|
1564
|
+
type: "error"
|
1565
|
+
},
|
1566
|
+
{
|
1567
|
+
inputs: [
|
1568
|
+
],
|
1569
|
+
name: "LicenseRegistry__PolicyAlreadySetForIpId",
|
1570
|
+
type: "error"
|
1571
|
+
},
|
1572
|
+
{
|
1573
|
+
inputs: [
|
1574
|
+
],
|
1575
|
+
name: "LicenseRegistry__PolicyNotFound",
|
1576
|
+
type: "error"
|
1577
|
+
},
|
1578
|
+
{
|
1579
|
+
inputs: [
|
1580
|
+
],
|
1581
|
+
name: "ModuleRegistry__ModuleAddressNotContract",
|
1582
|
+
type: "error"
|
1583
|
+
},
|
1584
|
+
{
|
1585
|
+
inputs: [
|
1586
|
+
],
|
1587
|
+
name: "ModuleRegistry__ModuleAddressZeroAddress",
|
1588
|
+
type: "error"
|
1589
|
+
},
|
1590
|
+
{
|
1591
|
+
inputs: [
|
1592
|
+
],
|
1593
|
+
name: "ModuleRegistry__ModuleAlreadyRegistered",
|
1594
|
+
type: "error"
|
1595
|
+
},
|
1596
|
+
{
|
1597
|
+
inputs: [
|
1598
|
+
],
|
1599
|
+
name: "ModuleRegistry__ModuleNotRegistered",
|
1600
|
+
type: "error"
|
1601
|
+
},
|
1602
|
+
{
|
1603
|
+
inputs: [
|
1604
|
+
],
|
1605
|
+
name: "ModuleRegistry__NameAlreadyRegistered",
|
1606
|
+
type: "error"
|
1607
|
+
},
|
1608
|
+
{
|
1609
|
+
inputs: [
|
1610
|
+
],
|
1611
|
+
name: "ModuleRegistry__NameDoesNotMatch",
|
1612
|
+
type: "error"
|
1613
|
+
},
|
1614
|
+
{
|
1615
|
+
inputs: [
|
1616
|
+
],
|
1617
|
+
name: "ModuleRegistry__NameEmptyString",
|
1618
|
+
type: "error"
|
1619
|
+
},
|
1620
|
+
{
|
1621
|
+
inputs: [
|
1622
|
+
],
|
1623
|
+
name: "Module_Unauthorized",
|
1624
|
+
type: "error"
|
1625
|
+
},
|
1626
|
+
{
|
1627
|
+
inputs: [
|
1628
|
+
],
|
1629
|
+
name: "RegistrationModule__InvalidOwner",
|
1630
|
+
type: "error"
|
1631
|
+
},
|
1632
|
+
{
|
1633
|
+
inputs: [
|
1634
|
+
],
|
1635
|
+
name: "RoyaltyModule__AlreadySetRoyaltyPolicy",
|
1636
|
+
type: "error"
|
1637
|
+
},
|
1638
|
+
{
|
1639
|
+
inputs: [
|
1640
|
+
],
|
1641
|
+
name: "RoyaltyModule__NotWhitelistedRoyaltyPolicy",
|
1642
|
+
type: "error"
|
1643
|
+
},
|
1644
|
+
{
|
1645
|
+
inputs: [
|
1646
|
+
],
|
1647
|
+
name: "RoyaltyModule__ZeroRoyaltyPolicy",
|
1648
|
+
type: "error"
|
1649
|
+
},
|
1650
|
+
{
|
1651
|
+
inputs: [
|
1652
|
+
],
|
1653
|
+
name: "RoyaltyPolicyLS__NotRoyaltyModule",
|
1654
|
+
type: "error"
|
1655
|
+
},
|
1656
|
+
{
|
1657
|
+
inputs: [
|
1658
|
+
],
|
1659
|
+
name: "RoyaltyPolicyLS__TransferFailed",
|
1660
|
+
type: "error"
|
1661
|
+
},
|
1662
|
+
{
|
1663
|
+
inputs: [
|
1664
|
+
],
|
1665
|
+
name: "RoyaltyPolicyLS__ZeroLiquidSplitFactory",
|
1666
|
+
type: "error"
|
1667
|
+
},
|
1668
|
+
{
|
1669
|
+
inputs: [
|
1670
|
+
],
|
1671
|
+
name: "RoyaltyPolicyLS__ZeroLiquidSplitMain",
|
1672
|
+
type: "error"
|
1673
|
+
},
|
1674
|
+
{
|
1675
|
+
inputs: [
|
1676
|
+
],
|
1677
|
+
name: "RoyaltyPolicyLS__ZeroRoyaltyModule",
|
1678
|
+
type: "error"
|
1679
|
+
},
|
1680
|
+
{
|
1681
|
+
inputs: [
|
1682
|
+
],
|
1683
|
+
name: "TaggingModule__DstIpIdDoesNotHaveDstTag",
|
1684
|
+
type: "error"
|
1685
|
+
},
|
1686
|
+
{
|
1687
|
+
inputs: [
|
1688
|
+
],
|
1689
|
+
name: "TaggingModule__InvalidRelationTypeName",
|
1690
|
+
type: "error"
|
1691
|
+
},
|
1692
|
+
{
|
1693
|
+
inputs: [
|
1694
|
+
],
|
1695
|
+
name: "TaggingModule__RelationTypeAlreadyExists",
|
1696
|
+
type: "error"
|
1697
|
+
},
|
1698
|
+
{
|
1699
|
+
inputs: [
|
1700
|
+
],
|
1701
|
+
name: "TaggingModule__RelationTypeDoesNotExist",
|
1702
|
+
type: "error"
|
1703
|
+
},
|
1704
|
+
{
|
1705
|
+
inputs: [
|
1706
|
+
],
|
1707
|
+
name: "TaggingModule__SrcIpIdDoesNotHaveSrcTag",
|
1708
|
+
type: "error"
|
1709
|
+
}
|
1710
|
+
];
|
1711
|
+
|
1712
|
+
var ErrorsAbi$2 = errorsJson;
|
1713
|
+
var storyProtocolMerged = [].concat(_toConsumableArray(RegistrationModuleABI), _toConsumableArray(ErrorsAbi$2));
|
1714
|
+
var RegistrationModuleConfig = {
|
1715
|
+
abi: storyProtocolMerged,
|
1716
|
+
address: viem.getAddress(process.env.REGISTRATION_MODULE || process.env.NEXT_PUBLIC_REGISTRATION_MODULE || "")
|
1717
|
+
};
|
1718
|
+
|
1719
|
+
var IPAssetClient = /*#__PURE__*/function (_IPAssetReadOnlyClien) {
|
1720
|
+
_inherits(IPAssetClient, _IPAssetReadOnlyClien);
|
1721
|
+
var _super = _createSuper(IPAssetClient);
|
1722
|
+
function IPAssetClient(httpClient, rpcClient, wallet) {
|
1723
|
+
var _this;
|
1724
|
+
_classCallCheck(this, IPAssetClient);
|
1725
|
+
_this = _super.call(this, httpClient, rpcClient);
|
1726
|
+
_this.wallet = wallet;
|
1727
|
+
return _this;
|
1728
|
+
}
|
1729
|
+
|
1730
|
+
/**
|
1731
|
+
* Register a root IP on Story Protocol based on the specified input asset data.
|
1732
|
+
*
|
1733
|
+
* @param request - the request object that contains all data needed to register a root IP.
|
1734
|
+
* @returns the response object that contains results from the IP creation.
|
1735
|
+
*/
|
1736
|
+
_createClass(IPAssetClient, [{
|
1737
|
+
key: "registerRootIp",
|
1738
|
+
value: function () {
|
1739
|
+
var _registerRootIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
|
1740
|
+
var _request$txOptions, _yield$this$rpcClient, call, txHash, targetLog;
|
1741
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
1742
|
+
while (1) switch (_context.prev = _context.next) {
|
1743
|
+
case 0:
|
1744
|
+
_context.prev = 0;
|
1745
|
+
_context.next = 3;
|
1746
|
+
return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, RegistrationModuleConfig), {}, {
|
1747
|
+
functionName: "registerRootIp",
|
1748
|
+
args: [parseToBigInt(request.policyId), viem.getAddress(request.tokenContractAddress),
|
1749
|
+
// 0x Address
|
1750
|
+
parseToBigInt(request.tokenId)],
|
1751
|
+
account: this.wallet.account
|
1752
|
+
}));
|
1753
|
+
case 3:
|
1754
|
+
_yield$this$rpcClient = _context.sent;
|
1755
|
+
call = _yield$this$rpcClient.request;
|
1756
|
+
_context.next = 7;
|
1757
|
+
return this.wallet.writeContract(call);
|
1758
|
+
case 7:
|
1759
|
+
txHash = _context.sent;
|
1760
|
+
if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.waitForTransaction)) {
|
1761
|
+
_context.next = 15;
|
1762
|
+
break;
|
1763
|
+
}
|
1764
|
+
_context.next = 11;
|
1765
|
+
return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, IPAccountRegistryConfig), {}, {
|
1766
|
+
eventName: "IPAccountRegistered"
|
1767
|
+
}));
|
1768
|
+
case 11:
|
1769
|
+
targetLog = _context.sent;
|
1770
|
+
return _context.abrupt("return", {
|
1771
|
+
txHash: txHash,
|
1772
|
+
ipAccountId: targetLog === null || targetLog === void 0 ? void 0 : targetLog.args.account.toString()
|
1773
|
+
});
|
1774
|
+
case 15:
|
1775
|
+
return _context.abrupt("return", {
|
1776
|
+
txHash: txHash
|
1777
|
+
});
|
1778
|
+
case 16:
|
1779
|
+
_context.next = 21;
|
1780
|
+
break;
|
1781
|
+
case 18:
|
1782
|
+
_context.prev = 18;
|
1783
|
+
_context.t0 = _context["catch"](0);
|
1784
|
+
handleError(_context.t0, "Failed to register root IP");
|
1785
|
+
case 21:
|
1786
|
+
case "end":
|
1787
|
+
return _context.stop();
|
1788
|
+
}
|
1789
|
+
}, _callee, this, [[0, 18]]);
|
1790
|
+
}));
|
1791
|
+
function registerRootIp(_x) {
|
1792
|
+
return _registerRootIp.apply(this, arguments);
|
1793
|
+
}
|
1794
|
+
return registerRootIp;
|
1795
|
+
}()
|
1796
|
+
/**
|
1797
|
+
* Register a derivative IP on Story Protocol based on the specified input asset data.
|
1798
|
+
*
|
1799
|
+
* @param request - the request object that contains all data needed to register a derivative IP.
|
1800
|
+
* @returns the response object that contains results from the IP creation.
|
1801
|
+
*/
|
1802
|
+
}, {
|
1803
|
+
key: "registerDerivativeIp",
|
1804
|
+
value: function () {
|
1805
|
+
var _registerDerivativeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
|
1806
|
+
var _request$txOptions2, _yield$this$rpcClient2, call, txHash, targetLog;
|
1807
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
1808
|
+
while (1) switch (_context2.prev = _context2.next) {
|
1809
|
+
case 0:
|
1810
|
+
_context2.prev = 0;
|
1811
|
+
_context2.next = 3;
|
1812
|
+
return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, RegistrationModuleConfig), {}, {
|
1813
|
+
functionName: "registerDerivativeIp",
|
1814
|
+
args: [parseToBigInt(request.licenseId), viem.getAddress(request.tokenContractAddress),
|
1815
|
+
// 0x Address
|
1816
|
+
parseToBigInt(request.tokenId), request.ipName, request.ipDescription, viem.getAddress(request.hash) // Byte32
|
1817
|
+
]
|
1818
|
+
}));
|
1819
|
+
case 3:
|
1820
|
+
_yield$this$rpcClient2 = _context2.sent;
|
1821
|
+
call = _yield$this$rpcClient2.request;
|
1822
|
+
_context2.next = 7;
|
1823
|
+
return this.wallet.writeContract(call);
|
1824
|
+
case 7:
|
1825
|
+
txHash = _context2.sent;
|
1826
|
+
if (!((_request$txOptions2 = request.txOptions) !== null && _request$txOptions2 !== void 0 && _request$txOptions2.waitForTransaction)) {
|
1827
|
+
_context2.next = 15;
|
1828
|
+
break;
|
1829
|
+
}
|
1830
|
+
_context2.next = 11;
|
1831
|
+
return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, IPAccountRegistryConfig), {}, {
|
1832
|
+
eventName: "IPAccountRegistered"
|
1833
|
+
}));
|
1834
|
+
case 11:
|
1835
|
+
targetLog = _context2.sent;
|
1836
|
+
return _context2.abrupt("return", {
|
1837
|
+
txHash: txHash,
|
1838
|
+
ipAccountId: targetLog === null || targetLog === void 0 ? void 0 : targetLog.args.account.toString()
|
1839
|
+
});
|
1840
|
+
case 15:
|
1841
|
+
return _context2.abrupt("return", {
|
1842
|
+
txHash: txHash
|
1843
|
+
});
|
1844
|
+
case 16:
|
1845
|
+
_context2.next = 21;
|
1846
|
+
break;
|
1847
|
+
case 18:
|
1848
|
+
_context2.prev = 18;
|
1849
|
+
_context2.t0 = _context2["catch"](0);
|
1850
|
+
handleError(_context2.t0, "Failed to register derivative IP");
|
1851
|
+
case 21:
|
1852
|
+
case "end":
|
1853
|
+
return _context2.stop();
|
1854
|
+
}
|
1855
|
+
}, _callee2, this, [[0, 18]]);
|
1856
|
+
}));
|
1857
|
+
function registerDerivativeIp(_x2) {
|
1858
|
+
return _registerDerivativeIp.apply(this, arguments);
|
1859
|
+
}
|
1860
|
+
return registerDerivativeIp;
|
1861
|
+
}() // TODO: move to License resource
|
1862
|
+
// public async createPolicy(request: addPolicyRequest): Promise<addPolicyResponse> {
|
1863
|
+
// try {
|
1864
|
+
// const { request: call } = await this.rpcClient.simulateContract({
|
1865
|
+
// ...LicenseRegistryConfig,
|
1866
|
+
// functionName: "addPolicy",
|
1867
|
+
// args: [
|
1868
|
+
// {
|
1869
|
+
// frameworkId: parseToBigInt(request.frameworkId),
|
1870
|
+
// mintingParamValues: request.mintingParamValues.map((add) => getAddress(add)),
|
1871
|
+
// activationParamValues: request.activationParamValues.map((add) => getAddress(add)),
|
1872
|
+
// needsActivation: request.needsActivation,
|
1873
|
+
// linkParentParamValues: request.linkParentParamValues.map((add) => getAddress(add)),
|
1874
|
+
// },
|
1875
|
+
// ], // TODO: add args
|
1876
|
+
// });
|
1877
|
+
// const txHash = await this.wallet.writeContract(call);
|
1878
|
+
// // TODO: need an emitted event
|
1879
|
+
// // if (request.txOptions?.waitForTransaction) {
|
1880
|
+
// // const targetLog = await waitTxAndFilterLog(this.rpcClient, txHash, {
|
1881
|
+
// // ...IPAccountRegistryConfig,
|
1882
|
+
// // eventName: "IPAccountRegistered",
|
1883
|
+
// // });
|
1884
|
+
// // return { txHash: txHash, policyId: targetLog?.args.account.toString() };
|
1885
|
+
// // } else {
|
1886
|
+
// return { txHash: txHash };
|
1887
|
+
// // }
|
1888
|
+
// } catch (error) {
|
1889
|
+
// handleError(error, "Failed to register derivative IP");
|
1890
|
+
// }
|
1891
|
+
// }
|
1892
|
+
// TODO: move to License resource
|
1893
|
+
// public async addPolicyToIp(request: addPolicyToIpRequest): Promise<addPolicyToIpResponse> {
|
1894
|
+
// TODO: use getIpAccount to get the ipId
|
1895
|
+
// }
|
1896
|
+
}]);
|
1897
|
+
return IPAssetClient;
|
1898
|
+
}(IPAssetReadOnlyClient);
|
1899
|
+
|
1900
|
+
// import { isIntegerString } from "../utils/utils";
|
1901
|
+
|
1902
|
+
/**
|
1903
|
+
* IPAssetReadOnlyClient allows you to view and search IP Assets on Story Protocol.
|
1904
|
+
*/
|
1905
|
+
var PermissionReadOnlyClient = /*#__PURE__*/function () {
|
1906
|
+
function PermissionReadOnlyClient(httpClient, rpcClient) {
|
1907
|
+
_classCallCheck(this, PermissionReadOnlyClient);
|
1908
|
+
this.httpClient = httpClient;
|
1909
|
+
this.rpcClient = rpcClient;
|
1910
|
+
}
|
1911
|
+
|
1912
|
+
/**
|
1913
|
+
* Get permission based on based on the specified IP id.
|
1914
|
+
*
|
1915
|
+
* @param request - the request object for getting an IP Asset.
|
1916
|
+
* @returns the response object the contains the fetched IP Asset.
|
1917
|
+
*/
|
1918
|
+
_createClass(PermissionReadOnlyClient, [{
|
1919
|
+
key: "get",
|
1920
|
+
value: function () {
|
1921
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
|
1922
|
+
var response;
|
1923
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
1924
|
+
while (1) switch (_context.prev = _context.next) {
|
1925
|
+
case 0:
|
1926
|
+
_context.prev = 0;
|
1927
|
+
_context.next = 3;
|
1928
|
+
return this.httpClient.get("/permissions/".concat(request.permissionId));
|
1929
|
+
case 3:
|
1930
|
+
response = _context.sent;
|
1931
|
+
return _context.abrupt("return", response.data);
|
1932
|
+
case 7:
|
1933
|
+
_context.prev = 7;
|
1934
|
+
_context.t0 = _context["catch"](0);
|
1935
|
+
handleError(_context.t0, "Failed to get IP account");
|
1936
|
+
case 10:
|
1937
|
+
case "end":
|
1938
|
+
return _context.stop();
|
1939
|
+
}
|
1940
|
+
}, _callee, this, [[0, 7]]);
|
1941
|
+
}));
|
1942
|
+
function get(_x) {
|
1943
|
+
return _get.apply(this, arguments);
|
1944
|
+
}
|
1945
|
+
return get;
|
1946
|
+
}()
|
1947
|
+
/**
|
1948
|
+
* List IP accounts.
|
1949
|
+
*
|
1950
|
+
* @returns the response object that contains results from listing query.
|
1951
|
+
*/
|
1952
|
+
}, {
|
1953
|
+
key: "list",
|
1954
|
+
value: function () {
|
1955
|
+
var _list = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
|
1956
|
+
var response;
|
1957
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
1958
|
+
while (1) switch (_context2.prev = _context2.next) {
|
1959
|
+
case 0:
|
1960
|
+
_context2.prev = 0;
|
1961
|
+
_context2.next = 3;
|
1962
|
+
return this.httpClient.post("/permissions", request || {});
|
1963
|
+
case 3:
|
1964
|
+
response = _context2.sent;
|
1965
|
+
return _context2.abrupt("return", response.data);
|
1966
|
+
case 7:
|
1967
|
+
_context2.prev = 7;
|
1968
|
+
_context2.t0 = _context2["catch"](0);
|
1969
|
+
handleError(_context2.t0, "Failed to list IP Asset.");
|
1970
|
+
case 10:
|
1971
|
+
case "end":
|
1972
|
+
return _context2.stop();
|
1973
|
+
}
|
1974
|
+
}, _callee2, this, [[0, 7]]);
|
1975
|
+
}));
|
1976
|
+
function list(_x2) {
|
1977
|
+
return _list.apply(this, arguments);
|
1978
|
+
}
|
1979
|
+
return list;
|
1980
|
+
}()
|
1981
|
+
}]);
|
1982
|
+
return PermissionReadOnlyClient;
|
1983
|
+
}();
|
1984
|
+
|
1985
|
+
var IPAccountImplABI = [{
|
1986
|
+
inputs: [{
|
1987
|
+
internalType: "address",
|
1988
|
+
name: "to_",
|
1989
|
+
type: "address"
|
1990
|
+
}, {
|
1991
|
+
internalType: "uint256",
|
1992
|
+
name: "value_",
|
1993
|
+
type: "uint256"
|
1994
|
+
}, {
|
1995
|
+
internalType: "bytes",
|
1996
|
+
name: "data_",
|
1997
|
+
type: "bytes"
|
1998
|
+
}],
|
1999
|
+
name: "execute",
|
2000
|
+
outputs: [{
|
2001
|
+
internalType: "bytes",
|
2002
|
+
name: "result",
|
2003
|
+
type: "bytes"
|
2004
|
+
}],
|
2005
|
+
stateMutability: "payable",
|
2006
|
+
type: "function"
|
2007
|
+
}, {
|
2008
|
+
inputs: [{
|
2009
|
+
internalType: "address",
|
2010
|
+
name: "signer_",
|
2011
|
+
type: "address"
|
2012
|
+
}, {
|
2013
|
+
internalType: "bytes",
|
2014
|
+
name: "data_",
|
2015
|
+
type: "bytes"
|
2016
|
+
}],
|
2017
|
+
name: "isValidSigner",
|
2018
|
+
outputs: [{
|
2019
|
+
internalType: "bytes4",
|
2020
|
+
name: "",
|
2021
|
+
type: "bytes4"
|
2022
|
+
}],
|
2023
|
+
stateMutability: "view",
|
2024
|
+
type: "function"
|
2025
|
+
}];
|
2026
|
+
|
2027
|
+
var ErrorsAbi$1 = errorsJson;
|
2028
|
+
var IPAccountImplMerged = [].concat(_toConsumableArray(IPAccountImplABI), _toConsumableArray(ErrorsAbi$1));
|
2029
|
+
|
2030
|
+
var AccessControllerABI = [{
|
2031
|
+
inputs: [{
|
2032
|
+
internalType: "address",
|
2033
|
+
name: "ipAccount_",
|
2034
|
+
type: "address"
|
2035
|
+
}, {
|
2036
|
+
internalType: "address",
|
2037
|
+
name: "signer_",
|
2038
|
+
type: "address"
|
2039
|
+
}, {
|
2040
|
+
internalType: "address",
|
2041
|
+
name: "to_",
|
2042
|
+
type: "address"
|
2043
|
+
}, {
|
2044
|
+
internalType: "bytes4",
|
2045
|
+
name: "func_",
|
2046
|
+
type: "bytes4"
|
2047
|
+
}, {
|
2048
|
+
internalType: "uint8",
|
2049
|
+
name: "permission_",
|
2050
|
+
type: "uint8"
|
2051
|
+
}],
|
2052
|
+
name: "setPermission",
|
2053
|
+
outputs: [],
|
2054
|
+
stateMutability: "nonpayable",
|
2055
|
+
type: "function"
|
2056
|
+
}, {
|
2057
|
+
anonymous: false,
|
2058
|
+
inputs: [{
|
2059
|
+
indexed: true,
|
2060
|
+
internalType: "address",
|
2061
|
+
name: "ipAccount",
|
2062
|
+
type: "address"
|
2063
|
+
}, {
|
2064
|
+
indexed: true,
|
2065
|
+
internalType: "address",
|
2066
|
+
name: "signer",
|
2067
|
+
type: "address"
|
2068
|
+
}, {
|
2069
|
+
indexed: true,
|
2070
|
+
internalType: "address",
|
2071
|
+
name: "to",
|
2072
|
+
type: "address"
|
2073
|
+
}, {
|
2074
|
+
indexed: false,
|
2075
|
+
internalType: "bytes4",
|
2076
|
+
name: "func",
|
2077
|
+
type: "bytes4"
|
2078
|
+
}, {
|
2079
|
+
indexed: false,
|
2080
|
+
internalType: "uint8",
|
2081
|
+
name: "permission",
|
2082
|
+
type: "uint8"
|
2083
|
+
}],
|
2084
|
+
name: "PermissionSet",
|
2085
|
+
type: "event"
|
2086
|
+
}];
|
2087
|
+
|
2088
|
+
var ErrorsAbi = errorsJson;
|
2089
|
+
var AccessControllerABImerged = [].concat(_toConsumableArray(AccessControllerABI), _toConsumableArray(ErrorsAbi));
|
2090
|
+
({
|
2091
|
+
abi: AccessControllerABImerged,
|
2092
|
+
address: viem.getAddress(process.env.ACCESS_CONTROLLER || process.env.NEXT_PUBLIC_ACCESS_CONTROLLER || "")
|
2093
|
+
});
|
2094
|
+
|
2095
|
+
// import { HashZero } from "../constants/common";
|
2096
|
+
|
2097
|
+
var PermissionClient = /*#__PURE__*/function (_PermissionReadOnlyCl) {
|
2098
|
+
_inherits(PermissionClient, _PermissionReadOnlyCl);
|
2099
|
+
var _super = _createSuper(PermissionClient);
|
2100
|
+
function PermissionClient(httpClient, rpcClient, wallet) {
|
2101
|
+
var _this;
|
2102
|
+
_classCallCheck(this, PermissionClient);
|
2103
|
+
_this = _super.call(this, httpClient, rpcClient);
|
2104
|
+
_this.wallet = wallet;
|
2105
|
+
return _this;
|
2106
|
+
}
|
2107
|
+
|
2108
|
+
/**
|
2109
|
+
* Set Permission based on the specified input
|
2110
|
+
*
|
2111
|
+
* @param request - the request object that contains all data needed to set permission.
|
2112
|
+
* @returns the response object that contains results from the set permission.
|
2113
|
+
*/
|
2114
|
+
_createClass(PermissionClient, [{
|
2115
|
+
key: "setPermission",
|
2116
|
+
value: function () {
|
2117
|
+
var _setPermission = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
|
2118
|
+
var IPAccountConfig, accessController, _yield$this$rpcClient, call, txHash;
|
2119
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
2120
|
+
while (1) switch (_context.prev = _context.next) {
|
2121
|
+
case 0:
|
2122
|
+
_context.prev = 0;
|
2123
|
+
IPAccountConfig = {
|
2124
|
+
abi: IPAccountImplMerged,
|
2125
|
+
address: viem.getAddress(request.ipAsset)
|
2126
|
+
};
|
2127
|
+
accessController = viem.getAddress(process.env.ACCESS_CONTROLLER || process.env.NEXT_PUBLIC_ACCESS_CONTROLLER || ""); //to
|
2128
|
+
_context.next = 5;
|
2129
|
+
return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, IPAccountConfig), {}, {
|
2130
|
+
functionName: "execute",
|
2131
|
+
args: [accessController, 0, viem.encodeFunctionData({
|
2132
|
+
abi: AccessControllerABImerged,
|
2133
|
+
functionName: "setPermission",
|
2134
|
+
args: [viem.getAddress(request.ipAsset),
|
2135
|
+
// 0x Address
|
2136
|
+
viem.getAddress(request.signer),
|
2137
|
+
// 0x Address
|
2138
|
+
viem.getAddress(request.to),
|
2139
|
+
// 0x Address
|
2140
|
+
request.func,
|
2141
|
+
// bytes4
|
2142
|
+
request.permission // uint8
|
2143
|
+
]
|
2144
|
+
})],
|
2145
|
+
|
2146
|
+
account: this.wallet.account
|
2147
|
+
}));
|
2148
|
+
case 5:
|
2149
|
+
_yield$this$rpcClient = _context.sent;
|
2150
|
+
call = _yield$this$rpcClient.request;
|
2151
|
+
_context.next = 9;
|
2152
|
+
return this.wallet.writeContract(call);
|
2153
|
+
case 9:
|
2154
|
+
txHash = _context.sent;
|
2155
|
+
return _context.abrupt("return", {
|
2156
|
+
txHash: txHash
|
2157
|
+
});
|
2158
|
+
case 13:
|
2159
|
+
_context.prev = 13;
|
2160
|
+
_context.t0 = _context["catch"](0);
|
2161
|
+
handleError(_context.t0, "Failed to set permissions");
|
2162
|
+
case 16:
|
2163
|
+
case "end":
|
2164
|
+
return _context.stop();
|
2165
|
+
}
|
2166
|
+
}, _callee, this, [[0, 13]]);
|
2167
|
+
}));
|
2168
|
+
function setPermission(_x) {
|
2169
|
+
return _setPermission.apply(this, arguments);
|
2170
|
+
}
|
2171
|
+
return setPermission;
|
2172
|
+
}()
|
2173
|
+
}]);
|
2174
|
+
return PermissionClient;
|
2175
|
+
}(PermissionReadOnlyClient);
|
2176
|
+
|
2177
|
+
if (typeof process !== "undefined") {
|
2178
|
+
dotenv__namespace.config();
|
2179
|
+
}
|
2180
|
+
/**
|
2181
|
+
* The StoryClient is the main entry point for the SDK.
|
2182
|
+
*/
|
2183
|
+
var StoryClient = /*#__PURE__*/function () {
|
2184
|
+
/**
|
2185
|
+
* @param config - the configuration for the SDK client
|
2186
|
+
* @param isReadOnly
|
2187
|
+
*/
|
2188
|
+
function StoryClient(config) {
|
2189
|
+
var isReadOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
2190
|
+
_classCallCheck(this, StoryClient);
|
2191
|
+
_defineProperty(this, "isReadOnly", false);
|
2192
|
+
_defineProperty(this, "_ipAccount", null);
|
2193
|
+
_defineProperty(this, "_permission", null);
|
2194
|
+
_defineProperty(this, "_transaction", null);
|
2195
|
+
_defineProperty(this, "_platform", null);
|
2196
|
+
_defineProperty(this, "_module", null);
|
2197
|
+
_defineProperty(this, "_tagging", null);
|
2198
|
+
this.config = config;
|
2199
|
+
this.isReadOnly = isReadOnly;
|
2200
|
+
var clientConfig = {
|
2201
|
+
chain: this.config.chain || chains.sepolia,
|
2202
|
+
transport: this.config.transport || viem.http(process.env.RPC_PROVIDER_URL)
|
2203
|
+
};
|
2204
|
+
this.rpcClient = viem.createPublicClient(clientConfig);
|
2205
|
+
if (!isReadOnly) {
|
2206
|
+
var account = this.config.account;
|
2207
|
+
if (!account) {
|
2208
|
+
throw new Error("account is null");
|
2209
|
+
}
|
2210
|
+
this.wallet = viem.createWalletClient(_objectSpread2(_objectSpread2({}, clientConfig), {}, {
|
2211
|
+
account: account
|
2212
|
+
}));
|
2213
|
+
}
|
2214
|
+
this.httpClient = axios__default["default"].create({
|
2215
|
+
baseURL: process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL,
|
2216
|
+
timeout: HTTP_TIMEOUT,
|
2217
|
+
headers: {
|
2218
|
+
version: "v0-alpha"
|
2219
|
+
}
|
2220
|
+
});
|
2221
|
+
}
|
2222
|
+
|
2223
|
+
/**
|
2224
|
+
* Factory method for creating a read only SDK client.
|
2225
|
+
*
|
2226
|
+
* @param config - the configuration for a read only SDK client
|
2227
|
+
*/
|
2228
|
+
_createClass(StoryClient, [{
|
2229
|
+
key: "ipAsset",
|
2230
|
+
get: function get() {
|
2231
|
+
if (this._ipAccount === null) {
|
2232
|
+
this._ipAccount = this.isReadOnly ? new IPAssetReadOnlyClient(this.httpClient, this.rpcClient) : new IPAssetClient(this.httpClient, this.rpcClient, this.wallet);
|
2233
|
+
}
|
2234
|
+
return this._ipAccount;
|
2235
|
+
}
|
2236
|
+
}, {
|
2237
|
+
key: "permission",
|
2238
|
+
get: function get() {
|
2239
|
+
if (this._permission === null) {
|
2240
|
+
this._permission = this.isReadOnly ? new PermissionReadOnlyClient(this.httpClient, this.rpcClient) : new PermissionClient(this.httpClient, this.rpcClient, this.wallet);
|
2241
|
+
}
|
2242
|
+
return this._permission;
|
2243
|
+
}
|
2244
|
+
|
2245
|
+
/**
|
2246
|
+
* Getter for the transaction client. The client is lazily created when
|
2247
|
+
* this method is called.
|
2248
|
+
*
|
2249
|
+
* @returns the TransactionReadOnlyClient or TransactionClient instance
|
2250
|
+
*/
|
2251
|
+
}, {
|
2252
|
+
key: "transaction",
|
2253
|
+
get: function get() {
|
2254
|
+
if (this._transaction === null) {
|
2255
|
+
this._transaction = this.isReadOnly ? new TransactionReadOnlyClient(this.httpClient, this.rpcClient) : new TransactionClient(this.httpClient, this.rpcClient, this.wallet);
|
2256
|
+
}
|
2257
|
+
return this._transaction;
|
2258
|
+
}
|
2259
|
+
|
2260
|
+
/**
|
2261
|
+
* Getter for the tagging client. The client is lazily created when
|
2262
|
+
* this method is called.
|
2263
|
+
*
|
2264
|
+
* @returns the TaggingReadOnlyClient or TaggingClient instance
|
2265
|
+
*/
|
2266
|
+
}, {
|
2267
|
+
key: "tagging",
|
2268
|
+
get: function get() {
|
2269
|
+
if (this._tagging === null) {
|
2270
|
+
this._tagging = this.isReadOnly ? new TaggingReadOnlyClient(this.httpClient, this.rpcClient) : new TaggingClient(this.httpClient, this.rpcClient, this.wallet);
|
2271
|
+
}
|
2272
|
+
return this._tagging;
|
2273
|
+
}
|
2274
|
+
|
2275
|
+
/**
|
2276
|
+
* Getter for the platform client. The client is lazily created when
|
2277
|
+
* this method is called.
|
2278
|
+
*
|
2279
|
+
* @returns the PlatformClient instance
|
2280
|
+
*/
|
2281
|
+
}, {
|
2282
|
+
key: "platform",
|
2283
|
+
get: function get() {
|
2284
|
+
if (this._platform === null) {
|
2285
|
+
this._platform = new PlatformClient(this.httpClient);
|
2286
|
+
}
|
2287
|
+
return this._platform;
|
2288
|
+
}
|
2289
|
+
|
2290
|
+
/**
|
2291
|
+
* Getter for the module client. The client is lazily created when
|
2292
|
+
* this method is called.
|
2293
|
+
*
|
2294
|
+
* @returns the Module instance
|
2295
|
+
*/
|
2296
|
+
}, {
|
2297
|
+
key: "module",
|
2298
|
+
get: function get() {
|
2299
|
+
if (this._module === null) {
|
2300
|
+
this._module = new ModuleReadOnlyClient(this.httpClient, this.rpcClient);
|
2301
|
+
}
|
2302
|
+
return this._module;
|
2303
|
+
}
|
2304
|
+
}], [{
|
2305
|
+
key: "newReadOnlyClient",
|
2306
|
+
value: function newReadOnlyClient(config) {
|
2307
|
+
return new StoryClient(config, true);
|
2308
|
+
}
|
2309
|
+
|
2310
|
+
/**
|
2311
|
+
* Factory method for creating a SDK client with a signer.
|
2312
|
+
*
|
2313
|
+
* @param config - the configuration for a new read/write SDK client
|
2314
|
+
*/
|
2315
|
+
}, {
|
2316
|
+
key: "newClient",
|
2317
|
+
value: function newClient(config) {
|
2318
|
+
return new StoryClient(config, false);
|
2319
|
+
}
|
2320
|
+
}]);
|
2321
|
+
return StoryClient;
|
2322
|
+
}();
|
2323
|
+
|
2324
|
+
/**
|
2325
|
+
* @public
|
2326
|
+
*/
|
2327
|
+
var ResourceType = /*#__PURE__*/function (ResourceType) {
|
2328
|
+
ResourceType["Unspecified"] = "Unspecified";
|
2329
|
+
ResourceType["IPOrg"] = "IPOrg";
|
2330
|
+
ResourceType["IPAsset"] = "IPAsset";
|
2331
|
+
ResourceType["License"] = "License";
|
2332
|
+
ResourceType["Relationship"] = "Relationship";
|
2333
|
+
ResourceType["RelationshipType"] = "RelationshipType";
|
2334
|
+
ResourceType["Module"] = "Module";
|
2335
|
+
ResourceType["Hook"] = "Hook";
|
2336
|
+
ResourceType["Dispute"] = "Dispute";
|
2337
|
+
return ResourceType;
|
2338
|
+
}({});
|
2339
|
+
|
2340
|
+
/**
|
2341
|
+
* @public
|
2342
|
+
*/
|
2343
|
+
var ActionType = /*#__PURE__*/function (ActionType) {
|
2344
|
+
ActionType["Unspecified"] = "Unspecified";
|
2345
|
+
ActionType["Register"] = "Register";
|
2346
|
+
ActionType["Unregister"] = "Unregister";
|
2347
|
+
ActionType["Configure"] = "Configure";
|
2348
|
+
ActionType["Create"] = "Create";
|
2349
|
+
return ActionType;
|
2350
|
+
}({});
|
2351
|
+
|
2352
|
+
var AddressZero = "0x0000000000000000000000000000000000000000";
|
2353
|
+
var HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
2354
|
+
|
2355
|
+
exports.ActionType = ActionType;
|
2356
|
+
exports.AddressZero = AddressZero;
|
2357
|
+
exports.HashZero = HashZero;
|
2358
|
+
exports.IPAssetClient = IPAssetClient;
|
2359
|
+
exports.IPAssetReadOnlyClient = IPAssetReadOnlyClient;
|
2360
|
+
exports.ModuleReadOnlyClient = ModuleReadOnlyClient;
|
2361
|
+
exports.PermissionClient = PermissionClient;
|
2362
|
+
exports.PermissionReadOnlyClient = PermissionReadOnlyClient;
|
2363
|
+
exports.PlatformClient = PlatformClient;
|
2364
|
+
exports.ResourceType = ResourceType;
|
2365
|
+
exports.StoryClient = StoryClient;
|
2366
|
+
exports.TaggingReadOnlyClient = TaggingReadOnlyClient;
|
2367
|
+
exports.TransactionClient = TransactionClient;
|