wowok_agent 1.1.32 → 1.2.35
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/package.json +3 -2
- package/src/call/arbitration.ts +6 -6
- package/src/call/base.ts +46 -20
- package/src/{call.ts → call/call.ts} +12 -13
- package/src/call/demand.ts +4 -4
- package/src/call/guard.ts +1 -1
- package/src/call/machine.ts +7 -7
- package/src/call/object_permission.ts +1 -1
- package/src/call/permission.ts +1 -1
- package/src/call/personal.ts +31 -28
- package/src/call/repository.ts +2 -2
- package/src/call/service.ts +9 -9
- package/src/call/treasury.ts +4 -4
- package/src/common.ts +5 -0
- package/src/index.ts +7 -6
- package/src/local/account.ts +190 -0
- package/src/local/cache.ts +85 -0
- package/src/local/local.ts +223 -0
- package/src/{objects.ts → query/objects.ts} +141 -140
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/224.8c7bb16af6ae47714aa6.js +0 -1
- package/dist/336.4cb28633dc9218b49b85.js +0 -1
- package/dist/362.cdfb0b5c3d412961e0c0.js +0 -1
- package/dist/44.d4b76589f2a4654ef01b.js +0 -1
- package/dist/551.2402d9b3ed0665707ca8.js +0 -1
- package/dist/575.b942536e501c82b2cda8.js +0 -2
- package/dist/575.b942536e501c82b2cda8.js.LICENSE.txt +0 -1
- package/dist/596.6c8ebd4c514cbdfa2a34.js +0 -1
- package/dist/640.3f4f1cf1d0c2aa400891.js +0 -1
- package/dist/647.be875595c33c3b69f28b.js +0 -1
- package/dist/734.6489b6fe957095e872d4.js +0 -1
- package/dist/754.08615c9ea559d8e0f3c1.js +0 -1
- package/dist/982.04b0b44954a391ce9dc8.js +0 -1
- package/dist/account.d.ts +0 -37
- package/dist/account.d.ts.map +0 -1
- package/dist/account.js +0 -273
- package/dist/account.js.map +0 -1
- package/dist/cache.d.ts +0 -46
- package/dist/cache.d.ts.map +0 -1
- package/dist/cache.js +0 -61
- package/dist/cache.js.map +0 -1
- package/dist/call/arbitration.d.ts +0 -69
- package/dist/call/arbitration.d.ts.map +0 -1
- package/dist/call/arbitration.js +0 -186
- package/dist/call/arbitration.js.map +0 -1
- package/dist/call/base.d.ts +0 -32
- package/dist/call/base.d.ts.map +0 -1
- package/dist/call/base.js +0 -129
- package/dist/call/base.js.map +0 -1
- package/dist/call/demand.d.ts +0 -55
- package/dist/call/demand.d.ts.map +0 -1
- package/dist/call/demand.js +0 -135
- package/dist/call/demand.js.map +0 -1
- package/dist/call/guard.d.ts +0 -42
- package/dist/call/guard.d.ts.map +0 -1
- package/dist/call/guard.js +0 -253
- package/dist/call/guard.js.map +0 -1
- package/dist/call/machine.d.ts +0 -109
- package/dist/call/machine.d.ts.map +0 -1
- package/dist/call/machine.js +0 -213
- package/dist/call/machine.js.map +0 -1
- package/dist/call/object_permission.d.ts +0 -13
- package/dist/call/object_permission.d.ts.map +0 -1
- package/dist/call/object_permission.js +0 -49
- package/dist/call/object_permission.js.map +0 -1
- package/dist/call/permission.d.ts +0 -49
- package/dist/call/permission.d.ts.map +0 -1
- package/dist/call/permission.js +0 -98
- package/dist/call/permission.js.map +0 -1
- package/dist/call/personal.d.ts +0 -42
- package/dist/call/personal.d.ts.map +0 -1
- package/dist/call/personal.js +0 -60
- package/dist/call/personal.js.map +0 -1
- package/dist/call/repository.d.ts +0 -52
- package/dist/call/repository.d.ts.map +0 -1
- package/dist/call/repository.js +0 -125
- package/dist/call/repository.js.map +0 -1
- package/dist/call/service.d.ts +0 -134
- package/dist/call/service.d.ts.map +0 -1
- package/dist/call/service.js +0 -340
- package/dist/call/service.js.map +0 -1
- package/dist/call/treasury.d.ts +0 -53
- package/dist/call/treasury.d.ts.map +0 -1
- package/dist/call/treasury.js +0 -161
- package/dist/call/treasury.js.map +0 -1
- package/dist/call.d.ts +0 -86
- package/dist/call.d.ts.map +0 -1
- package/dist/call.js +0 -153
- package/dist/call.js.map +0 -1
- package/dist/events.d.ts +0 -63
- package/dist/events.d.ts.map +0 -1
- package/dist/events.js +0 -78
- package/dist/events.js.map +0 -1
- package/dist/index.d.ts +0 -19
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -19
- package/dist/index.js.map +0 -1
- package/dist/main-0711d318.4e221b93fc57efdd1b61.js +0 -1
- package/dist/main-1452f717.34be30a10e23702025f7.js +0 -1
- package/dist/main-15378d78.5f4ccc2dfd8d2791e9fa.js +0 -1
- package/dist/main-1b43c5c7.cce1d8be7a794cf60240.js +0 -1
- package/dist/main-2c18dc4b.f9b2329ac7ae04a1d6cf.js +0 -1
- package/dist/main-43dd7041.8a5063bbd73a527bcbdb.js +0 -1
- package/dist/main-939e5c9d.8300452a84a790771a4c.js +0 -1
- package/dist/main-9aa9c523.396748dc5e9a97671d27.js +0 -1
- package/dist/main-a6439106.ee206d583e017867e658.js +0 -1
- package/dist/main-ba7df65e.3144adf6db4d01021234.js +0 -1
- package/dist/main-e25e1b58.6b1d824c5efc6ffa50a8.js +0 -1
- package/dist/main-eaf887a5.daca2cbb896798678367.js +0 -1
- package/dist/objects.d.ts +0 -341
- package/dist/objects.d.ts.map +0 -1
- package/dist/objects.js +0 -445
- package/dist/objects.js.map +0 -1
- package/dist/permission.d.ts +0 -12
- package/dist/permission.d.ts.map +0 -1
- package/dist/permission.js +0 -41
- package/dist/permission.js.map +0 -1
- package/dist/private_info.d.ts +0 -26
- package/dist/private_info.d.ts.map +0 -1
- package/dist/private_info.js +0 -243
- package/dist/private_info.js.map +0 -1
- package/src/account.ts +0 -280
- package/src/cache.ts +0 -82
- package/src/private_info.ts +0 -217
- /package/src/{events.ts → query/events.ts} +0 -0
- /package/src/{permission.ts → query/permission.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wowok_agent",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.35",
|
|
4
4
|
"description": "Create, collaborate, and transact on your own terms with the AI-driven web3 collaboration protocol.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"typescript": "^5.8.2"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"
|
|
56
|
+
"level": "^9.0.0",
|
|
57
|
+
"wowok": "^1.6.90"
|
|
57
58
|
}
|
|
58
59
|
}
|
package/src/call/arbitration.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TransactionBlock, IsValidArgType, PassportObject, IsValidAddress, Errors, ERROR, Permission, PermissionIndex,
|
|
2
2
|
PermissionIndexType, Treasury, Arbitration, VotingGuard, WithdrawFee, ArbObject,
|
|
3
3
|
} from 'wowok';
|
|
4
|
-
import { query_objects, ObjectArbitration, } from '../objects.js';
|
|
4
|
+
import { query_objects, ObjectArbitration, } from '../query/objects.js';
|
|
5
5
|
import { CallBase, CallResult, Namedbject} from "./base.js";
|
|
6
|
-
import { Account } from '../account.js';
|
|
6
|
+
import { Account } from '../local/account.js';
|
|
7
7
|
export interface DisputeData {
|
|
8
8
|
order: string,
|
|
9
9
|
order_token_type: string,
|
|
@@ -180,7 +180,7 @@ export class CallArbitration extends CallBase {
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
if (arb_new) {
|
|
183
|
-
await this.new_with_mark(txb, obj?.arb_launch(arb_new), (this.data?.arb_new as any)?.namedNew, account);
|
|
183
|
+
await this.new_with_mark('Arb', txb, obj?.arb_launch(arb_new), (this.data?.arb_new as any)?.namedNew, account);
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
if (this.data?.voting_guard !== undefined) {
|
|
@@ -207,14 +207,14 @@ export class CallArbitration extends CallBase {
|
|
|
207
207
|
obj?.pause(this.data.bPaused, pst);
|
|
208
208
|
}
|
|
209
209
|
if (withdraw_treasury) {
|
|
210
|
-
await this.new_with_mark(txb, withdraw_treasury.launch(), (this.data?.fee_treasury as any)?.namedNew, account);
|
|
210
|
+
await this.new_with_mark('Treasury', txb, withdraw_treasury.launch(), (this.data?.fee_treasury as any)?.namedNew, account);
|
|
211
211
|
}
|
|
212
212
|
if (permission) {
|
|
213
|
-
await this.new_with_mark(txb, permission.launch(), (this.data?.permission as any)?.namedNew, account);
|
|
213
|
+
await this.new_with_mark('Permission', txb, permission.launch(), (this.data?.permission as any)?.namedNew, account);
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
if (!object_address) {
|
|
217
|
-
await this.new_with_mark(txb, obj.launch(), (this.data?.object as any)?.namedNew, account);
|
|
217
|
+
await this.new_with_mark('Arbitration', txb, obj.launch(), (this.data?.object as any)?.namedNew, account);
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
}
|
package/src/call/base.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Entity, Resource, TxbAddress, array_unique, TagName, ResourceObject, PassportObject, Errors, ERROR, Permission,
|
|
4
4
|
PermissionIndexType, GuardParser, Passport, WitnessFill, CallResponse, TransactionBlock
|
|
5
5
|
} from 'wowok';
|
|
6
|
-
import { query_permission } from '../permission.js';
|
|
7
|
-
import { Account } from '../account.js';
|
|
8
|
-
import { ObjectBase,
|
|
6
|
+
import { query_permission } from '../query/permission.js';
|
|
7
|
+
import { Account } from '../local/account.js';
|
|
8
|
+
import { ObjectBase, ObjectBaseType, query_personal, raw2type} from '../query/objects.js';
|
|
9
|
+
import { LocalMark } from '../local/local.js';
|
|
9
10
|
|
|
10
11
|
export interface Namedbject {
|
|
11
|
-
name?: string;
|
|
12
|
+
name?: string;
|
|
12
13
|
tags?: string[];
|
|
14
|
+
onChain?: boolean; // true: onchain, false: local(default)
|
|
15
|
+
// true: use address as the name if the name exist; otherwise, use this name and change the original name to its address
|
|
16
|
+
useAddressIfNameExist?: boolean;
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
export interface AddressMark {
|
|
@@ -44,7 +48,9 @@ export function ResponseData(response: CallResponse | undefined) : ResponseData[
|
|
|
44
48
|
|
|
45
49
|
export class CallBase {
|
|
46
50
|
// operation implementation for a call
|
|
47
|
-
resouceObject:ResourceObject | undefined;
|
|
51
|
+
private resouceObject:ResourceObject | undefined;
|
|
52
|
+
private traceMarkNew = new Map<ObjectBaseType, Namedbject>();
|
|
53
|
+
|
|
48
54
|
protected async operate(txb:TransactionBlock, passport?:PassportObject, account?:string) {};
|
|
49
55
|
constructor () {}
|
|
50
56
|
// return WitnessFill to resolve filling witness, and than 'call_with_witness' to complete the call;
|
|
@@ -76,7 +82,7 @@ export class CallBase {
|
|
|
76
82
|
var guards : string[] = [];
|
|
77
83
|
|
|
78
84
|
if (permIndex.length > 0 || checkOwner) {
|
|
79
|
-
const addr = await
|
|
85
|
+
const addr = await LocalMark.Instance().get_account(account);
|
|
80
86
|
if (!addr) ERROR(Errors.InvalidParam, 'check_permission_and_call: account invalid');
|
|
81
87
|
|
|
82
88
|
const p = await query_permission({permission_object:permission, address:addr!});
|
|
@@ -120,13 +126,22 @@ export class CallBase {
|
|
|
120
126
|
return await this.sign_and_commit(txb, account);
|
|
121
127
|
}
|
|
122
128
|
|
|
123
|
-
protected async new_with_mark(txb:TransactionBlock, object:TxbAddress, named_new?:Namedbject, account?:string, innerTags:string[]=[TagName.Launch]) {
|
|
129
|
+
protected async new_with_mark(type:ObjectBaseType, txb:TransactionBlock, object:TxbAddress, named_new?:Namedbject, account?:string, innerTags:string[]=[TagName.Launch]) {
|
|
124
130
|
const tags = named_new?.tags ? array_unique([...named_new.tags, ...innerTags]) : array_unique([...innerTags]);
|
|
131
|
+
if (!named_new?.onChain) {
|
|
132
|
+
if (named_new) {
|
|
133
|
+
named_new.tags = tags;
|
|
134
|
+
this.traceMarkNew.set(type, named_new)
|
|
135
|
+
}
|
|
136
|
+
return ;
|
|
137
|
+
} ;
|
|
125
138
|
|
|
139
|
+
// onchain mark
|
|
126
140
|
if (!this.resouceObject) {
|
|
127
|
-
const addr = await
|
|
141
|
+
const addr = await LocalMark.Instance().get_account(account);
|
|
142
|
+
|
|
128
143
|
if (addr) {
|
|
129
|
-
const r = await
|
|
144
|
+
const r = await query_personal({address:addr}); //@ use cache
|
|
130
145
|
if (!r?.mark_object) {
|
|
131
146
|
this.resouceObject = Entity.From(txb).create_resource2(); // new
|
|
132
147
|
Resource.From(txb, this.resouceObject).add(object, tags, named_new?.name);
|
|
@@ -139,21 +154,32 @@ export class CallBase {
|
|
|
139
154
|
} else {
|
|
140
155
|
Resource.From(txb, this.resouceObject).add(object, tags, named_new?.name);
|
|
141
156
|
}
|
|
157
|
+
|
|
142
158
|
}
|
|
143
159
|
|
|
144
|
-
protected async sign_and_commit(txb: TransactionBlock,
|
|
145
|
-
const pair = await Account.Instance().get_pair(account, true);
|
|
146
|
-
if (!pair) ERROR(Errors.Fail, 'account invalid')
|
|
147
|
-
|
|
160
|
+
protected async sign_and_commit(txb: TransactionBlock, address?: string) : Promise<CallResponse> {
|
|
148
161
|
if (this.resouceObject) {
|
|
149
162
|
Resource.From(txb, this.resouceObject).launch(); //@ resource launch, if created.
|
|
150
163
|
this.resouceObject = undefined;
|
|
151
164
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
165
|
+
|
|
166
|
+
const r = await Account.Instance().sign_and_commit(txb, address);
|
|
167
|
+
if (!r) {
|
|
168
|
+
ERROR(Errors.Fail, 'sign and commit failed');
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// save the mark locally, anyway
|
|
172
|
+
const res = ResponseData(r);
|
|
173
|
+
res.forEach(v => {
|
|
174
|
+
if (v.type && v.change === 'created') {
|
|
175
|
+
const namedNew = this.traceMarkNew.get(v.type);
|
|
176
|
+
if (namedNew) {
|
|
177
|
+
LocalMark.Instance().put(namedNew.name,
|
|
178
|
+
{object:v.object, tags:namedNew?.tags},
|
|
179
|
+
namedNew?.useAddressIfNameExist);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
})
|
|
183
|
+
return r
|
|
158
184
|
}
|
|
159
185
|
}
|
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
* Restrictive prioritization, such as setting a deposit first and setting a deposit guard later (only subsequent deposits are affected).
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { CallArbitration, CallArbitration_Data } from "./
|
|
8
|
-
import { CallDemand, CallDemand_Data } from "./
|
|
9
|
-
import { CallMachine, CallMachine_Data } from "./
|
|
10
|
-
import { CallPermission, CallPermission_Data } from "./
|
|
11
|
-
import { CallPersonal, CallPersonal_Data } from "./
|
|
12
|
-
import { CallRepository, CallRepository_Data } from "./
|
|
13
|
-
import { CallService, CallService_Data } from "./
|
|
14
|
-
import { CallTreasury, CallTreasury_Data } from "./
|
|
15
|
-
import { CallBase, CallResult, GuardInfo_forCall } from "./
|
|
16
|
-
import { CallGuard, CallGuard_Data } from "./
|
|
17
|
-
import { CallObjectPermission, CallObjectPermission_Data } from "./
|
|
7
|
+
import { CallArbitration, CallArbitration_Data } from "./arbitration.js";
|
|
8
|
+
import { CallDemand, CallDemand_Data } from "./demand.js";
|
|
9
|
+
import { CallMachine, CallMachine_Data } from "./machine.js";
|
|
10
|
+
import { CallPermission, CallPermission_Data } from "./permission.js";
|
|
11
|
+
import { CallPersonal, CallPersonal_Data } from "./personal.js";
|
|
12
|
+
import { CallRepository, CallRepository_Data } from "./repository.js";
|
|
13
|
+
import { CallService, CallService_Data } from "./service.js";
|
|
14
|
+
import { CallTreasury, CallTreasury_Data } from "./treasury.js";
|
|
15
|
+
import { CallBase, CallResult, GuardInfo_forCall } from "./base.js";
|
|
16
|
+
import { CallGuard, CallGuard_Data } from "./guard.js";
|
|
17
|
+
import { CallObjectPermission, CallObjectPermission_Data } from "./object_permission.js";
|
|
18
18
|
|
|
19
19
|
export interface CallDemandObject {
|
|
20
20
|
data: CallDemand_Data;
|
|
@@ -55,7 +55,6 @@ export interface CallRepositoryObject {
|
|
|
55
55
|
export interface CallPersonalObject {
|
|
56
56
|
data: CallPersonal_Data;
|
|
57
57
|
account?: string;
|
|
58
|
-
witness?: GuardInfo_forCall;
|
|
59
58
|
}
|
|
60
59
|
export interface CallPermissionObject {
|
|
61
60
|
data: CallPermission_Data;
|
|
@@ -177,7 +176,7 @@ export const call_machine = async (call:CallMachineObject) : Promise<CallResult>
|
|
|
177
176
|
}
|
|
178
177
|
export const call_personal = async (call:CallPersonalObject) : Promise<CallResult> => {
|
|
179
178
|
const obj = new CallPersonal(call.data);
|
|
180
|
-
return call_object(obj, call.account
|
|
179
|
+
return call_object(obj, call.account);
|
|
181
180
|
}
|
|
182
181
|
export const call_permission = async (call:CallPermissionObject) : Promise<CallResult> => {
|
|
183
182
|
const obj = new CallPermission(call.data);
|
package/src/call/demand.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TransactionBlock, IsValidArgType, IsValidCoinType, Resource, ResourceObject } from 'wowok';
|
|
2
2
|
import { PassportObject, IsValidAddress, Errors, ERROR, Permission, PermissionIndex,
|
|
3
3
|
PermissionIndexType, Demand, } from 'wowok';
|
|
4
|
-
import { query_objects, ObjectDemand } from '../objects.js';
|
|
4
|
+
import { query_objects, ObjectDemand } from '../query/objects.js';
|
|
5
5
|
import { CallBase, CallResult, Namedbject } from "./base.js";
|
|
6
|
-
import { Account } from '../account.js';
|
|
6
|
+
import { Account } from '../local/account.js';
|
|
7
7
|
|
|
8
8
|
/// The execution priority is determined by the order in which the object attributes are arranged
|
|
9
9
|
export interface CallDemand_Data {
|
|
@@ -136,10 +136,10 @@ export class CallDemand extends CallBase {
|
|
|
136
136
|
obj?.set_guard(this.data.guard.address, this.data.guard?.service_id_in_guard ?? undefined, pst)
|
|
137
137
|
}
|
|
138
138
|
if (permission) {
|
|
139
|
-
await this.new_with_mark(txb, permission.launch(), (this.data?.permission as any)?.namedNew, account);
|
|
139
|
+
await this.new_with_mark('Permission', txb, permission.launch(), (this.data?.permission as any)?.namedNew, account);
|
|
140
140
|
}
|
|
141
141
|
if (!this.data.object) {
|
|
142
|
-
await this.new_with_mark(txb, obj.launch(), (this.data?.object as any)?.namedNew, account);
|
|
142
|
+
await this.new_with_mark('Demand', txb, obj.launch(), (this.data?.object as any)?.namedNew, account);
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
}
|
package/src/call/guard.ts
CHANGED
|
@@ -91,7 +91,7 @@ export class CallGuard extends CallBase {
|
|
|
91
91
|
target:Protocol.Instance().guardFn("create") as FnCallType,
|
|
92
92
|
arguments:[txb.object(obj)]
|
|
93
93
|
});
|
|
94
|
-
await this.new_with_mark(txb, addr, this.data?.namedNew, account);
|
|
94
|
+
await this.new_with_mark('Guard', txb, addr, this.data?.namedNew, account);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
|
package/src/call/machine.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { PassportObject, IsValidAddress, Errors, ERROR, Permission, PermissionIn
|
|
|
3
3
|
ProgressObject,
|
|
4
4
|
} from 'wowok';
|
|
5
5
|
import { CallBase, CallResult, Namedbject } from "./base.js";
|
|
6
|
-
import { Account } from '../account.js';
|
|
6
|
+
import { Account } from '../local/account.js';
|
|
7
7
|
|
|
8
8
|
/// The execution priority is determined by the order in which the object attributes are arranged
|
|
9
9
|
export interface CallMachine_Data {
|
|
@@ -87,7 +87,7 @@ export class CallMachine extends CallBase { //@ todo self-owned node operate
|
|
|
87
87
|
guards.push(this.data?.progress_next?.guard)
|
|
88
88
|
} else if (this.data?.object && IsValidAddress(object_address)) { // fetch guard
|
|
89
89
|
const guard = await Progress.QueryForwardGuard(this.data?.progress_next.progress, object_address,
|
|
90
|
-
await Account.Instance().
|
|
90
|
+
await Account.Instance().default() ?? '0xe386bb9e01b3528b75f3751ad8a1e418b207ad979fea364087deef5250a73d3f',
|
|
91
91
|
this.data.progress_next.operation.next_node_name, this.data.progress_next.operation.forward);
|
|
92
92
|
if (guard) {
|
|
93
93
|
guards.push(guard)
|
|
@@ -220,7 +220,7 @@ export class CallMachine extends CallBase { //@ todo self-owned node operate
|
|
|
220
220
|
}
|
|
221
221
|
const addr = new_progress?.launch();
|
|
222
222
|
if (addr) {
|
|
223
|
-
await this.new_with_mark(txb, addr, this.data?.progress_new?.namedNew, account);
|
|
223
|
+
await this.new_with_mark('Progress', txb, addr, this.data?.progress_new?.namedNew, account);
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
if (this.data?.progress_next !== undefined) {
|
|
@@ -229,14 +229,14 @@ export class CallMachine extends CallBase { //@ todo self-owned node operate
|
|
|
229
229
|
if (this.data?.bPaused !== undefined) {
|
|
230
230
|
obj?.pause(this.data.bPaused, pst)
|
|
231
231
|
}
|
|
232
|
-
if (this.data?.clone_new !== undefined &&
|
|
233
|
-
await this.new_with_mark(txb, obj?.clone(true, pst) as TxbAddress, (this.data?.clone_new as any)?.namedNew, account);
|
|
232
|
+
if (this.data?.clone_new !== undefined && object_address) {
|
|
233
|
+
await this.new_with_mark('Machine', txb, obj?.clone(true, pst) as TxbAddress, (this.data?.clone_new as any)?.namedNew, account);
|
|
234
234
|
}
|
|
235
235
|
if (permission) {
|
|
236
|
-
await this.new_with_mark(txb, permission.launch(), (this.data?.permission as any)?.namedNew, account);
|
|
236
|
+
await this.new_with_mark('Permission', txb, permission.launch(), (this.data?.permission as any)?.namedNew, account);
|
|
237
237
|
}
|
|
238
238
|
if (!object_address) {
|
|
239
|
-
await this.new_with_mark(txb, obj.launch(), (this.data?.object as any)?.namedNew, account);
|
|
239
|
+
await this.new_with_mark('Machine', txb, obj.launch(), (this.data?.object as any)?.namedNew, account);
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CallBase, CallResult } from "./base.js";
|
|
2
2
|
import { TransactionBlock, PassportObject, IsValidAddress, Errors, ERROR, Demand, Machine, Service, Treasury, Arbitration, Repository} from 'wowok';
|
|
3
|
-
import { ObjectArbitration, ObjectDemand, ObjectMachine, ObjectRepository, ObjectService, ObjectTreasury, query_objects } from "../objects.js";
|
|
3
|
+
import { ObjectArbitration, ObjectDemand, ObjectMachine, ObjectRepository, ObjectService, ObjectTreasury, query_objects } from "../query/objects.js";
|
|
4
4
|
|
|
5
5
|
export interface CallObjectPermission_Data {
|
|
6
6
|
objects: string[];
|
package/src/call/permission.ts
CHANGED
|
@@ -107,7 +107,7 @@ export class CallPermission extends CallBase {
|
|
|
107
107
|
obj?.change_owner(this.data.builder);
|
|
108
108
|
}
|
|
109
109
|
if (!object_address) {
|
|
110
|
-
await this.new_with_mark(txb, obj.launch(), (this.data?.object as any)?.namedNew, account);
|
|
110
|
+
await this.new_with_mark('Permission', txb, obj.launch(), (this.data?.object as any)?.namedNew, account);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
}
|
package/src/call/personal.ts
CHANGED
|
@@ -3,10 +3,10 @@ import { CallBase, CallResult, Namedbject } from "./base.js";
|
|
|
3
3
|
|
|
4
4
|
/// The execution priority is determined by the order in which the object attributes are arranged
|
|
5
5
|
export interface CallPersonal_Data {
|
|
6
|
-
|
|
6
|
+
mark_object?: {address:string} | {namedNew?: Namedbject}; // undefined or {named_new...} for creating a new personal resource object ; // undefined for creating personal resource object
|
|
7
7
|
information?: Entity_Info;
|
|
8
|
-
mark?: {op:'add or set'; data:{address:string; name?:string; tags
|
|
9
|
-
| {op:'remove'; data:{address:string; tags
|
|
8
|
+
mark?: {op:'add or set'; data:{address:string; name?:string; tags?:string[]}[]}
|
|
9
|
+
| {op:'remove'; data:{address:string; tags?:string[]}[]}
|
|
10
10
|
| {op:'removeall'; addresses:string[]}
|
|
11
11
|
| {op:'transfer'; address: string}
|
|
12
12
|
| {op:'replace'; address: string}
|
|
@@ -24,8 +24,16 @@ export class CallPersonal extends CallBase {
|
|
|
24
24
|
}
|
|
25
25
|
protected async operate (txb:TransactionBlock, passport?:PassportObject, account?: string) {
|
|
26
26
|
let obj : Resource | undefined ; let entity: Entity = Entity.From(txb);
|
|
27
|
-
const object_address = (this.data?.object as any)?.address;
|
|
28
27
|
|
|
28
|
+
if (this.data?.information !== undefined ) {
|
|
29
|
+
entity.update(this.data.information)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (this.data?.mark === undefined) {
|
|
33
|
+
return ;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const object_address = (this.data?.mark_object as any)?.address;
|
|
29
37
|
if (!object_address || !IsValidAddress(object_address)) {
|
|
30
38
|
obj = Resource.From(txb, entity.create_resource2());
|
|
31
39
|
} else {
|
|
@@ -37,30 +45,25 @@ export class CallPersonal extends CallBase {
|
|
|
37
45
|
return ; //@ return
|
|
38
46
|
}
|
|
39
47
|
|
|
40
|
-
if (this.data?.information !== undefined ) {
|
|
41
|
-
entity.update(this.data.information)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
48
|
if (obj && obj?.get_object()) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
49
|
+
switch(this.data.mark.op) {
|
|
50
|
+
case 'add or set':
|
|
51
|
+
this.data.mark.data.forEach(v => {
|
|
52
|
+
obj?.add(v.address, v.tags ?? [], v.name)
|
|
53
|
+
})
|
|
54
|
+
break;
|
|
55
|
+
case 'remove':
|
|
56
|
+
this.data.mark.data.forEach(v => {
|
|
57
|
+
obj?.remove(v.address, v.tags ?? [])
|
|
58
|
+
})
|
|
59
|
+
break;
|
|
60
|
+
case 'removeall':
|
|
61
|
+
this.data.mark.addresses.forEach(v => {
|
|
62
|
+
obj?.removeall(v)
|
|
63
|
+
})
|
|
64
|
+
break;
|
|
63
65
|
}
|
|
66
|
+
|
|
64
67
|
if (this.data?.mark?.op === 'transfer' && obj && IsValidAddress(this.data.mark.address)) {
|
|
65
68
|
entity.transfer_resource(obj, this.data.mark.address);
|
|
66
69
|
}
|
|
@@ -68,8 +71,8 @@ export class CallPersonal extends CallBase {
|
|
|
68
71
|
entity.use_resource(Resource.From(txb, this.data.mark.address));
|
|
69
72
|
}
|
|
70
73
|
|
|
71
|
-
if (!object_address
|
|
72
|
-
await this.new_with_mark(txb, obj.launch(), (this.data?.
|
|
74
|
+
if (!object_address) {
|
|
75
|
+
await this.new_with_mark('PersonalMark', txb, obj.launch(), (this.data?.mark_object as any)?.namedNew, account);
|
|
73
76
|
}
|
|
74
77
|
}
|
|
75
78
|
}
|
package/src/call/repository.ts
CHANGED
|
@@ -132,10 +132,10 @@ export class CallRepository extends CallBase {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
if (permission) {
|
|
135
|
-
await this.new_with_mark(txb, permission.launch(), (this.data?.permission as any)?.namedNew, account);
|
|
135
|
+
await this.new_with_mark('Permission', txb, permission.launch(), (this.data?.permission as any)?.namedNew, account);
|
|
136
136
|
}
|
|
137
137
|
if (!this.data.object) {
|
|
138
|
-
await this.new_with_mark(txb, obj.launch(), (this.data?.object as any)?.namedNew, account);
|
|
138
|
+
await this.new_with_mark('Repository', txb, obj.launch(), (this.data?.object as any)?.namedNew, account);
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
};
|
package/src/call/service.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { TransactionBlock, IsValidArgType, TxbAddress, TagName, PassportObject,
|
|
|
2
2
|
PermissionIndex, PermissionIndexType, BuyRequiredEnum, Customer_RequiredInfo, DicountDispatch, Service, Service_Buy,
|
|
3
3
|
Service_Guard_Percent, Service_Sale, WithdrawPayee, Treasury, OrderResult,
|
|
4
4
|
} from 'wowok';
|
|
5
|
-
import { query_objects, ObjectService } from '../objects.js';
|
|
5
|
+
import { query_objects, ObjectService } from '../query/objects.js';
|
|
6
6
|
import { CallBase, CallResult, Namedbject } from "./base.js";
|
|
7
|
-
import { Account } from '../account.js';
|
|
7
|
+
import { Account } from '../local/account.js';
|
|
8
8
|
|
|
9
9
|
/// The execution priority is determined by the order in which the object attributes are arranged
|
|
10
10
|
export interface CallService_Data {
|
|
@@ -351,9 +351,9 @@ export class CallService extends CallBase {
|
|
|
351
351
|
|
|
352
352
|
if (order_new && this?.data?.order_new) {
|
|
353
353
|
const buy = obj.order_launch(order_new);
|
|
354
|
-
await this.new_with_mark(txb, buy.order, (this.data?.order_new as any)?.namedNewOrder, account, [TagName.Launch, TagName.Order]);
|
|
354
|
+
await this.new_with_mark('Order', txb, buy.order, (this.data?.order_new as any)?.namedNewOrder, account, [TagName.Launch, TagName.Order]);
|
|
355
355
|
if (buy?.progress) {
|
|
356
|
-
await this.new_with_mark(txb, buy.progress, (this.data?.order_new as any)?.namedNewProgress, account, [TagName.Launch]);
|
|
356
|
+
await this.new_with_mark('Progress', txb, buy.progress, (this.data?.order_new as any)?.namedNewProgress, account, [TagName.Launch]);
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
359
|
|
|
@@ -363,17 +363,17 @@ export class CallService extends CallBase {
|
|
|
363
363
|
if (this.data?.bPaused !== undefined) {
|
|
364
364
|
obj?.pause(this.data.bPaused, pst)
|
|
365
365
|
}
|
|
366
|
-
if (this.data?.clone_new !== undefined &&
|
|
367
|
-
await this.new_with_mark(txb, obj.clone(this.data.clone_new?.token_type_new, true, pst) as TxbAddress, (this.data?.clone_new as any)?.namedNew, account);
|
|
366
|
+
if (this.data?.clone_new !== undefined && object_address) {
|
|
367
|
+
await this.new_with_mark('Service', txb, obj.clone(this.data.clone_new?.token_type_new, true, pst) as TxbAddress, (this.data?.clone_new as any)?.namedNew, account);
|
|
368
368
|
}
|
|
369
369
|
if (payee) {
|
|
370
|
-
await this.new_with_mark(txb, payee.launch(), (this.data?.payee_treasury as any)?.namedNew, account);
|
|
370
|
+
await this.new_with_mark('Treasury', txb, payee.launch(), (this.data?.payee_treasury as any)?.namedNew, account);
|
|
371
371
|
}
|
|
372
372
|
if (permission) {
|
|
373
|
-
await this.new_with_mark(txb, permission.launch(), (this.data?.permission as any)?.namedNew, account);
|
|
373
|
+
await this.new_with_mark('Permission', txb, permission.launch(), (this.data?.permission as any)?.namedNew, account);
|
|
374
374
|
}
|
|
375
375
|
if (!object_address) {
|
|
376
|
-
await this.new_with_mark(txb, obj.launch(), (this.data?.object as any)?.namedNew, account);
|
|
376
|
+
await this.new_with_mark('Service', txb, obj.launch(), (this.data?.object as any)?.namedNew, account);
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
379
|
}
|
package/src/call/treasury.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TransactionBlock, IsValidArgType, PassportObject, IsValidAddress, Errors, ERROR, Permission, PermissionIndex,
|
|
2
2
|
PermissionIndexType, Treasury, Treasury_WithdrawMode, WithdrawParam,
|
|
3
3
|
} from 'wowok';
|
|
4
|
-
import { query_objects, ObjectTreasury } from '../objects.js';
|
|
4
|
+
import { query_objects, ObjectTreasury } from '../query/objects.js';
|
|
5
5
|
import { CallBase, CallResult, Namedbject } from "./base.js";
|
|
6
|
-
import { Account } from '../account.js';
|
|
6
|
+
import { Account } from '../local/account.js';
|
|
7
7
|
|
|
8
8
|
/// The execution priority is determined by the order in which the object attributes are arranged
|
|
9
9
|
export interface CallTreasury_Data {
|
|
@@ -165,10 +165,10 @@ export class CallTreasury extends CallBase {
|
|
|
165
165
|
obj?.set_withdraw_mode(this.data.withdraw_mode, pst)
|
|
166
166
|
}
|
|
167
167
|
if (permission) {
|
|
168
|
-
await this.new_with_mark(txb, permission.launch(), (this.data?.permission as any)?.namedNew, account);
|
|
168
|
+
await this.new_with_mark('Permission', txb, permission.launch(), (this.data?.permission as any)?.namedNew, account);
|
|
169
169
|
}
|
|
170
170
|
if (!object_address) {
|
|
171
|
-
await this.new_with_mark(txb, obj.launch(), (this.data?.object as any)?.namedNew, account);
|
|
171
|
+
await this.new_with_mark('Treasury', txb, obj.launch(), (this.data?.object as any)?.namedNew, account);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
}
|
package/src/common.ts
ADDED
package/src/index.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export * from './objects.js'
|
|
2
|
-
export * from './permission.js'
|
|
3
|
-
export * from './events.js'
|
|
4
|
-
export * from './cache.js'
|
|
1
|
+
export * from './query/objects.js'
|
|
2
|
+
export * from './query/permission.js'
|
|
3
|
+
export * from './query/events.js'
|
|
5
4
|
export * from './call/base.js'
|
|
6
5
|
export * from './call/permission.js'
|
|
7
6
|
export * from './call/arbitration.js'
|
|
@@ -13,6 +12,8 @@ export * from './call/repository.js'
|
|
|
13
12
|
export * from './call/service.js'
|
|
14
13
|
export * from './call/guard.js'
|
|
15
14
|
export * from './call/personal.js'
|
|
16
|
-
export * from './
|
|
17
|
-
export * from './
|
|
15
|
+
export * from './call/call.js'
|
|
16
|
+
export * from './local/account.js'
|
|
17
|
+
export * from './local/cache.js'
|
|
18
|
+
export * from './local/local.js'
|
|
18
19
|
export * as WOWOK from 'wowok'
|