wowok_agent 1.1.33 → 1.2.37
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 +7 -7
- package/src/call/base.ts +46 -20
- package/src/{call.ts → call/call.ts} +12 -13
- package/src/call/demand.ts +5 -5
- package/src/call/guard.ts +1 -1
- package/src/call/machine.ts +7 -7
- package/src/call/object_permission.ts +2 -2
- package/src/call/permission.ts +1 -1
- package/src/call/personal.ts +2 -2
- package/src/call/repository.ts +2 -2
- package/src/call/service.ts +10 -10
- package/src/call/treasury.ts +6 -6
- package/src/common.ts +5 -0
- package/src/index.ts +9 -6
- package/src/local/account.ts +208 -0
- package/src/local/cache.ts +85 -0
- package/src/local/index.ts +140 -0
- package/src/local/local.ts +252 -0
- package/src/{objects.ts → query/objects.ts} +145 -143
- 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 -61
- 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 -85
- 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.37",
|
|
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,
|
|
@@ -86,7 +86,7 @@ export class CallArbitration extends CallBase {
|
|
|
86
86
|
}
|
|
87
87
|
} else {
|
|
88
88
|
if (!obj) {
|
|
89
|
-
const r = await query_objects({objects:[object_address]
|
|
89
|
+
const r = await query_objects({objects:[object_address]});
|
|
90
90
|
if (r?.objects && r.objects[0].type === 'Arbitration') {
|
|
91
91
|
obj = r.objects[0] as ObjectArbitration;
|
|
92
92
|
}
|
|
@@ -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
|
+
// true: use address as the name if the name exist; otherwise, use this name and change the original name to its address
|
|
15
|
+
useAddressIfNameExist?: boolean;
|
|
16
|
+
onChain?: boolean; // true: onchain, false: local(default)
|
|
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;
|
|
@@ -45,7 +45,6 @@ export interface CallArbitrationObject {
|
|
|
45
45
|
export interface CallGuardObject {
|
|
46
46
|
data: CallGuard_Data;
|
|
47
47
|
account?: string;
|
|
48
|
-
witness?: GuardInfo_forCall;
|
|
49
48
|
}
|
|
50
49
|
export interface CallRepositoryObject {
|
|
51
50
|
data: CallRepository_Data;
|
|
@@ -168,7 +167,7 @@ export const call_repository = async (call:CallRepositoryObject) : Promise<CallR
|
|
|
168
167
|
}
|
|
169
168
|
export const call_guard = async (call:CallGuardObject) : Promise<CallResult> => {
|
|
170
169
|
const obj = new CallGuard(call.data);
|
|
171
|
-
return call_object(obj, call.account
|
|
170
|
+
return call_object(obj, call.account)
|
|
172
171
|
}
|
|
173
172
|
export const call_machine = async (call:CallMachineObject) : Promise<CallResult> => {
|
|
174
173
|
const obj = new CallMachine(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 {
|
|
@@ -61,7 +61,7 @@ export class CallDemand extends CallBase {
|
|
|
61
61
|
guards.push(this.data.guard.address)
|
|
62
62
|
}
|
|
63
63
|
} else {
|
|
64
|
-
const r = await query_objects({objects:[object_address]
|
|
64
|
+
const r = await query_objects({objects:[object_address]});
|
|
65
65
|
if (r?.objects && r?.objects[0]?.type === 'Demand') {
|
|
66
66
|
const obj = (r?.objects[0] as ObjectDemand);
|
|
67
67
|
if (obj?.guard) {
|
|
@@ -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[];
|
|
@@ -24,7 +24,7 @@ export class CallObjectPermission extends CallBase {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
protected async operate (txb:TransactionBlock, passport?:PassportObject) {
|
|
27
|
-
const r = await query_objects({objects:this.data.objects
|
|
27
|
+
const r = await query_objects({objects:this.data.objects});
|
|
28
28
|
r.objects?.forEach(v => {
|
|
29
29
|
switch(v.type) {
|
|
30
30
|
case 'Demand':
|
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
|
@@ -71,8 +71,8 @@ export class CallPersonal extends CallBase {
|
|
|
71
71
|
entity.use_resource(Resource.From(txb, this.data.mark.address));
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
if (!object_address
|
|
75
|
-
await this.new_with_mark(txb, obj.launch(), (this.data?.mark_object as any)?.namedNew, account);
|
|
74
|
+
if (!object_address) {
|
|
75
|
+
await this.new_with_mark('PersonalMark', txb, obj.launch(), (this.data?.mark_object as any)?.namedNew, account);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
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 {
|
|
@@ -122,7 +122,7 @@ export class CallService extends CallBase {
|
|
|
122
122
|
}
|
|
123
123
|
} else {
|
|
124
124
|
if (!obj) {
|
|
125
|
-
const r = await query_objects({objects:[object_address]
|
|
125
|
+
const r = await query_objects({objects:[object_address]});
|
|
126
126
|
if (r?.objects && r.objects[0].type === 'Service') {
|
|
127
127
|
obj = r.objects[0] as ObjectService;
|
|
128
128
|
}
|
|
@@ -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 {
|
|
@@ -64,7 +64,7 @@ export class CallTreasury extends CallBase {
|
|
|
64
64
|
}
|
|
65
65
|
} else {
|
|
66
66
|
if (!obj) {
|
|
67
|
-
const r = await query_objects({objects:[object_address]
|
|
67
|
+
const r = await query_objects({objects:[object_address]});
|
|
68
68
|
if (r?.objects && r.objects[0].type === 'Treasury') {
|
|
69
69
|
obj = r.objects[0] as ObjectTreasury;
|
|
70
70
|
}
|
|
@@ -84,7 +84,7 @@ export class CallTreasury extends CallBase {
|
|
|
84
84
|
guards.push(this.data.withdraw.withdraw_guard)
|
|
85
85
|
} else if (this.data.object) {
|
|
86
86
|
if (!obj) {
|
|
87
|
-
const r = await query_objects({objects:[object_address]
|
|
87
|
+
const r = await query_objects({objects:[object_address]});
|
|
88
88
|
if (r?.objects && r.objects[0].type === 'Treasury') {
|
|
89
89
|
obj = r.objects[0] as ObjectTreasury;
|
|
90
90
|
}
|
|
@@ -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,10 @@ 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'
|
|
19
|
+
export * from './local/index.js'
|
|
20
|
+
|
|
18
21
|
export * as WOWOK from 'wowok'
|