wowok_agent 1.2.38 → 1.2.41
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 +1 -1
- package/dist/call/arbitration.d.ts.map +1 -1
- package/dist/call/arbitration.js +76 -50
- package/dist/call/arbitration.js.map +1 -1
- package/dist/call/base.d.ts +3 -1
- package/dist/call/base.d.ts.map +1 -1
- package/dist/call/base.js +24 -16
- package/dist/call/base.js.map +1 -1
- package/dist/call/call.d.ts +18 -18
- package/dist/call/call.d.ts.map +1 -1
- package/dist/call/call.js +12 -12
- package/dist/call/call.js.map +1 -1
- package/dist/call/demand.d.ts +3 -1
- package/dist/call/demand.d.ts.map +1 -1
- package/dist/call/demand.js +55 -28
- package/dist/call/demand.js.map +1 -1
- package/dist/call/guard.d.ts.map +1 -1
- package/dist/call/guard.js +29 -18
- package/dist/call/guard.js.map +1 -1
- package/dist/call/machine.d.ts +1 -1
- package/dist/call/machine.d.ts.map +1 -1
- package/dist/call/machine.js +82 -38
- package/dist/call/machine.js.map +1 -1
- package/dist/call/object_permission.d.ts +1 -0
- package/dist/call/object_permission.d.ts.map +1 -1
- package/dist/call/object_permission.js +12 -9
- package/dist/call/object_permission.js.map +1 -1
- package/dist/call/permission.d.ts +1 -0
- package/dist/call/permission.d.ts.map +1 -1
- package/dist/call/permission.js +48 -18
- package/dist/call/permission.js.map +1 -1
- package/dist/call/personal.d.ts +1 -1
- package/dist/call/personal.d.ts.map +1 -1
- package/dist/call/personal.js +40 -13
- package/dist/call/personal.js.map +1 -1
- package/dist/call/repository.d.ts.map +1 -1
- package/dist/call/repository.js +24 -14
- package/dist/call/repository.js.map +1 -1
- package/dist/call/service.d.ts +1 -1
- package/dist/call/service.d.ts.map +1 -1
- package/dist/call/service.js +149 -71
- package/dist/call/service.js.map +1 -1
- package/dist/call/treasury.d.ts +1 -1
- package/dist/call/treasury.d.ts.map +1 -1
- package/dist/call/treasury.js +65 -49
- package/dist/call/treasury.js.map +1 -1
- package/dist/common.d.ts +1 -0
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +9 -0
- package/dist/common.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/local/account.d.ts +26 -12
- package/dist/local/account.d.ts.map +1 -1
- package/dist/local/account.js +199 -93
- package/dist/local/account.js.map +1 -1
- package/dist/local/index.d.ts +44 -23
- package/dist/local/index.d.ts.map +1 -1
- package/dist/local/index.js +57 -50
- package/dist/local/index.js.map +1 -1
- package/dist/local/local.d.ts +4 -2
- package/dist/local/local.d.ts.map +1 -1
- package/dist/local/local.js +35 -27
- package/dist/local/local.js.map +1 -1
- package/dist/query/objects.d.ts.map +1 -1
- package/dist/query/objects.js +15 -7
- package/dist/query/objects.js.map +1 -1
- package/package.json +2 -2
- package/src/call/arbitration.ts +87 -54
- package/src/call/base.ts +28 -19
- package/src/call/call.ts +31 -31
- package/src/call/demand.ts +62 -30
- package/src/call/guard.ts +25 -16
- package/src/call/machine.ts +89 -42
- package/src/call/object_permission.ts +12 -8
- package/src/call/permission.ts +45 -18
- package/src/call/personal.ts +39 -13
- package/src/call/repository.ts +27 -13
- package/src/call/service.ts +152 -73
- package/src/call/treasury.ts +70 -50
- package/src/common.ts +9 -0
- package/src/index.ts +1 -0
- package/src/local/account.ts +212 -92
- package/src/local/index.ts +75 -68
- package/src/local/local.ts +44 -30
- package/src/query/objects.ts +14 -6
- package/tsconfig.tsbuildinfo +1 -1
package/src/call/arbitration.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { TransactionBlock, IsValidArgType, PassportObject,
|
|
2
|
-
PermissionIndexType, Treasury, Arbitration, VotingGuard, WithdrawFee, ArbObject,
|
|
1
|
+
import { TransactionBlock, IsValidArgType, PassportObject, Errors, ERROR, Permission, PermissionIndex,
|
|
2
|
+
PermissionIndexType, Treasury, Arbitration, VotingGuard, WithdrawFee, ArbObject,
|
|
3
3
|
} from 'wowok';
|
|
4
|
-
import {
|
|
4
|
+
import { ObjectArbitration, } from '../query/objects.js';
|
|
5
5
|
import { CallBase, CallResult, Namedbject} from "./base.js";
|
|
6
6
|
import { Account } from '../local/account.js';
|
|
7
|
+
import { LocalMark } from '../local/local.js';
|
|
7
8
|
export interface DisputeData {
|
|
8
9
|
order: string,
|
|
9
10
|
order_token_type: string,
|
|
@@ -21,7 +22,7 @@ export interface CallArbitration_Data {
|
|
|
21
22
|
endpoint?: string;
|
|
22
23
|
fee?: string | number;
|
|
23
24
|
fee_treasury?: {address:string} | {namedNew?: Namedbject, description?:string};
|
|
24
|
-
arb_new?: {data: DisputeData; guard?:string
|
|
25
|
+
arb_new?: {data: DisputeData; guard?:string; namedNew?: Namedbject}; // dispute an order, and a new Arb launched.
|
|
25
26
|
arb_withdraw_fee?: {arb?:string; data:WithdrawFee};
|
|
26
27
|
arb_vote?: {arb?: string; voting_guard?: string; agrees: number[]};
|
|
27
28
|
arb_arbitration?: {arb?:string; feedback:string; indemnity?:string|number};
|
|
@@ -32,23 +33,36 @@ export interface CallArbitration_Data {
|
|
|
32
33
|
|
|
33
34
|
export class CallArbitration extends CallBase {
|
|
34
35
|
data: CallArbitration_Data;
|
|
36
|
+
|
|
35
37
|
constructor (data: CallArbitration_Data) {
|
|
36
38
|
super();
|
|
37
39
|
this.data = data;
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
async call(account?:string) : Promise<CallResult> {
|
|
41
|
-
if (!this.data?.type_parameter || !IsValidArgType(this.data.type_parameter)) {
|
|
42
|
-
ERROR(Errors.IsValidArgType, 'arbitration.type_parameter')
|
|
43
|
-
}
|
|
44
|
-
|
|
45
43
|
var checkOwner = false; const guards : string[] = [];
|
|
46
|
-
const perms : PermissionIndexType[] = [];
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
const perms : PermissionIndexType[] = [];
|
|
45
|
+
var [permission_address, object_address, treasury_address] =
|
|
46
|
+
await LocalMark.Instance().get_many_address(
|
|
47
|
+
[(this.data?.permission as any)?.address,
|
|
48
|
+
(this.data?.object as any)?.address,
|
|
49
|
+
(this.data?.fee_treasury as any)?.address]);
|
|
50
|
+
|
|
51
|
+
if (object_address) {
|
|
52
|
+
if (!this.data.type_parameter || !permission_address) {
|
|
53
|
+
await this.update_content(object_address, 'Arbitration');
|
|
54
|
+
if (this.content) {
|
|
55
|
+
permission_address = (this.content as ObjectArbitration).permission;
|
|
56
|
+
this.data.type_parameter = this.content.type_raw!;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
} else {
|
|
60
|
+
if (!this.data?.type_parameter || !IsValidArgType(this.data.type_parameter)) {
|
|
61
|
+
ERROR(Errors.IsValidArgType, 'CallArbitration_Data.data.type_parameter')
|
|
62
|
+
}
|
|
63
|
+
}
|
|
50
64
|
|
|
51
|
-
if (permission_address
|
|
65
|
+
if (permission_address) {
|
|
52
66
|
if (!this.data?.object) {
|
|
53
67
|
perms.push(PermissionIndex.arbitration)
|
|
54
68
|
}
|
|
@@ -77,32 +91,33 @@ export class CallArbitration extends CallBase {
|
|
|
77
91
|
perms.push(PermissionIndex.arbitration_arbitration)
|
|
78
92
|
}
|
|
79
93
|
if (this.data?.arb_new?.guard !== undefined) {
|
|
80
|
-
if (
|
|
81
|
-
|
|
94
|
+
if (this.data?.arb_new?.guard) {
|
|
95
|
+
const guard = await LocalMark.Instance().get_address(this.data?.arb_new?.guard);
|
|
96
|
+
if (guard) {
|
|
97
|
+
guards.push(guard)
|
|
98
|
+
}
|
|
82
99
|
} else {
|
|
83
100
|
if (!object_address) { // new
|
|
84
|
-
|
|
85
|
-
|
|
101
|
+
const guard = await LocalMark.Instance().get_address(this.data.guard);
|
|
102
|
+
if (guard) {
|
|
103
|
+
guards.push(guard);
|
|
86
104
|
}
|
|
87
105
|
} else {
|
|
88
|
-
|
|
89
|
-
const r = await query_objects({objects:[object_address]});
|
|
90
|
-
if (r?.objects && r.objects[0].type === 'Arbitration') {
|
|
91
|
-
obj = r.objects[0] as ObjectArbitration;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
106
|
+
await this.update_content(object_address, 'Arbitration');
|
|
94
107
|
|
|
95
|
-
if (
|
|
96
|
-
guards.push(
|
|
108
|
+
if ((this.content as ObjectArbitration)?.usage_guard) {
|
|
109
|
+
guards.push((this.content as ObjectArbitration).usage_guard!)
|
|
97
110
|
}
|
|
98
111
|
}
|
|
99
112
|
}
|
|
100
113
|
}
|
|
101
114
|
if (this.data?.arb_vote !== undefined) {
|
|
102
|
-
perms.push(PermissionIndex.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
115
|
+
perms.push(PermissionIndex.arbitration_vote);
|
|
116
|
+
|
|
117
|
+
const voting_guard = await LocalMark.Instance().get_address(this.data?.arb_vote?.voting_guard);
|
|
118
|
+
if (voting_guard) {
|
|
119
|
+
guards.push(voting_guard)
|
|
120
|
+
}
|
|
106
121
|
}
|
|
107
122
|
|
|
108
123
|
return await this.check_permission_and_call(permission_address, perms, guards, checkOwner, undefined, account)
|
|
@@ -111,16 +126,19 @@ export class CallArbitration extends CallBase {
|
|
|
111
126
|
}
|
|
112
127
|
protected async operate(txb:TransactionBlock, passport?:PassportObject, account?:string) {
|
|
113
128
|
let obj : Arbitration | undefined ; let permission: any; let withdraw_treasury:any;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
129
|
+
var [permission_address, object_address] = this?.content ?
|
|
130
|
+
[(this.content as ObjectArbitration).permission, this.content.object] :
|
|
131
|
+
await LocalMark.Instance().get_many_address(
|
|
132
|
+
[(this.data?.permission as any)?.address,
|
|
133
|
+
(this.data?.object as any)?.address]);
|
|
134
|
+
const treasury_address = await LocalMark.Instance().get_address((this.data?.fee_treasury as any)?.address);
|
|
117
135
|
|
|
118
136
|
if (!object_address) {
|
|
119
|
-
if (!permission_address
|
|
137
|
+
if (!permission_address) {
|
|
120
138
|
const d = (this.data?.permission as any)?.description ?? '';
|
|
121
139
|
permission = Permission.New(txb, d);
|
|
122
140
|
}
|
|
123
|
-
if (!treasury_address
|
|
141
|
+
if (!treasury_address) {
|
|
124
142
|
const d = (this.data?.fee_treasury as any)?.description ?? '';
|
|
125
143
|
withdraw_treasury = Treasury.New(txb, this.data?.type_parameter!, permission ? permission.get_object() : permission_address,
|
|
126
144
|
d, permission?undefined:passport);
|
|
@@ -128,10 +146,10 @@ export class CallArbitration extends CallBase {
|
|
|
128
146
|
obj = Arbitration.New(txb, this.data.type_parameter!, permission ? permission.get_object() : permission_address, this.data?.description??'',
|
|
129
147
|
BigInt(this.data?.fee ?? 0), withdraw_treasury? withdraw_treasury.get_object() : treasury_address, permission?undefined:passport);
|
|
130
148
|
} else {
|
|
131
|
-
if (
|
|
149
|
+
if (this.data.type_parameter && permission_address) {
|
|
132
150
|
obj = Arbitration.From(txb, this.data.type_parameter, permission_address, object_address)
|
|
133
151
|
} else {
|
|
134
|
-
ERROR(Errors.InvalidParam, '
|
|
152
|
+
ERROR(Errors.InvalidParam, 'CallArbitration_Data.data.type_parameter or permission')
|
|
135
153
|
}
|
|
136
154
|
}
|
|
137
155
|
|
|
@@ -151,30 +169,33 @@ export class CallArbitration extends CallBase {
|
|
|
151
169
|
}
|
|
152
170
|
var arb_new : ArbObject | undefined;
|
|
153
171
|
if (this.data?.arb_new !== undefined) {
|
|
154
|
-
const b = BigInt(this.data.arb_new.data.fee);
|
|
155
172
|
const d = this.data?.arb_new.data;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
173
|
+
const order = await LocalMark.Instance().get_address(d.order);
|
|
174
|
+
if (order) {
|
|
175
|
+
const b = BigInt(d.fee);
|
|
176
|
+
arb_new = obj?.arb({order:d.order, order_token_type:d.order_token_type, description:d.description, votable_proposition:d.votable_proposition,
|
|
177
|
+
fee: b>BigInt(0) ? await Account.Instance().get_coin_object(txb, b, account, this.data.type_parameter) : undefined
|
|
178
|
+
}, pst);
|
|
179
|
+
}
|
|
159
180
|
}
|
|
160
181
|
|
|
161
182
|
if (this.data?.arb_arbitration !== undefined) {
|
|
162
|
-
const a = this.data.arb_arbitration.arb ?? arb_new;
|
|
163
|
-
if (!a) ERROR(Errors.
|
|
183
|
+
const a = await LocalMark.Instance().get_address(this.data.arb_arbitration.arb) ?? arb_new;
|
|
184
|
+
if (!a) ERROR(Errors.InvalidParam, 'CallArbitration_Data.data.arb_arbitration.arb');
|
|
164
185
|
|
|
165
186
|
obj?.arbitration({arb:a!, feedback:this.data.arb_arbitration.feedback, indemnity:this.data.arb_arbitration.indemnity}, pst)
|
|
166
187
|
}
|
|
167
188
|
|
|
168
189
|
if (this.data?.arb_vote !== undefined) {
|
|
169
|
-
const a = this.data.arb_vote.arb ?? arb_new;
|
|
170
|
-
if (!a) ERROR(Errors.
|
|
190
|
+
const a = await LocalMark.Instance().get_address(this.data.arb_vote.arb) ?? arb_new;
|
|
191
|
+
if (!a) ERROR(Errors.InvalidParam, 'CallArbitration_Data.data.arb_vote.arb');
|
|
171
192
|
|
|
172
193
|
obj?.vote({arb:a!, voting_guard:this.data.arb_vote.voting_guard, agrees:this.data.arb_vote.agrees}, pst)
|
|
173
194
|
}
|
|
174
195
|
|
|
175
196
|
if (this.data?.arb_withdraw_fee !== undefined) {
|
|
176
|
-
const a = this.data.arb_withdraw_fee.arb ?? arb_new;
|
|
177
|
-
if (!a) ERROR(Errors.
|
|
197
|
+
const a = await LocalMark.Instance().get_address(this.data.arb_withdraw_fee.arb) ?? arb_new;
|
|
198
|
+
if (!a) ERROR(Errors.InvalidParam, 'CallArbitration_Data.data.arb_withdraw_fee.arb');
|
|
178
199
|
|
|
179
200
|
obj?.withdraw_fee(a!, this.data.arb_withdraw_fee.data, pst)
|
|
180
201
|
}
|
|
@@ -186,23 +207,35 @@ export class CallArbitration extends CallBase {
|
|
|
186
207
|
if (this.data?.voting_guard !== undefined) {
|
|
187
208
|
switch (this.data.voting_guard.op) {
|
|
188
209
|
case 'add':
|
|
189
|
-
|
|
210
|
+
case 'set':
|
|
211
|
+
for (let i = 0; i < this.data.voting_guard.data.length; ++ i) {
|
|
212
|
+
const v = this.data.voting_guard.data[i];
|
|
213
|
+
if (typeof(v.guard) === 'string') {
|
|
214
|
+
const g = await LocalMark.Instance().get_address(v.guard);
|
|
215
|
+
if (!g) {
|
|
216
|
+
ERROR(Errors.InvalidParam, 'CallArbitration_Data.data.voting_guard')
|
|
217
|
+
}
|
|
218
|
+
v.guard = g;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if (this.data.voting_guard.op === 'set') {
|
|
222
|
+
obj?.remove_voting_guard([], true, pst)
|
|
223
|
+
}
|
|
224
|
+
obj?.add_voting_guard(this.data.voting_guard.data, pst);
|
|
190
225
|
break;
|
|
191
226
|
case 'remove':
|
|
192
|
-
obj?.remove_voting_guard(this.data.voting_guard.guards, false, pst)
|
|
193
|
-
break;
|
|
194
|
-
case 'set':
|
|
195
|
-
obj?.remove_voting_guard([], true, pst)
|
|
196
|
-
obj?.add_voting_guard(this.data.voting_guard.data, pst)
|
|
227
|
+
obj?.remove_voting_guard(await LocalMark.Instance().get_many_address2(this.data.voting_guard.guards), false, pst)
|
|
197
228
|
break;
|
|
198
229
|
case 'removeall':
|
|
199
230
|
obj?.remove_voting_guard([], true, pst)
|
|
200
231
|
break;
|
|
201
232
|
}
|
|
202
233
|
}
|
|
203
|
-
|
|
204
|
-
|
|
234
|
+
const guard = await LocalMark.Instance().get_address(this.data.guard);
|
|
235
|
+
if (guard) {
|
|
236
|
+
obj?.set_guard(guard, pst)
|
|
205
237
|
}
|
|
238
|
+
|
|
206
239
|
if (this.data?.bPaused !== undefined) {
|
|
207
240
|
obj?.pause(this.data.bPaused, pst);
|
|
208
241
|
}
|
package/src/call/base.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { Entity, Resource, TxbAddress, array_unique, TagName, ResourceObject, Pa
|
|
|
5
5
|
} from 'wowok';
|
|
6
6
|
import { query_permission } from '../query/permission.js';
|
|
7
7
|
import { Account } from '../local/account.js';
|
|
8
|
-
import { ObjectBase, ObjectBaseType, query_personal, raw2type} from '../query/objects.js';
|
|
8
|
+
import { ObjectArbitration, ObjectBase, ObjectBaseType, query_objects, query_personal, raw2type} from '../query/objects.js';
|
|
9
9
|
import { LocalMark } from '../local/local.js';
|
|
10
10
|
|
|
11
11
|
export interface Namedbject {
|
|
@@ -50,6 +50,7 @@ export class CallBase {
|
|
|
50
50
|
// operation implementation for a call
|
|
51
51
|
private resouceObject:ResourceObject | undefined;
|
|
52
52
|
private traceMarkNew = new Map<ObjectBaseType, Namedbject>();
|
|
53
|
+
content: ObjectBase | undefined = undefined;
|
|
53
54
|
|
|
54
55
|
protected async operate(txb:TransactionBlock, passport?:PassportObject, account?:string) {};
|
|
55
56
|
constructor () {}
|
|
@@ -82,10 +83,10 @@ export class CallBase {
|
|
|
82
83
|
var guards : string[] = [];
|
|
83
84
|
|
|
84
85
|
if (permIndex.length > 0 || checkOwner) {
|
|
85
|
-
const addr = await
|
|
86
|
+
const addr = await Account.Instance().get(account);
|
|
86
87
|
if (!addr) ERROR(Errors.InvalidParam, 'check_permission_and_call: account invalid');
|
|
87
88
|
|
|
88
|
-
const p = await query_permission({permission_object:permission, address:addr
|
|
89
|
+
const p = await query_permission({permission_object:permission, address:addr.address});
|
|
89
90
|
if (checkOwner && !p.owner) ERROR(Errors.noPermission, 'owner');
|
|
90
91
|
if (checkAdmin && !p.admin) ERROR(Errors.noPermission, 'admin');
|
|
91
92
|
|
|
@@ -117,7 +118,7 @@ export class CallBase {
|
|
|
117
118
|
}
|
|
118
119
|
return {guard:[...guards], witness:p!.future_fills()};
|
|
119
120
|
} else { // no passport needed
|
|
120
|
-
return await this.exec()
|
|
121
|
+
return await this.exec(account)
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
124
|
protected async exec (account?:string) : Promise<CallResponse> {
|
|
@@ -128,20 +129,19 @@ export class CallBase {
|
|
|
128
129
|
|
|
129
130
|
protected async new_with_mark(type:ObjectBaseType, txb:TransactionBlock, object:TxbAddress, named_new?:Namedbject, account?:string, innerTags:string[]=[TagName.Launch]) {
|
|
130
131
|
const tags = named_new?.tags ? array_unique([...named_new.tags, ...innerTags]) : array_unique([...innerTags]);
|
|
131
|
-
if (
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
} ;
|
|
132
|
+
if (named_new) {
|
|
133
|
+
named_new.tags = tags;
|
|
134
|
+
this.traceMarkNew.set(type, named_new)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (!named_new?.onChain) return ;
|
|
138
138
|
|
|
139
139
|
// onchain mark
|
|
140
140
|
if (!this.resouceObject) {
|
|
141
|
-
const addr = await
|
|
141
|
+
const addr = await Account.Instance().get(account);
|
|
142
142
|
|
|
143
143
|
if (addr) {
|
|
144
|
-
const r = await query_personal({address:addr}); //@ use cache
|
|
144
|
+
const r = await query_personal({address:addr.address}); //@ use cache
|
|
145
145
|
if (!r?.mark_object) {
|
|
146
146
|
this.resouceObject = Entity.From(txb).create_resource2(); // new
|
|
147
147
|
Resource.From(txb, this.resouceObject).add(object, tags, named_new?.name);
|
|
@@ -154,20 +154,29 @@ export class CallBase {
|
|
|
154
154
|
} else {
|
|
155
155
|
Resource.From(txb, this.resouceObject).add(object, tags, named_new?.name);
|
|
156
156
|
}
|
|
157
|
-
|
|
158
157
|
}
|
|
159
158
|
|
|
160
|
-
protected async
|
|
159
|
+
protected async update_content(object:string, type:ObjectBaseType) {
|
|
160
|
+
if (this.content) return ;
|
|
161
|
+
|
|
162
|
+
const r = await query_objects({objects:[object]});
|
|
163
|
+
if (r?.objects?.length !== 1 || r?.objects[0]?.type !== type) {
|
|
164
|
+
ERROR(Errors.Fail, `Fetch ${type} object ${object} failed`)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
this.content = r?.objects[0];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
protected async sign_and_commit(txb: TransactionBlock, account?: string) : Promise<CallResponse> {
|
|
161
171
|
if (this.resouceObject) {
|
|
162
172
|
Resource.From(txb, this.resouceObject).launch(); //@ resource launch, if created.
|
|
163
173
|
this.resouceObject = undefined;
|
|
164
174
|
}
|
|
165
|
-
|
|
166
|
-
|
|
175
|
+
const r = await Account.Instance().sign_and_commit(txb, account);
|
|
176
|
+
|
|
167
177
|
if (!r) {
|
|
168
178
|
ERROR(Errors.Fail, 'sign and commit failed');
|
|
169
179
|
}
|
|
170
|
-
|
|
171
180
|
// save the mark locally, anyway
|
|
172
181
|
const res = ResponseData(r);
|
|
173
182
|
res.forEach(v => {
|
|
@@ -175,7 +184,7 @@ export class CallBase {
|
|
|
175
184
|
const namedNew = this.traceMarkNew.get(v.type);
|
|
176
185
|
if (namedNew) {
|
|
177
186
|
LocalMark.Instance().put(namedNew.name,
|
|
178
|
-
{object:v.object, tags:namedNew?.tags},
|
|
187
|
+
{object:v.object, tags:namedNew?.tags ? [...namedNew?.tags, v.type] : [v.type]},
|
|
179
188
|
namedNew?.useAddressIfNameExist);
|
|
180
189
|
}
|
|
181
190
|
}
|
package/src/call/call.ts
CHANGED
|
@@ -18,53 +18,53 @@ import { CallObjectPermission, CallObjectPermission_Data } from "./object_permis
|
|
|
18
18
|
|
|
19
19
|
export interface CallDemandObject {
|
|
20
20
|
data: CallDemand_Data;
|
|
21
|
-
account?: string;
|
|
22
|
-
witness?: GuardInfo_forCall;
|
|
21
|
+
account?: string | null;
|
|
22
|
+
witness?: GuardInfo_forCall | null;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export interface CallServiceObject {
|
|
26
26
|
data: CallService_Data;
|
|
27
|
-
account?: string;
|
|
28
|
-
witness?: GuardInfo_forCall;
|
|
27
|
+
account?: string | null;
|
|
28
|
+
witness?: GuardInfo_forCall | null;
|
|
29
29
|
}
|
|
30
30
|
export interface CallMachineObject {
|
|
31
31
|
data: CallMachine_Data;
|
|
32
|
-
account?: string;
|
|
33
|
-
witness?: GuardInfo_forCall;
|
|
32
|
+
account?: string | null;
|
|
33
|
+
witness?: GuardInfo_forCall | null;
|
|
34
34
|
}
|
|
35
35
|
export interface CallTreasuryObject {
|
|
36
36
|
data: CallTreasury_Data;
|
|
37
|
-
account?: string;
|
|
38
|
-
witness?: GuardInfo_forCall;
|
|
37
|
+
account?: string | null;
|
|
38
|
+
witness?: GuardInfo_forCall | null;
|
|
39
39
|
}
|
|
40
40
|
export interface CallArbitrationObject {
|
|
41
41
|
data: CallArbitration_Data;
|
|
42
|
-
account?: string;
|
|
43
|
-
witness?: GuardInfo_forCall;
|
|
42
|
+
account?: string | null;
|
|
43
|
+
witness?: GuardInfo_forCall | null;
|
|
44
44
|
}
|
|
45
45
|
export interface CallGuardObject {
|
|
46
46
|
data: CallGuard_Data;
|
|
47
|
-
account?: string;
|
|
47
|
+
account?: string | null;
|
|
48
48
|
}
|
|
49
49
|
export interface CallRepositoryObject {
|
|
50
50
|
data: CallRepository_Data;
|
|
51
|
-
account?: string;
|
|
52
|
-
witness?: GuardInfo_forCall;
|
|
51
|
+
account?: string | null;
|
|
52
|
+
witness?: GuardInfo_forCall | null;
|
|
53
53
|
}
|
|
54
54
|
export interface CallPersonalObject {
|
|
55
55
|
data: CallPersonal_Data;
|
|
56
|
-
account?: string;
|
|
56
|
+
account?: string | null;
|
|
57
57
|
}
|
|
58
58
|
export interface CallPermissionObject {
|
|
59
59
|
data: CallPermission_Data;
|
|
60
|
-
account?: string;
|
|
61
|
-
witness?: GuardInfo_forCall;
|
|
60
|
+
account?: string | null;
|
|
61
|
+
witness?: GuardInfo_forCall | null;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
export interface CallTransferPermissionObject {
|
|
65
65
|
data: CallObjectPermission_Data;
|
|
66
|
-
account?: string;
|
|
67
|
-
witness?: GuardInfo_forCall;
|
|
66
|
+
account?: string | null;
|
|
67
|
+
witness?: GuardInfo_forCall | null;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
export const call_demand_json = async (json: string) : Promise<string> => {
|
|
@@ -151,49 +151,49 @@ export const call_guard_json = async (json: string) : Promise<string> => {
|
|
|
151
151
|
|
|
152
152
|
export const call_demand = async (call:CallDemandObject) : Promise<CallResult> => {
|
|
153
153
|
const obj = new CallDemand(call.data);
|
|
154
|
-
return call_object(obj, call.account, call.witness)
|
|
154
|
+
return await call_object(obj, call.account, call.witness)
|
|
155
155
|
}
|
|
156
156
|
export const call_service = async (call:CallServiceObject) : Promise<CallResult> => {
|
|
157
157
|
const obj = new CallService(call.data);
|
|
158
|
-
return call_object(obj, call.account, call.witness)
|
|
158
|
+
return await call_object(obj, call.account, call.witness)
|
|
159
159
|
}
|
|
160
160
|
export const call_treasury = async (call:CallTreasuryObject) : Promise<CallResult> => {
|
|
161
161
|
const obj = new CallTreasury(call.data);
|
|
162
|
-
return call_object(obj, call.account, call.witness)
|
|
162
|
+
return await call_object(obj, call.account, call.witness)
|
|
163
163
|
}
|
|
164
164
|
export const call_repository = async (call:CallRepositoryObject) : Promise<CallResult> => {
|
|
165
165
|
const obj = new CallRepository(call.data);
|
|
166
|
-
return call_object(obj, call.account, call.witness)
|
|
166
|
+
return await call_object(obj, call.account, call.witness)
|
|
167
167
|
}
|
|
168
168
|
export const call_guard = async (call:CallGuardObject) : Promise<CallResult> => {
|
|
169
169
|
const obj = new CallGuard(call.data);
|
|
170
|
-
return call_object(obj, call.account)
|
|
170
|
+
return await call_object(obj, call.account)
|
|
171
171
|
}
|
|
172
172
|
export const call_machine = async (call:CallMachineObject) : Promise<CallResult> => {
|
|
173
173
|
const obj = new CallMachine(call.data);
|
|
174
|
-
return call_object(obj, call.account, call.witness)
|
|
174
|
+
return await call_object(obj, call.account, call.witness)
|
|
175
175
|
}
|
|
176
176
|
export const call_personal = async (call:CallPersonalObject) : Promise<CallResult> => {
|
|
177
177
|
const obj = new CallPersonal(call.data);
|
|
178
|
-
return call_object(obj, call.account);
|
|
178
|
+
return await call_object(obj, call.account);
|
|
179
179
|
}
|
|
180
180
|
export const call_permission = async (call:CallPermissionObject) : Promise<CallResult> => {
|
|
181
181
|
const obj = new CallPermission(call.data);
|
|
182
|
-
return call_object(obj, call.account, call.witness)
|
|
182
|
+
return await call_object(obj, call.account, call.witness)
|
|
183
183
|
}
|
|
184
184
|
export const call_transfer_permission = async (call:CallTransferPermissionObject) : Promise<CallResult> => {
|
|
185
185
|
const obj = new CallObjectPermission(call.data);
|
|
186
|
-
return call_object(obj, call.account, call.witness)
|
|
186
|
+
return await call_object(obj, call.account, call.witness)
|
|
187
187
|
}
|
|
188
188
|
export const call_arbitration = async (call:CallArbitrationObject) : Promise<CallResult> => {
|
|
189
189
|
const obj = new CallArbitration(call.data);
|
|
190
|
-
return call_object(obj, call.account, call.witness)
|
|
190
|
+
return await call_object(obj, call.account, call.witness)
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
const call_object = async (object: CallBase, account?: string, witness?: GuardInfo_forCall) : Promise<CallResult> => {
|
|
193
|
+
const call_object = async (object: CallBase, account?: string | null, witness?: GuardInfo_forCall | null) : Promise<CallResult> => {
|
|
194
194
|
if (witness) {
|
|
195
|
-
return object.call_with_witness(witness, account);
|
|
195
|
+
return await object.call_with_witness(witness, account ?? undefined);
|
|
196
196
|
} else {
|
|
197
|
-
return object.call(account);
|
|
197
|
+
return await object.call(account ?? undefined);
|
|
198
198
|
}
|
|
199
199
|
}
|