wowok_agent 1.3.47 → 1.3.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/call/arbitration.d.ts +4 -3
- package/dist/call/arbitration.d.ts.map +1 -1
- package/dist/call/arbitration.js +134 -131
- package/dist/call/arbitration.js.map +1 -1
- package/dist/call/base.d.ts +15 -7
- package/dist/call/base.d.ts.map +1 -1
- package/dist/call/base.js +21 -23
- package/dist/call/base.js.map +1 -1
- package/dist/call/call.d.ts +0 -6
- package/dist/call/call.d.ts.map +1 -1
- package/dist/call/demand.d.ts +1 -0
- package/dist/call/demand.d.ts.map +1 -1
- package/dist/call/demand.js +86 -80
- package/dist/call/demand.js.map +1 -1
- package/dist/call/machine.d.ts +10 -10
- package/dist/call/machine.d.ts.map +1 -1
- package/dist/call/machine.js +174 -146
- package/dist/call/machine.js.map +1 -1
- package/dist/call/permission.d.ts +10 -9
- package/dist/call/permission.d.ts.map +1 -1
- package/dist/call/permission.js +90 -85
- package/dist/call/permission.js.map +1 -1
- package/dist/call/personal.d.ts +3 -3
- package/dist/call/personal.d.ts.map +1 -1
- package/dist/call/personal.js +6 -12
- package/dist/call/personal.js.map +1 -1
- package/dist/call/repository.d.ts +24 -8
- package/dist/call/repository.d.ts.map +1 -1
- package/dist/call/repository.js +114 -94
- package/dist/call/repository.js.map +1 -1
- package/dist/call/service.d.ts +15 -26
- package/dist/call/service.d.ts.map +1 -1
- package/dist/call/service.js +274 -264
- package/dist/call/service.js.map +1 -1
- package/dist/call/treasury.d.ts +5 -7
- package/dist/call/treasury.d.ts.map +1 -1
- package/dist/call/treasury.js +108 -97
- package/dist/call/treasury.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/query/objects.d.ts +2 -1
- package/dist/query/objects.d.ts.map +1 -1
- package/dist/query/objects.js +7 -7
- package/dist/query/objects.js.map +1 -1
- package/dist/query/owned.d.ts +2 -0
- package/dist/query/owned.d.ts.map +1 -0
- package/dist/query/owned.js +2 -0
- package/dist/query/owned.js.map +1 -0
- package/dist/query/permission.d.ts +3 -2
- package/dist/query/permission.d.ts.map +1 -1
- package/dist/query/permission.js +6 -3
- package/dist/query/permission.js.map +1 -1
- package/dist/query/treasury_received.d.ts +14 -0
- package/dist/query/treasury_received.d.ts.map +1 -0
- package/dist/query/treasury_received.js +19 -0
- package/dist/query/treasury_received.js.map +1 -0
- package/package.json +1 -1
- package/src/call/arbitration.ts +144 -141
- package/src/call/base.ts +27 -29
- package/src/call/call.ts +6 -6
- package/src/call/demand.ts +89 -81
- package/src/call/machine.ts +184 -145
- package/src/call/permission.ts +98 -90
- package/src/call/personal.ts +8 -13
- package/src/call/repository.ts +138 -95
- package/src/call/service.ts +290 -272
- package/src/call/treasury.ts +110 -99
- package/src/index.ts +1 -0
- package/src/query/objects.ts +10 -10
- package/src/query/permission.ts +9 -6
- package/src/query/treasury_received.ts +35 -0
- package/tsconfig.tsbuildinfo +1 -1
package/dist/call/service.js
CHANGED
|
@@ -41,26 +41,31 @@ export class CallService extends CallBase {
|
|
|
41
41
|
};
|
|
42
42
|
this.data = data;
|
|
43
43
|
}
|
|
44
|
+
async prepare() {
|
|
45
|
+
if (!this.object_address) {
|
|
46
|
+
this.object_address = (await LocalMark.Instance().get_address(GetObjectExisted(this.data.object)));
|
|
47
|
+
if (this.object_address) {
|
|
48
|
+
await this.update_content('Service', this.object_address);
|
|
49
|
+
if (!this.content)
|
|
50
|
+
ERROR(Errors.InvalidParam, 'CallService_Data.data.object:' + this.object_address);
|
|
51
|
+
this.permission_address = this.content.permission;
|
|
52
|
+
this.type_parameter = Service.parseObjectType(this.content.type_raw);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
const n = GetObjectMain(this.data.object);
|
|
56
|
+
if (!IsValidArgType(n?.type_parameter)) {
|
|
57
|
+
ERROR(Errors.IsValidArgType, 'CallService_Data.data.object.type_parameter');
|
|
58
|
+
}
|
|
59
|
+
this.permission_address = (await LocalMark.Instance().get_address(GetObjectExisted(n?.permission)));
|
|
60
|
+
this.type_parameter = n.type_parameter;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
44
64
|
async call(account) {
|
|
45
65
|
var checkOwner = false;
|
|
46
66
|
const guards = [];
|
|
47
67
|
const perms = [];
|
|
48
|
-
|
|
49
|
-
if (this.object_address) {
|
|
50
|
-
await this.update_content('Service', this.object_address);
|
|
51
|
-
if (!this.content)
|
|
52
|
-
ERROR(Errors.InvalidParam, 'CallService_Data.data.object:' + this.object_address);
|
|
53
|
-
this.permission_address = this.content.permission;
|
|
54
|
-
this.type_parameter = Service.parseObjectType(this.content.type_raw);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
const n = GetObjectMain(this.data.object);
|
|
58
|
-
if (!IsValidArgType(n?.type_parameter)) {
|
|
59
|
-
ERROR(Errors.IsValidArgType, 'CallService_Data.data.object.type_parameter');
|
|
60
|
-
}
|
|
61
|
-
this.permission_address = (await LocalMark.Instance().get_address(GetObjectExisted(n?.permission)));
|
|
62
|
-
this.type_parameter = n.type_parameter;
|
|
63
|
-
}
|
|
68
|
+
await this.prepare();
|
|
64
69
|
if (this.permission_address) {
|
|
65
70
|
if (!this.data?.object) {
|
|
66
71
|
perms.push(PermissionIndex.service);
|
|
@@ -123,8 +128,8 @@ export class CallService extends CallBase {
|
|
|
123
128
|
}
|
|
124
129
|
}
|
|
125
130
|
}
|
|
126
|
-
if (this.data
|
|
127
|
-
const guard = await LocalMark.Instance().get_address(this.data?.order_refund?.
|
|
131
|
+
if (this.data?.order_refund?.refund_guard !== undefined) {
|
|
132
|
+
const guard = await LocalMark.Instance().get_address(this.data?.order_refund?.refund_guard);
|
|
128
133
|
if (guard)
|
|
129
134
|
guards.push(guard);
|
|
130
135
|
}
|
|
@@ -153,289 +158,294 @@ export class CallService extends CallBase {
|
|
|
153
158
|
}
|
|
154
159
|
async operate(txb, passport, account) {
|
|
155
160
|
let obj;
|
|
161
|
+
let perm;
|
|
156
162
|
let permission;
|
|
157
163
|
let payee;
|
|
158
164
|
if (this.object_address) {
|
|
159
165
|
obj = Service.From(txb, this.type_parameter, this.permission_address, this.object_address);
|
|
166
|
+
permission = this.permission_address;
|
|
160
167
|
}
|
|
161
168
|
else {
|
|
162
169
|
const n = GetObjectMain(this.data.object);
|
|
163
|
-
|
|
164
|
-
|
|
170
|
+
permission = await LocalMark.Instance().get_address(GetObjectExisted(n?.permission));
|
|
171
|
+
if (!permission) {
|
|
172
|
+
perm = Permission.New(txb, GetObjectParam(n?.permission)?.description ?? '');
|
|
173
|
+
permission = perm.get_object();
|
|
165
174
|
}
|
|
166
175
|
const treasury_address = await LocalMark.Instance().get_address(GetObjectExisted(this.data.payee_treasury));
|
|
167
176
|
if (!treasury_address) {
|
|
168
|
-
payee = Treasury.New(txb, this.type_parameter, permission
|
|
177
|
+
payee = Treasury.New(txb, this.type_parameter, permission, GetObjectParam(this.data.payee_treasury)?.description ?? '', perm ? undefined : passport);
|
|
169
178
|
}
|
|
170
179
|
const t = payee ? payee.get_object() : treasury_address;
|
|
171
180
|
if (!t) {
|
|
172
181
|
ERROR(Errors.InvalidParam, 'CallService_Data.payee_treasury:' + this.data.payee_treasury.address);
|
|
173
182
|
}
|
|
174
|
-
obj = Service.New(txb, this.type_parameter, permission
|
|
175
|
-
}
|
|
176
|
-
if (obj)
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
183
|
+
obj = Service.New(txb, this.type_parameter, permission, this.data?.description ?? '', t, perm ? undefined : passport);
|
|
184
|
+
}
|
|
185
|
+
if (!obj)
|
|
186
|
+
ERROR(Errors.InvalidParam, 'CallService_Data.object:' + this.object_address);
|
|
187
|
+
if (!permission)
|
|
188
|
+
ERROR(Errors.InvalidParam, 'CallService_Data.permission:' + this.permission_address);
|
|
189
|
+
const pst = perm ? undefined : passport;
|
|
190
|
+
var order_new;
|
|
191
|
+
if (this.data?.order_new !== undefined && this.order_allowed()) {
|
|
192
|
+
let b = BigInt(0);
|
|
193
|
+
let coin;
|
|
194
|
+
this.data.order_new.buy_items.forEach(v => {
|
|
195
|
+
b += BigInt(v.max_price) * BigInt(v.count);
|
|
196
|
+
});
|
|
197
|
+
coin = await Account.Instance().get_coin_object(txb, b, account, this.type_parameter);
|
|
198
|
+
if (coin) {
|
|
199
|
+
order_new = obj.order(this.data.order_new.buy_items, coin, await LocalMark.Instance().get_address(this.data.order_new.discount_object), (this?.content).machine, await this.info_crypto(this.data.order_new.customer_info_required), pst);
|
|
190
200
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
201
|
+
}
|
|
202
|
+
if (this.data?.order_agent !== undefined) {
|
|
203
|
+
const o = this.data.order_agent.order ? await LocalMark.Instance().get_address(this.data.order_agent.order) : order_new?.order;
|
|
204
|
+
if (!o)
|
|
205
|
+
ERROR(Errors.InvalidParam, `CallService_Data.data.order_agent.order:${this.data.order_agent.order}`);
|
|
206
|
+
const p = await this.order_progress(this.data.order_agent.order, order_new);
|
|
207
|
+
const agents = await GetManyAccountOrMark_Address(this.data.order_agent.agents);
|
|
208
|
+
obj?.set_order_agent(o, agents.filter((v) => v !== undefined), p);
|
|
209
|
+
}
|
|
210
|
+
if (this.data?.order_required_info?.customer_info_required) {
|
|
211
|
+
const o = await LocalMark.Instance().get_address(this.data.order_required_info.order);
|
|
212
|
+
if (!o)
|
|
213
|
+
ERROR(Errors.InvalidParam, `CallService_Data.data.order_required_info.order:${this.data.order_required_info.order}`);
|
|
214
|
+
const crypto = await this.info_crypto(this.object_address, this.data.order_required_info.customer_info_required);
|
|
215
|
+
if (crypto) {
|
|
216
|
+
obj?.update_order_required_info(o, crypto);
|
|
207
217
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
obj?.refund_withArb(o, r?.objects[0].object, Arbitration.parseArbObjectType(r.objects[0].type_raw));
|
|
218
|
-
}
|
|
219
|
-
else {
|
|
220
|
-
const guard = await LocalMark.Instance().get_address(this.data?.order_refund?.guard);
|
|
221
|
-
if (guard)
|
|
222
|
-
obj?.refund(o, guard, pst);
|
|
218
|
+
}
|
|
219
|
+
if (this.data?.order_refund !== undefined) {
|
|
220
|
+
const o = await LocalMark.Instance().get_address(this.data.order_refund.order);
|
|
221
|
+
if (!o)
|
|
222
|
+
ERROR(Errors.InvalidParam, `CallService_Data.data.order_agent.order:${this.data.order_refund.order}`);
|
|
223
|
+
if (this.data?.order_refund?.arb) {
|
|
224
|
+
const r = await query_objects({ objects: [this.data?.order_refund?.arb] });
|
|
225
|
+
if (r?.objects?.length !== 1 || r?.objects[0]?.type !== 'Arb') {
|
|
226
|
+
ERROR(Errors.InvalidParam, 'order_refund.arb:' + this.data?.order_refund?.arb);
|
|
223
227
|
}
|
|
228
|
+
obj?.refund_withArb(o, r?.objects[0].object, Arbitration.parseArbObjectType(r.objects[0].type_raw));
|
|
224
229
|
}
|
|
225
|
-
|
|
226
|
-
const
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
ERROR(Errors.InvalidParam, `CallService_Data.data.order_agent.order:${this.data.order_withdrawl.order}`);
|
|
230
|
-
const [for_guard, for_object, withdrawGuard] = await LocalMark.Instance().get_many_address([n.data.for_guard, n.data.for_object, n.data.withdraw_guard]);
|
|
231
|
-
if (!withdrawGuard)
|
|
232
|
-
ERROR(Errors.InvalidParam, `CallService_Data.data.order_withdrawl.data.withdraw_guard:${this.data.order_withdrawl.data.withdraw_guard}`);
|
|
233
|
-
obj?.withdraw(o, { withdraw_guard: withdrawGuard, treasury: this.content.payee_treasury,
|
|
234
|
-
index: n.data.index, for_guard: for_guard, for_object: for_object, remark: n.data.remark }, pst);
|
|
235
|
-
}
|
|
236
|
-
if (this.data?.order_payer !== undefined) {
|
|
237
|
-
const o = this.data.order_payer.order ? await LocalMark.Instance().get_address(this.data.order_payer.order) : order_new?.order;
|
|
238
|
-
if (!o)
|
|
239
|
-
ERROR(Errors.InvalidParam, `CallService_Data.data.order_agent.order:${this.data.order_payer.order}`);
|
|
240
|
-
const p = await this.order_progress(this.data.order_payer.order, order_new);
|
|
241
|
-
const payer = await GetAccountOrMark_Address(this.data.order_payer.payer_new);
|
|
242
|
-
if (payer)
|
|
243
|
-
obj?.change_order_payer(o, payer, p);
|
|
244
|
-
}
|
|
245
|
-
if (order_new && this?.data?.order_new) {
|
|
246
|
-
const buy = obj.order_launch(order_new);
|
|
247
|
-
await this.new_with_mark('Order', txb, buy.order, this.data?.order_new?.namedNewOrder, account, [TagName.Launch, TagName.Order]);
|
|
248
|
-
if (buy?.progress) {
|
|
249
|
-
await this.new_with_mark('Progress', txb, buy.progress, this.data?.order_new?.namedNewProgress, account, [TagName.Launch, 'progress']);
|
|
250
|
-
}
|
|
230
|
+
else {
|
|
231
|
+
const guard = await LocalMark.Instance().get_address(this.data?.order_refund?.refund_guard);
|
|
232
|
+
if (guard)
|
|
233
|
+
obj?.refund(o, guard, pst);
|
|
251
234
|
}
|
|
252
|
-
|
|
253
|
-
|
|
235
|
+
}
|
|
236
|
+
if (this.data?.order_withdrawl !== undefined && pst) { //@ need withdrawal pst
|
|
237
|
+
const n = this.data?.order_withdrawl;
|
|
238
|
+
const o = await LocalMark.Instance().get_address(n.order);
|
|
239
|
+
if (!o)
|
|
240
|
+
ERROR(Errors.InvalidParam, `CallService_Data.data.order_agent.order:${this.data.order_withdrawl.order}`);
|
|
241
|
+
const [for_guard, for_object, withdrawGuard] = await LocalMark.Instance().get_many_address([n.data.for_guard, n.data.for_object, n.data.withdraw_guard]);
|
|
242
|
+
if (!withdrawGuard)
|
|
243
|
+
ERROR(Errors.InvalidParam, `CallService_Data.data.order_withdrawl.data.withdraw_guard:${this.data.order_withdrawl.data.withdraw_guard}`);
|
|
244
|
+
obj?.withdraw(o, { withdraw_guard: withdrawGuard, treasury: this.content.payee_treasury,
|
|
245
|
+
index: n.data.index, for_guard: for_guard, for_object: for_object, remark: n.data.remark }, pst);
|
|
246
|
+
}
|
|
247
|
+
if (this.data?.order_payer !== undefined) {
|
|
248
|
+
const o = this.data.order_payer.order ? await LocalMark.Instance().get_address(this.data.order_payer.order) : order_new?.order;
|
|
249
|
+
if (!o)
|
|
250
|
+
ERROR(Errors.InvalidParam, `CallService_Data.data.order_agent.order:${this.data.order_payer.order}`);
|
|
251
|
+
const p = await this.order_progress(this.data.order_payer.order, order_new);
|
|
252
|
+
const payer = await GetAccountOrMark_Address(this.data.order_payer.payer_new);
|
|
253
|
+
if (payer)
|
|
254
|
+
obj?.change_order_payer(o, payer, p);
|
|
255
|
+
}
|
|
256
|
+
if (order_new && this?.data?.order_new) {
|
|
257
|
+
const buy = obj.order_launch(order_new);
|
|
258
|
+
await this.new_with_mark('Order', txb, buy.order, this.data?.order_new?.namedNewOrder, account, [TagName.Launch, TagName.Order]);
|
|
259
|
+
if (buy?.progress) {
|
|
260
|
+
await this.new_with_mark('Progress', txb, buy.progress, this.data?.order_new?.namedNewProgress, account, [TagName.Launch, 'progress']);
|
|
254
261
|
}
|
|
255
|
-
|
|
256
|
-
|
|
262
|
+
}
|
|
263
|
+
if (this.data?.description !== undefined && this.object_address) {
|
|
264
|
+
obj?.set_description(this.data.description, pst);
|
|
265
|
+
}
|
|
266
|
+
if (this.data?.endpoint !== undefined) {
|
|
267
|
+
obj?.set_endpoint(this.data.endpoint, pst);
|
|
268
|
+
}
|
|
269
|
+
if (this.data?.payee_treasury !== undefined && this.object_address) {
|
|
270
|
+
const treasury_address = await LocalMark.Instance().get_address(GetObjectExisted(this.data.payee_treasury));
|
|
271
|
+
if (!treasury_address) {
|
|
272
|
+
payee = Treasury.New(txb, this.type_parameter, permission, GetObjectParam(this.data.payee_treasury)?.description ?? '', permission ? undefined : passport);
|
|
257
273
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
payee = Treasury.New(txb, this.type_parameter, permission ? permission.get_object() : this.permission_address, GetObjectParam(this.data.payee_treasury)?.description ?? '', permission ? undefined : passport);
|
|
262
|
-
}
|
|
263
|
-
const t = payee ? payee.get_object() : treasury_address;
|
|
264
|
-
if (!t) {
|
|
265
|
-
ERROR(Errors.InvalidParam, 'CallService_Data.payee_treasury:' + this.data.payee_treasury.address);
|
|
266
|
-
}
|
|
267
|
-
obj?.set_payee(t, pst);
|
|
274
|
+
const t = payee ? payee.get_object() : treasury_address;
|
|
275
|
+
if (!t) {
|
|
276
|
+
ERROR(Errors.InvalidParam, 'CallService_Data.payee_treasury:' + this.data.payee_treasury.address);
|
|
268
277
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
278
|
+
obj?.set_payee(t, pst);
|
|
279
|
+
}
|
|
280
|
+
if (this.data?.gen_discount !== undefined) {
|
|
281
|
+
const add = [];
|
|
282
|
+
for (let i = 0; i < this.data.gen_discount.length; ++i) {
|
|
283
|
+
let v = this.data.gen_discount[i];
|
|
284
|
+
const addr = await GetAccountOrMark_Address(v.receiver);
|
|
285
|
+
if (addr) {
|
|
286
|
+
add.push({ receiver: addr, count: v.count ?? 1, discount: v.discount });
|
|
277
287
|
}
|
|
278
|
-
obj?.discount_transfer(add, pst);
|
|
279
288
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
let v = this.data.repository.repositories[i];
|
|
288
|
-
const addr = await LocalMark.Instance().get_address(v);
|
|
289
|
-
if (addr) {
|
|
290
|
-
obj?.add_repository(addr, pst);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
break;
|
|
294
|
-
case 'remove':
|
|
295
|
-
obj?.remove_repository(await LocalMark.Instance().get_many_address2(this.data.repository.repositories), false, pst);
|
|
296
|
-
break;
|
|
297
|
-
case 'removeall':
|
|
289
|
+
obj?.discount_transfer(add, pst);
|
|
290
|
+
}
|
|
291
|
+
if (this.data?.repository !== undefined) {
|
|
292
|
+
switch (this.data.repository.op) {
|
|
293
|
+
case 'add':
|
|
294
|
+
case 'set':
|
|
295
|
+
if (this.data.repository.op === 'set')
|
|
298
296
|
obj?.remove_repository([], true, pst);
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
case 'add':
|
|
305
|
-
case 'set':
|
|
306
|
-
if (this.data.extern_withdraw_treasury.op === 'set')
|
|
307
|
-
obj?.remove_treasury([], true, pst);
|
|
308
|
-
const r = await query_objects({ objects: this.data.extern_withdraw_treasury.treasuries, no_cache: true });
|
|
309
|
-
r.objects?.forEach(v => {
|
|
310
|
-
if (v.type === 'Treasury') {
|
|
311
|
-
obj?.add_treasury(v.object, Treasury.parseObjectType(v.type_raw), pst);
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
|
-
break;
|
|
315
|
-
case 'remove':
|
|
316
|
-
obj?.remove_treasury(await LocalMark.Instance().get_many_address2(this.data.extern_withdraw_treasury.treasuries), false, pst);
|
|
317
|
-
break;
|
|
318
|
-
case 'removeall':
|
|
319
|
-
obj?.remove_treasury([], false, pst);
|
|
320
|
-
break;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
if (this.data?.machine !== undefined) {
|
|
324
|
-
const machine = await LocalMark.Instance().get_address(this.data.machine);
|
|
325
|
-
obj?.set_machine(machine, pst);
|
|
326
|
-
}
|
|
327
|
-
if (this.data?.arbitration !== undefined) {
|
|
328
|
-
switch (this.data.arbitration.op) {
|
|
329
|
-
case 'add':
|
|
330
|
-
case 'set':
|
|
331
|
-
if (this.data.arbitration.op === 'set')
|
|
332
|
-
obj?.remove_arbitration([], true, pst);
|
|
333
|
-
const r = await query_objects({ objects: this.data.arbitration.arbitrations, no_cache: true });
|
|
334
|
-
r.objects?.forEach(v => {
|
|
335
|
-
if (v.type === 'Arbitration') {
|
|
336
|
-
obj?.add_arbitration(v.object, Arbitration.parseObjectType(v.type_raw), pst);
|
|
337
|
-
}
|
|
338
|
-
});
|
|
339
|
-
break;
|
|
340
|
-
case 'remove':
|
|
341
|
-
obj?.remove_arbitration(await LocalMark.Instance().get_many_address2(this.data.arbitration.arbitrations), false, pst);
|
|
342
|
-
break;
|
|
343
|
-
case 'removeall':
|
|
344
|
-
obj?.remove_arbitration([], false, pst);
|
|
345
|
-
break;
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
if (this.data?.customer_required_info !== undefined) {
|
|
349
|
-
if (this.data.customer_required_info.required_info.length > 0 && this.data.customer_required_info.pubkey) {
|
|
350
|
-
obj?.set_customer_required(this.data.customer_required_info.pubkey, this.data.customer_required_info.required_info, pst);
|
|
351
|
-
}
|
|
352
|
-
else if (this.data.customer_required_info.pubkey) {
|
|
353
|
-
obj?.change_required_pubkey(this.data.customer_required_info.pubkey, pst);
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
if (this.data?.sales !== undefined) {
|
|
357
|
-
switch (this.data.sales.op) {
|
|
358
|
-
case 'add':
|
|
359
|
-
obj?.add_sales(this.data.sales.sales, false, pst);
|
|
360
|
-
break;
|
|
361
|
-
case 'remove':
|
|
362
|
-
obj?.remove_sales(this.data.sales.sales_name, pst);
|
|
363
|
-
break;
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
if (this.data?.withdraw_guard !== undefined) {
|
|
367
|
-
switch (this.data.withdraw_guard.op) {
|
|
368
|
-
case 'add':
|
|
369
|
-
case 'set':
|
|
370
|
-
if (this.data.withdraw_guard.op === 'set')
|
|
371
|
-
obj?.remove_withdraw_guards([], true, pst);
|
|
372
|
-
const add = [];
|
|
373
|
-
for (let i = 0; i < this.data.withdraw_guard.guards.length; ++i) {
|
|
374
|
-
let v = this.data.withdraw_guard.guards[i];
|
|
375
|
-
const addr = typeof (v.guard) === 'string' ? await LocalMark.Instance().get_address(v.guard) : v.guard;
|
|
376
|
-
if (addr) {
|
|
377
|
-
v.guard = addr;
|
|
378
|
-
add.push(v);
|
|
379
|
-
}
|
|
297
|
+
for (let i = 0; i < this.data.repository.objects.length; ++i) {
|
|
298
|
+
let v = this.data.repository.objects[i];
|
|
299
|
+
const addr = await LocalMark.Instance().get_address(v);
|
|
300
|
+
if (addr) {
|
|
301
|
+
obj?.add_repository(addr, pst);
|
|
380
302
|
}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
}
|
|
303
|
+
}
|
|
304
|
+
break;
|
|
305
|
+
case 'remove':
|
|
306
|
+
obj?.remove_repository(await LocalMark.Instance().get_many_address2(this.data.repository.objects), false, pst);
|
|
307
|
+
break;
|
|
308
|
+
case 'removeall':
|
|
309
|
+
obj?.remove_repository([], true, pst);
|
|
310
|
+
break;
|
|
390
311
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
v.guard = addr;
|
|
403
|
-
add.push(v);
|
|
404
|
-
}
|
|
312
|
+
}
|
|
313
|
+
if (this.data?.extern_withdraw_treasury !== undefined) {
|
|
314
|
+
switch (this.data.extern_withdraw_treasury.op) {
|
|
315
|
+
case 'add':
|
|
316
|
+
case 'set':
|
|
317
|
+
if (this.data.extern_withdraw_treasury.op === 'set')
|
|
318
|
+
obj?.remove_treasury([], true, pst);
|
|
319
|
+
const r = await query_objects({ objects: this.data.extern_withdraw_treasury.objects, no_cache: true });
|
|
320
|
+
r.objects?.forEach(v => {
|
|
321
|
+
if (v.type === 'Treasury') {
|
|
322
|
+
obj?.add_treasury(v.object, Treasury.parseObjectType(v.type_raw), pst);
|
|
405
323
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
if (this.data?.bPublished) {
|
|
417
|
-
obj?.publish(pst);
|
|
324
|
+
});
|
|
325
|
+
break;
|
|
326
|
+
case 'remove':
|
|
327
|
+
obj?.remove_treasury(await LocalMark.Instance().get_many_address2(this.data.extern_withdraw_treasury.objects), false, pst);
|
|
328
|
+
break;
|
|
329
|
+
case 'removeall':
|
|
330
|
+
obj?.remove_treasury([], false, pst);
|
|
331
|
+
break;
|
|
418
332
|
}
|
|
419
|
-
|
|
420
|
-
|
|
333
|
+
}
|
|
334
|
+
if (this.data?.machine !== undefined) {
|
|
335
|
+
const machine = await LocalMark.Instance().get_address(this.data.machine);
|
|
336
|
+
obj?.set_machine(machine, pst);
|
|
337
|
+
}
|
|
338
|
+
if (this.data?.arbitration !== undefined) {
|
|
339
|
+
switch (this.data.arbitration.op) {
|
|
340
|
+
case 'add':
|
|
341
|
+
case 'set':
|
|
342
|
+
if (this.data.arbitration.op === 'set')
|
|
343
|
+
obj?.remove_arbitration([], true, pst);
|
|
344
|
+
const r = await query_objects({ objects: this.data.arbitration.objects, no_cache: true });
|
|
345
|
+
r.objects?.forEach(v => {
|
|
346
|
+
if (v.type === 'Arbitration') {
|
|
347
|
+
obj?.add_arbitration(v.object, Arbitration.parseObjectType(v.type_raw), pst);
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
break;
|
|
351
|
+
case 'remove':
|
|
352
|
+
obj?.remove_arbitration(await LocalMark.Instance().get_many_address2(this.data.arbitration.objects), false, pst);
|
|
353
|
+
break;
|
|
354
|
+
case 'removeall':
|
|
355
|
+
obj?.remove_arbitration([], false, pst);
|
|
356
|
+
break;
|
|
421
357
|
}
|
|
422
|
-
|
|
423
|
-
|
|
358
|
+
}
|
|
359
|
+
if (this.data?.customer_required_info !== undefined) {
|
|
360
|
+
if (this.data.customer_required_info.required_info.length > 0 && this.data.customer_required_info.pubkey) {
|
|
361
|
+
obj?.set_customer_required(this.data.customer_required_info.pubkey, this.data.customer_required_info.required_info, pst);
|
|
424
362
|
}
|
|
425
|
-
if (this.data
|
|
426
|
-
|
|
363
|
+
else if (this.data.customer_required_info.pubkey) {
|
|
364
|
+
obj?.change_required_pubkey(this.data.customer_required_info.pubkey, pst);
|
|
427
365
|
}
|
|
428
|
-
|
|
429
|
-
|
|
366
|
+
}
|
|
367
|
+
if (this.data?.sales !== undefined) {
|
|
368
|
+
switch (this.data.sales.op) {
|
|
369
|
+
case 'add':
|
|
370
|
+
obj?.add_sales(this.data.sales.sales, false, pst);
|
|
371
|
+
break;
|
|
372
|
+
case 'remove':
|
|
373
|
+
obj?.remove_sales(this.data.sales.sales_name, pst);
|
|
374
|
+
break;
|
|
430
375
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
376
|
+
}
|
|
377
|
+
if (this.data?.withdraw_guard !== undefined) {
|
|
378
|
+
switch (this.data.withdraw_guard.op) {
|
|
379
|
+
case 'add':
|
|
380
|
+
case 'set':
|
|
381
|
+
if (this.data.withdraw_guard.op === 'set')
|
|
382
|
+
obj?.remove_withdraw_guards([], true, pst);
|
|
383
|
+
const add = [];
|
|
384
|
+
for (let i = 0; i < this.data.withdraw_guard.guards.length; ++i) {
|
|
385
|
+
let v = this.data.withdraw_guard.guards[i];
|
|
386
|
+
const addr = typeof (v.guard) === 'string' ? await LocalMark.Instance().get_address(v.guard) : v.guard;
|
|
387
|
+
if (addr) {
|
|
388
|
+
v.guard = addr;
|
|
389
|
+
add.push(v);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
obj?.add_withdraw_guards(add, pst);
|
|
393
|
+
break;
|
|
394
|
+
case 'remove':
|
|
395
|
+
obj?.remove_withdraw_guards(await LocalMark.Instance().get_many_address2(this.data.withdraw_guard.guards), false, pst);
|
|
396
|
+
break;
|
|
397
|
+
case 'removeall':
|
|
398
|
+
obj?.remove_withdraw_guards([], true, pst);
|
|
399
|
+
break;
|
|
434
400
|
}
|
|
435
|
-
|
|
436
|
-
|
|
401
|
+
}
|
|
402
|
+
if (this.data?.refund_guard !== undefined) {
|
|
403
|
+
switch (this.data.refund_guard.op) {
|
|
404
|
+
case 'add':
|
|
405
|
+
case 'set':
|
|
406
|
+
if (this.data.refund_guard.op === 'set')
|
|
407
|
+
obj?.remove_refund_guards([], true, pst);
|
|
408
|
+
const add = [];
|
|
409
|
+
for (let i = 0; i < this.data.refund_guard.guards.length; ++i) {
|
|
410
|
+
let v = this.data.refund_guard.guards[i];
|
|
411
|
+
const addr = typeof (v.guard) === 'string' ? await LocalMark.Instance().get_address(v.guard) : v.guard;
|
|
412
|
+
if (addr) {
|
|
413
|
+
v.guard = addr;
|
|
414
|
+
add.push(v);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
obj?.add_refund_guards(add, pst);
|
|
418
|
+
break;
|
|
419
|
+
case 'remove':
|
|
420
|
+
obj?.remove_refund_guards(await LocalMark.Instance().get_many_address2(this.data.refund_guard.guards), false, pst);
|
|
421
|
+
break;
|
|
422
|
+
case 'removeall':
|
|
423
|
+
obj?.remove_refund_guards([], true, pst);
|
|
424
|
+
break;
|
|
437
425
|
}
|
|
438
426
|
}
|
|
427
|
+
if (this.data?.bPublished) {
|
|
428
|
+
obj?.publish(pst);
|
|
429
|
+
}
|
|
430
|
+
if (this.data?.buy_guard !== undefined) {
|
|
431
|
+
obj?.set_buy_guard(this.data.buy_guard, pst);
|
|
432
|
+
}
|
|
433
|
+
if (this.data?.bPaused !== undefined) {
|
|
434
|
+
obj?.pause(this.data.bPaused, pst);
|
|
435
|
+
}
|
|
436
|
+
if (this.data?.clone_new !== undefined) {
|
|
437
|
+
await this.new_with_mark('Service', txb, obj.clone(this.data.clone_new?.token_type_new, true, pst), this.data?.clone_new?.namedNew, account);
|
|
438
|
+
}
|
|
439
|
+
if (payee) {
|
|
440
|
+
await this.new_with_mark('Treasury', txb, payee.launch(), GetObjectParam(this.data?.payee_treasury), account);
|
|
441
|
+
}
|
|
442
|
+
if (perm) {
|
|
443
|
+
const n = GetObjectMain(this.data.object);
|
|
444
|
+
await this.new_with_mark('Permission', txb, perm.launch(), GetObjectParam(n?.permission), account);
|
|
445
|
+
}
|
|
446
|
+
if (!this.object_address) {
|
|
447
|
+
await this.new_with_mark('Service', txb, obj.launch(), GetObjectMain(this.data?.object), account);
|
|
448
|
+
}
|
|
439
449
|
}
|
|
440
450
|
}
|
|
441
451
|
//# sourceMappingURL=service.js.map
|