wowok 1.6.84 → 1.6.85
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/permission.d.ts +1 -1
- package/dist/permission.d.ts.map +1 -1
- package/dist/permission.js +0 -45
- package/package.json +1 -1
- package/src/permission.ts +18 -60
- package/tsconfig.json +112 -112
- package/dist/empty.d.ts +0 -1
- package/dist/empty.d.ts.map +0 -1
- package/dist/empty.js +0 -1
- package/dist/src/arbitration.d.ts +0 -61
- package/dist/src/arbitration.d.ts.map +0 -1
- package/dist/src/arbitration.js +0 -473
- package/dist/src/demand.d.ts +0 -26
- package/dist/src/demand.d.ts.map +0 -1
- package/dist/src/demand.js +0 -256
- package/dist/src/entity.d.ts +0 -27
- package/dist/src/entity.d.ts.map +0 -1
- package/dist/src/entity.js +0 -95
- package/dist/src/exception.d.ts +0 -31
- package/dist/src/exception.d.ts.map +0 -1
- package/dist/src/exception.js +0 -34
- package/dist/src/guard.d.ts +0 -79
- package/dist/src/guard.d.ts.map +0 -1
- package/dist/src/guard.js +0 -749
- package/dist/src/index.d.ts +0 -25
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -24
- package/dist/src/machine.d.ts +0 -67
- package/dist/src/machine.d.ts.map +0 -1
- package/dist/src/machine.js +0 -518
- package/dist/src/passport.d.ts +0 -86
- package/dist/src/passport.d.ts.map +0 -1
- package/dist/src/passport.js +0 -645
- package/dist/src/payment.d.ts +0 -16
- package/dist/src/payment.d.ts.map +0 -1
- package/dist/src/payment.js +0 -41
- package/dist/src/permission.d.ts +0 -150
- package/dist/src/permission.d.ts.map +0 -1
- package/dist/src/permission.js +0 -502
- package/dist/src/progress.d.ts +0 -72
- package/dist/src/progress.d.ts.map +0 -1
- package/dist/src/progress.js +0 -301
- package/dist/src/protocol.d.ts +0 -226
- package/dist/src/protocol.d.ts.map +0 -1
- package/dist/src/protocol.js +0 -482
- package/dist/src/repository.d.ts +0 -83
- package/dist/src/repository.d.ts.map +0 -1
- package/dist/src/repository.js +0 -528
- package/dist/src/resource.d.ts +0 -35
- package/dist/src/resource.d.ts.map +0 -1
- package/dist/src/resource.js +0 -130
- package/dist/src/service.d.ts +0 -128
- package/dist/src/service.d.ts.map +0 -1
- package/dist/src/service.js +0 -1234
- package/dist/src/treasury.d.ts +0 -55
- package/dist/src/treasury.d.ts.map +0 -1
- package/dist/src/treasury.js +0 -396
- package/dist/src/utils.d.ts +0 -93
- package/dist/src/utils.d.ts.map +0 -1
- package/dist/src/utils.js +0 -616
- package/dist/src/wowok.d.ts +0 -15
- package/dist/src/wowok.d.ts.map +0 -1
- package/dist/src/wowok.js +0 -67
package/dist/src/index.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export * from './demand';
|
|
2
|
-
export * from './progress';
|
|
3
|
-
export * from './utils';
|
|
4
|
-
export * from './permission';
|
|
5
|
-
export * from './guard';
|
|
6
|
-
export * from './repository';
|
|
7
|
-
export * from './protocol';
|
|
8
|
-
export * from './passport';
|
|
9
|
-
export * from './machine';
|
|
10
|
-
export * from './service';
|
|
11
|
-
export * from './entity';
|
|
12
|
-
export * from './wowok';
|
|
13
|
-
export * from './resource';
|
|
14
|
-
export * from './treasury';
|
|
15
|
-
export * from './payment';
|
|
16
|
-
export * from './arbitration';
|
|
17
|
-
export * from './exception';
|
|
18
|
-
export { BCS, getSuiMoveConfig, } from '@mysten/bcs';
|
|
19
|
-
export { Transaction as TransactionBlock, type TransactionArgument, type TransactionResult } from '@mysten/sui/transactions';
|
|
20
|
-
export { SuiClient, type SuiObjectResponse, type SuiTransactionBlockResponseOptions, type DynamicFieldPage, type CoinBalance, type CoinStruct, type SuiTransactionBlockResponse as CallResponse } from '@mysten/sui/client';
|
|
21
|
-
export { Ed25519Keypair, } from '@mysten/sui/keypairs/ed25519';
|
|
22
|
-
export { fromHEX, toHEX } from '@mysten/bcs';
|
|
23
|
-
export { decodeSuiPrivateKey, encodeSuiPrivateKey } from '@mysten/sui/cryptography';
|
|
24
|
-
export { getFaucetHost, requestSuiFromFaucetV0, requestSuiFromFaucetV1 } from '@mysten/sui/faucet';
|
|
25
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,GAAG,EAAE,gBAAgB,GAAG,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,WAAW,IAAI,gBAAgB,EAAE,KAAK,mBAAmB,EAAE,KAAK,iBAAiB,EAAC,MAAM,0BAA0B,CAAC;AAC5H,OAAO,EAAE,SAAS,EAAE,KAAK,iBAAiB,EAAE,KAAK,kCAAkC,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EACzI,KAAK,2BAA2B,IAAI,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,cAAc,GAAI,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAG,sBAAsB,EAAC,MAAM,oBAAoB,CAAC"}
|
package/dist/src/index.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export * from './demand';
|
|
2
|
-
export * from './progress';
|
|
3
|
-
export * from './utils';
|
|
4
|
-
export * from './permission';
|
|
5
|
-
export * from './guard';
|
|
6
|
-
export * from './repository';
|
|
7
|
-
export * from './protocol';
|
|
8
|
-
export * from './passport';
|
|
9
|
-
export * from './machine';
|
|
10
|
-
export * from './service';
|
|
11
|
-
export * from './entity';
|
|
12
|
-
export * from './wowok';
|
|
13
|
-
export * from './resource';
|
|
14
|
-
export * from './treasury';
|
|
15
|
-
export * from './payment';
|
|
16
|
-
export * from './arbitration';
|
|
17
|
-
export * from './exception';
|
|
18
|
-
export { BCS, getSuiMoveConfig, } from '@mysten/bcs';
|
|
19
|
-
export { Transaction as TransactionBlock } from '@mysten/sui/transactions';
|
|
20
|
-
export { SuiClient } from '@mysten/sui/client';
|
|
21
|
-
export { Ed25519Keypair, } from '@mysten/sui/keypairs/ed25519';
|
|
22
|
-
export { fromHEX, toHEX } from '@mysten/bcs';
|
|
23
|
-
export { decodeSuiPrivateKey, encodeSuiPrivateKey } from '@mysten/sui/cryptography';
|
|
24
|
-
export { getFaucetHost, requestSuiFromFaucetV0, requestSuiFromFaucetV1 } from '@mysten/sui/faucet';
|
package/dist/src/machine.d.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { Transaction as TransactionBlock, type TransactionResult } from '@mysten/sui/transactions';
|
|
2
|
-
import { PermissionObject, RepositoryObject, PassportObject, MachineObject, MachineAddress, GuardObject, TxbObject, ServiceObject } from './protocol';
|
|
3
|
-
import { PermissionIndexType } from './permission';
|
|
4
|
-
export interface ServiceWrap {
|
|
5
|
-
object: ServiceObject;
|
|
6
|
-
pay_token_type: string;
|
|
7
|
-
bOptional: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface Machine_Forward {
|
|
10
|
-
name: string;
|
|
11
|
-
namedOperator?: string;
|
|
12
|
-
permission?: PermissionIndexType;
|
|
13
|
-
weight?: number;
|
|
14
|
-
guard?: GuardObject;
|
|
15
|
-
suppliers?: ServiceWrap[];
|
|
16
|
-
}
|
|
17
|
-
export interface Machine_Node_Pair {
|
|
18
|
-
prior_node: string;
|
|
19
|
-
forwards: Machine_Forward[];
|
|
20
|
-
threshold?: number;
|
|
21
|
-
}
|
|
22
|
-
export interface Machine_Node {
|
|
23
|
-
name: string;
|
|
24
|
-
pairs: Machine_Node_Pair[];
|
|
25
|
-
}
|
|
26
|
-
export interface QueryGuardParam {
|
|
27
|
-
node: string;
|
|
28
|
-
prior_node: string;
|
|
29
|
-
forward: string;
|
|
30
|
-
txb: TransactionBlock;
|
|
31
|
-
guard: string | null;
|
|
32
|
-
}
|
|
33
|
-
export type OnQueryGuard = (param: QueryGuardParam) => void;
|
|
34
|
-
export declare class Machine {
|
|
35
|
-
protected txb: TransactionBlock;
|
|
36
|
-
protected object: TxbObject;
|
|
37
|
-
protected permission: TxbObject;
|
|
38
|
-
get_object(): TxbObject;
|
|
39
|
-
static From(txb: TransactionBlock, permission: PermissionObject, object: TxbObject): Machine;
|
|
40
|
-
private constructor();
|
|
41
|
-
static New(txb: TransactionBlock, permission: PermissionObject, description: string, endpoint?: string | null | undefined, passport?: PassportObject): Machine;
|
|
42
|
-
add_node(nodes: Machine_Node[], passport?: PassportObject): void;
|
|
43
|
-
forward(forward: Machine_Forward): TransactionResult;
|
|
44
|
-
add_node2(nodes: TxbObject[], passport?: PassportObject): void;
|
|
45
|
-
fetch_node(node_name: string, passport?: PassportObject): TxbObject;
|
|
46
|
-
rename_node(node_name: string, new_name: string, passport?: PassportObject): void;
|
|
47
|
-
remove_node(nodes_name: string[], bTransferMyself?: boolean, passport?: PassportObject): void;
|
|
48
|
-
launch(): MachineAddress;
|
|
49
|
-
set_description(description: string, passport?: PassportObject): void;
|
|
50
|
-
add_repository(repository: RepositoryObject, passport?: PassportObject): void;
|
|
51
|
-
remove_repository(repositories: string[], removeall?: boolean, passport?: PassportObject): void;
|
|
52
|
-
clone(bLaunch?: boolean, passport?: PassportObject): MachineObject | MachineAddress;
|
|
53
|
-
set_endpoint(endpoint?: string | null | undefined, passport?: PassportObject): void;
|
|
54
|
-
pause(bPaused: boolean, passport?: PassportObject): void;
|
|
55
|
-
publish(passport?: PassportObject): void;
|
|
56
|
-
change_permission(new_permission: PermissionObject): void;
|
|
57
|
-
add_forward(node_prior: string, node_name: string, foward: Machine_Forward, threshold?: number, old_forward_name?: string, passport?: PassportObject): void;
|
|
58
|
-
remove_pair(node_prior: string, node_name: string, passport?: PassportObject): void;
|
|
59
|
-
remove_forward(node_prior: string, node_name: string, foward_name: string, passport?: PassportObject): void;
|
|
60
|
-
static rpc_de_nodes(fields: any): Machine_Node[];
|
|
61
|
-
static rpc_de_pair(data: any): Machine_Node_Pair[];
|
|
62
|
-
static namedOperators(nodes: Machine_Node[]): string[];
|
|
63
|
-
static checkValidForward(forward: Machine_Forward): string;
|
|
64
|
-
static INITIAL_NODE_NAME: string;
|
|
65
|
-
static OPERATOR_ORDER_PAYER: string;
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=machine.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../../src/machine.ts"],"names":[],"mappings":"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"}
|
package/dist/src/machine.js
DELETED
|
@@ -1,518 +0,0 @@
|
|
|
1
|
-
import { Protocol } from './protocol';
|
|
2
|
-
import { IsValidInt, array_unique, IsValidArray, IsValidAddress, IsValidName, IsValidName_AllowEmpty, IsValidEndpoint, IsValidDesription, IsValidU64, IsValidTokenType } from './utils';
|
|
3
|
-
import { Permission } from './permission';
|
|
4
|
-
import { Errors, ERROR } from './exception';
|
|
5
|
-
export class Machine {
|
|
6
|
-
txb;
|
|
7
|
-
object;
|
|
8
|
-
permission;
|
|
9
|
-
get_object() { return this.object; }
|
|
10
|
-
static From(txb, permission, object) {
|
|
11
|
-
let d = new Machine(txb, permission);
|
|
12
|
-
d.object = Protocol.TXB_OBJECT(txb, object);
|
|
13
|
-
return d;
|
|
14
|
-
}
|
|
15
|
-
constructor(txb, permission) {
|
|
16
|
-
this.txb = txb;
|
|
17
|
-
this.permission = permission;
|
|
18
|
-
this.object = '';
|
|
19
|
-
}
|
|
20
|
-
static New(txb, permission, description, endpoint, passport) {
|
|
21
|
-
if (!Protocol.IsValidObjects([permission])) {
|
|
22
|
-
ERROR(Errors.IsValidObjects, 'permission');
|
|
23
|
-
}
|
|
24
|
-
if (!IsValidDesription(description)) {
|
|
25
|
-
ERROR(Errors.IsValidDesription);
|
|
26
|
-
}
|
|
27
|
-
if (endpoint && !IsValidEndpoint(endpoint)) {
|
|
28
|
-
ERROR(Errors.IsValidEndpoint);
|
|
29
|
-
}
|
|
30
|
-
let m = new Machine(txb, permission);
|
|
31
|
-
let ep = txb.pure.option('string', endpoint ? endpoint : undefined);
|
|
32
|
-
if (passport) {
|
|
33
|
-
m.object = txb.moveCall({
|
|
34
|
-
target: Protocol.Instance().machineFn('new_with_passport'),
|
|
35
|
-
arguments: [passport, txb.pure.string(description), ep, Protocol.TXB_OBJECT(txb, permission)],
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
m.object = txb.moveCall({
|
|
40
|
-
target: Protocol.Instance().machineFn('new'),
|
|
41
|
-
arguments: [txb.pure.string(description), ep, Protocol.TXB_OBJECT(txb, permission)],
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
return m;
|
|
45
|
-
}
|
|
46
|
-
// create new nodes for machine
|
|
47
|
-
add_node(nodes, passport) {
|
|
48
|
-
if (nodes.length === 0)
|
|
49
|
-
return;
|
|
50
|
-
let bValid = true;
|
|
51
|
-
nodes.forEach((node) => {
|
|
52
|
-
if (!IsValidName(node.name)) {
|
|
53
|
-
bValid = false;
|
|
54
|
-
}
|
|
55
|
-
node.pairs.forEach((p) => {
|
|
56
|
-
if (!IsValidName_AllowEmpty(p.prior_node)) {
|
|
57
|
-
bValid = false;
|
|
58
|
-
}
|
|
59
|
-
if (p?.threshold && !IsValidInt(p.threshold)) {
|
|
60
|
-
bValid = false;
|
|
61
|
-
}
|
|
62
|
-
p.forwards.forEach((f) => {
|
|
63
|
-
if (Machine.checkValidForward(f) !== '')
|
|
64
|
-
bValid = false;
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
if (!bValid) {
|
|
69
|
-
ERROR(Errors.InvalidParam, 'add_node');
|
|
70
|
-
}
|
|
71
|
-
let new_nodes = [];
|
|
72
|
-
nodes.forEach((node) => {
|
|
73
|
-
let n = this.txb.moveCall({
|
|
74
|
-
target: Protocol.Instance().machineFn('node_new'),
|
|
75
|
-
arguments: [this.txb.pure.string(node.name)]
|
|
76
|
-
});
|
|
77
|
-
node.pairs.forEach((pair) => {
|
|
78
|
-
let threshold = this.txb.pure.option('u32', pair?.threshold);
|
|
79
|
-
pair.forwards.forEach((forward) => {
|
|
80
|
-
this.txb.moveCall({
|
|
81
|
-
target: Protocol.Instance().machineFn('forward_add'),
|
|
82
|
-
arguments: [n, this.txb.pure.string(pair.prior_node), this.txb.pure.string(forward.name), threshold, this.forward(forward)]
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
if (pair.forwards.length === 0) {
|
|
86
|
-
this.txb.moveCall({
|
|
87
|
-
target: Protocol.Instance().machineFn('forward_add_none'),
|
|
88
|
-
arguments: [n, this.txb.pure.string(pair.prior_node), threshold]
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
new_nodes.push(n);
|
|
93
|
-
});
|
|
94
|
-
this.add_node2(new_nodes, passport);
|
|
95
|
-
}
|
|
96
|
-
forward(forward) {
|
|
97
|
-
let weight = forward?.weight ? forward.weight : 1;
|
|
98
|
-
let f;
|
|
99
|
-
// namedOperator first.
|
|
100
|
-
if (forward?.namedOperator && IsValidName(forward.namedOperator)) {
|
|
101
|
-
if (forward?.guard) {
|
|
102
|
-
f = this.txb.moveCall({
|
|
103
|
-
target: Protocol.Instance().machineFn('forward'),
|
|
104
|
-
arguments: [this.txb.pure.string(forward.namedOperator), this.txb.pure.u16(weight), this.txb.object(Protocol.TXB_OBJECT(this.txb, forward.guard))]
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
f = this.txb.moveCall({
|
|
109
|
-
target: Protocol.Instance().machineFn('forward2'),
|
|
110
|
-
arguments: [this.txb.pure.string(forward.namedOperator), this.txb.pure.u16(weight)]
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
else if (forward?.permission !== undefined && IsValidU64(forward.permission)) {
|
|
115
|
-
if (forward?.guard) {
|
|
116
|
-
f = this.txb.moveCall({
|
|
117
|
-
target: Protocol.Instance().machineFn('forward3'),
|
|
118
|
-
arguments: [this.txb.pure.u64(forward.permission), this.txb.pure.u16(weight), this.txb.object(Protocol.TXB_OBJECT(this.txb, forward.guard))]
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
f = this.txb.moveCall({
|
|
123
|
-
target: Protocol.Instance().machineFn('forward4'),
|
|
124
|
-
arguments: [this.txb.pure.u64(forward.permission), this.txb.pure.u16(weight)]
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
ERROR(Errors.InvalidParam, 'forward');
|
|
130
|
-
}
|
|
131
|
-
forward?.suppliers?.forEach((v) => {
|
|
132
|
-
if (!IsValidTokenType(v.pay_token_type)) {
|
|
133
|
-
ERROR(Errors.IsValidTokenType, 'forward.suppliers:' + v.object);
|
|
134
|
-
}
|
|
135
|
-
this.txb.moveCall({
|
|
136
|
-
target: Protocol.Instance().serviceFn('add_to'),
|
|
137
|
-
arguments: [this.txb.object(v.object), this.txb.pure.bool(v.bOptional), f],
|
|
138
|
-
typeArguments: [v.pay_token_type]
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
return f;
|
|
142
|
-
}
|
|
143
|
-
// move MachineNodeObject to the machine from signer-owned MachineNode object
|
|
144
|
-
add_node2(nodes, passport) {
|
|
145
|
-
if (nodes.length === 0)
|
|
146
|
-
return;
|
|
147
|
-
let n = nodes.map((v) => Protocol.TXB_OBJECT(this.txb, v));
|
|
148
|
-
if (passport) {
|
|
149
|
-
this.txb.moveCall({
|
|
150
|
-
target: Protocol.Instance().machineFn('node_add_with_passport'),
|
|
151
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.makeMoveVec({ elements: n }), Protocol.TXB_OBJECT(this.txb, this.permission)]
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
this.txb.moveCall({
|
|
156
|
-
target: Protocol.Instance().machineFn('node_add'),
|
|
157
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.makeMoveVec({ elements: n }), Protocol.TXB_OBJECT(this.txb, this.permission)]
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
fetch_node(node_name, passport) {
|
|
162
|
-
if (!IsValidName(node_name)) {
|
|
163
|
-
ERROR(Errors.IsValidName, 'fetch_node');
|
|
164
|
-
}
|
|
165
|
-
if (passport) {
|
|
166
|
-
return this.txb.moveCall({
|
|
167
|
-
target: Protocol.Instance().machineFn('node_fetch_with_passport'),
|
|
168
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(node_name),
|
|
169
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
return this.txb.moveCall({
|
|
174
|
-
target: Protocol.Instance().machineFn('node_fetch'),
|
|
175
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(node_name), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
rename_node(node_name, new_name, passport) {
|
|
180
|
-
if (node_name === new_name)
|
|
181
|
-
return;
|
|
182
|
-
if (!IsValidName(node_name))
|
|
183
|
-
ERROR(Errors.IsValidName, 'rename_node');
|
|
184
|
-
if (!IsValidName(new_name))
|
|
185
|
-
ERROR(Errors.IsValidName, 'rename_node');
|
|
186
|
-
if (passport) {
|
|
187
|
-
this.txb.moveCall({
|
|
188
|
-
target: Protocol.Instance().machineFn('node_rename_with_passport'),
|
|
189
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object),
|
|
190
|
-
this.txb.pure.string(node_name), this.txb.pure.string(new_name),
|
|
191
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
this.txb.moveCall({
|
|
196
|
-
target: Protocol.Instance().machineFn('node_rename'),
|
|
197
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object),
|
|
198
|
-
this.txb.pure.string(node_name), this.txb.pure.string(new_name),
|
|
199
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
// move MachineNodeObject from this.object to signer-owned MachineNode object
|
|
204
|
-
remove_node(nodes_name, bTransferMyself = false, passport) {
|
|
205
|
-
if (nodes_name.length === 0)
|
|
206
|
-
return;
|
|
207
|
-
if (!IsValidArray(nodes_name, IsValidName)) {
|
|
208
|
-
ERROR(Errors.IsValidArray, 'nodes_name');
|
|
209
|
-
}
|
|
210
|
-
if (passport) {
|
|
211
|
-
this.txb.moveCall({
|
|
212
|
-
target: Protocol.Instance().machineFn('node_remove_with_passport'),
|
|
213
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('string', nodes_name),
|
|
214
|
-
this.txb.pure.bool(bTransferMyself), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
else {
|
|
218
|
-
this.txb.moveCall({
|
|
219
|
-
target: Protocol.Instance().machineFn('node_remove'),
|
|
220
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('string', nodes_name),
|
|
221
|
-
this.txb.pure.bool(bTransferMyself), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
launch() {
|
|
226
|
-
return this.txb.moveCall({
|
|
227
|
-
target: Protocol.Instance().machineFn('create'),
|
|
228
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object)],
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
set_description(description, passport) {
|
|
232
|
-
if (!IsValidDesription(description)) {
|
|
233
|
-
ERROR(Errors.IsValidDesription);
|
|
234
|
-
}
|
|
235
|
-
if (passport) {
|
|
236
|
-
this.txb.moveCall({
|
|
237
|
-
target: Protocol.Instance().machineFn('description_set_with_passport'),
|
|
238
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(description), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
else {
|
|
242
|
-
this.txb.moveCall({
|
|
243
|
-
target: Protocol.Instance().machineFn('description_set'),
|
|
244
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(description), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
add_repository(repository, passport) {
|
|
249
|
-
if (passport) {
|
|
250
|
-
this.txb.moveCall({
|
|
251
|
-
target: Protocol.Instance().machineFn('repository_add_with_passport'),
|
|
252
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, repository), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
else {
|
|
256
|
-
this.txb.moveCall({
|
|
257
|
-
target: Protocol.Instance().machineFn('repository_add'),
|
|
258
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, repository), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
remove_repository(repositories, removeall, passport) {
|
|
263
|
-
if (!removeall && repositories.length === 0) {
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
if (!IsValidArray(repositories, IsValidAddress)) {
|
|
267
|
-
ERROR(Errors.IsValidArray, 'remove_repository');
|
|
268
|
-
}
|
|
269
|
-
if (passport) {
|
|
270
|
-
if (removeall) {
|
|
271
|
-
this.txb.moveCall({
|
|
272
|
-
target: Protocol.Instance().machineFn('repository_remove_all_with_passport'),
|
|
273
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.object)],
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
else {
|
|
277
|
-
this.txb.moveCall({
|
|
278
|
-
target: Protocol.Instance().machineFn('repository_remove_with_passport'),
|
|
279
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(repositories)),
|
|
280
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
else {
|
|
285
|
-
if (removeall) {
|
|
286
|
-
this.txb.moveCall({
|
|
287
|
-
target: Protocol.Instance().machineFn('repository_remove_all'),
|
|
288
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
else {
|
|
292
|
-
this.txb.moveCall({
|
|
293
|
-
target: Protocol.Instance().machineFn('repository_remove'),
|
|
294
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(repositories)),
|
|
295
|
-
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
clone(bLaunch, passport) {
|
|
301
|
-
let ret;
|
|
302
|
-
if (passport) {
|
|
303
|
-
ret = this.txb.moveCall({
|
|
304
|
-
target: Protocol.Instance().machineFn('clone_with_passport'),
|
|
305
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
else {
|
|
309
|
-
ret = this.txb.moveCall({
|
|
310
|
-
target: Protocol.Instance().machineFn('clone'),
|
|
311
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
if (bLaunch) {
|
|
315
|
-
return this.txb.moveCall({
|
|
316
|
-
target: Protocol.Instance().machineFn('create'),
|
|
317
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, ret)],
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
else {
|
|
321
|
-
return ret;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
set_endpoint(endpoint, passport) {
|
|
325
|
-
if (endpoint && !IsValidEndpoint(endpoint)) {
|
|
326
|
-
ERROR(Errors.IsValidEndpoint);
|
|
327
|
-
}
|
|
328
|
-
let ep = this.txb.pure.option('string', endpoint ? endpoint : undefined);
|
|
329
|
-
if (passport) {
|
|
330
|
-
this.txb.moveCall({
|
|
331
|
-
target: Protocol.Instance().machineFn('endpoint_set_with_passport'),
|
|
332
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), ep, Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
else {
|
|
336
|
-
this.txb.moveCall({
|
|
337
|
-
target: Protocol.Instance().machineFn('endpoint_set'),
|
|
338
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), ep, Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
pause(bPaused, passport) {
|
|
343
|
-
if (passport) {
|
|
344
|
-
this.txb.moveCall({
|
|
345
|
-
target: Protocol.Instance().machineFn('pause_with_passport'),
|
|
346
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.bool(bPaused), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
else {
|
|
350
|
-
this.txb.moveCall({
|
|
351
|
-
target: Protocol.Instance().machineFn('pause'),
|
|
352
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.bool(bPaused), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
publish(passport) {
|
|
357
|
-
if (passport) {
|
|
358
|
-
this.txb.moveCall({
|
|
359
|
-
target: Protocol.Instance().machineFn('publish_with_passport'),
|
|
360
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
else {
|
|
364
|
-
this.txb.moveCall({
|
|
365
|
-
target: Protocol.Instance().machineFn('publish'),
|
|
366
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
change_permission(new_permission) {
|
|
371
|
-
if (!Protocol.IsValidObjects([new_permission])) {
|
|
372
|
-
ERROR(Errors.IsValidObjects, 'new_permission');
|
|
373
|
-
}
|
|
374
|
-
this.txb.moveCall({
|
|
375
|
-
target: Protocol.Instance().machineFn('permission_set'),
|
|
376
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission), Protocol.TXB_OBJECT(this.txb, new_permission)],
|
|
377
|
-
typeArguments: []
|
|
378
|
-
});
|
|
379
|
-
this.permission = new_permission;
|
|
380
|
-
}
|
|
381
|
-
add_forward(node_prior, node_name, foward, threshold, old_forward_name, passport) {
|
|
382
|
-
if (!IsValidName_AllowEmpty(node_prior))
|
|
383
|
-
ERROR(Errors.IsValidName_AllowEmpty, 'add_forward');
|
|
384
|
-
if (!IsValidName(node_name))
|
|
385
|
-
ERROR(Errors.IsValidName, 'add_forward');
|
|
386
|
-
const err = Machine.checkValidForward(foward);
|
|
387
|
-
if (err)
|
|
388
|
-
ERROR(Errors.InvalidParam, err);
|
|
389
|
-
let n;
|
|
390
|
-
if (passport) {
|
|
391
|
-
n = this.txb.moveCall({
|
|
392
|
-
target: Protocol.Instance().machineFn('node_fetch_with_passport'),
|
|
393
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(node_name), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
else {
|
|
397
|
-
n = this.txb.moveCall({
|
|
398
|
-
target: Protocol.Instance().machineFn('node_fetch'),
|
|
399
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(node_name), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
const f = this.forward(foward);
|
|
403
|
-
const t = this.txb.pure.option('u32', threshold);
|
|
404
|
-
this.txb.moveCall({
|
|
405
|
-
target: Protocol.Instance().machineFn('forward_add'),
|
|
406
|
-
arguments: [n, this.txb.pure.string(node_prior), this.txb.pure.string(foward.name), t, f],
|
|
407
|
-
});
|
|
408
|
-
if (old_forward_name && old_forward_name !== foward.name) {
|
|
409
|
-
this.txb.moveCall({
|
|
410
|
-
target: Protocol.Instance().machineFn('forward_remove'),
|
|
411
|
-
arguments: [n, this.txb.pure.string(node_prior), this.txb.pure.string(old_forward_name)],
|
|
412
|
-
});
|
|
413
|
-
}
|
|
414
|
-
this.add_node2([n], passport);
|
|
415
|
-
}
|
|
416
|
-
remove_pair(node_prior, node_name, passport) {
|
|
417
|
-
if (!IsValidName_AllowEmpty(node_prior))
|
|
418
|
-
ERROR(Errors.IsValidName_AllowEmpty, 'remove_pair');
|
|
419
|
-
if (!IsValidName(node_name))
|
|
420
|
-
ERROR(Errors.IsValidName, 'remove_pair');
|
|
421
|
-
let n;
|
|
422
|
-
if (passport) {
|
|
423
|
-
n = this.txb.moveCall({
|
|
424
|
-
target: Protocol.Instance().machineFn('node_fetch_with_passport'),
|
|
425
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(node_name), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
426
|
-
});
|
|
427
|
-
}
|
|
428
|
-
else {
|
|
429
|
-
n = this.txb.moveCall({
|
|
430
|
-
target: Protocol.Instance().machineFn('node_fetch'),
|
|
431
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(node_name), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
|
-
this.txb.moveCall({
|
|
435
|
-
target: Protocol.Instance().machineFn('pair_remove'),
|
|
436
|
-
arguments: [n, this.txb.pure.string(node_prior)],
|
|
437
|
-
});
|
|
438
|
-
this.add_node2([n], passport);
|
|
439
|
-
}
|
|
440
|
-
remove_forward(node_prior, node_name, foward_name, passport) {
|
|
441
|
-
if (!IsValidName_AllowEmpty(node_prior))
|
|
442
|
-
ERROR(Errors.IsValidName_AllowEmpty, 'remove_forward');
|
|
443
|
-
if (!IsValidName(node_name))
|
|
444
|
-
ERROR(Errors.IsValidName, 'remove_forward');
|
|
445
|
-
let n;
|
|
446
|
-
if (passport) {
|
|
447
|
-
n = this.txb.moveCall({
|
|
448
|
-
target: Protocol.Instance().machineFn('node_fetch_with_passport'),
|
|
449
|
-
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(node_name), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
else {
|
|
453
|
-
n = this.txb.moveCall({
|
|
454
|
-
target: Protocol.Instance().machineFn('node_fetch'),
|
|
455
|
-
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(node_name), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
456
|
-
});
|
|
457
|
-
}
|
|
458
|
-
this.txb.moveCall({
|
|
459
|
-
target: Protocol.Instance().machineFn('forward_remove'),
|
|
460
|
-
arguments: [n, this.txb.pure.string(node_prior), this.txb.pure.string(foward_name)],
|
|
461
|
-
});
|
|
462
|
-
this.add_node2([n], passport);
|
|
463
|
-
}
|
|
464
|
-
static rpc_de_nodes(fields) {
|
|
465
|
-
const machine_nodes = [];
|
|
466
|
-
fields.forEach((n) => {
|
|
467
|
-
machine_nodes.push({ name: n.data.content.fields.name, pairs: Machine.rpc_de_pair(n?.data.content.fields.value) });
|
|
468
|
-
});
|
|
469
|
-
return machine_nodes;
|
|
470
|
-
}
|
|
471
|
-
static rpc_de_pair(data) {
|
|
472
|
-
let pairs = [];
|
|
473
|
-
data.fields.value.fields.contents.forEach((p) => {
|
|
474
|
-
let forwards = [];
|
|
475
|
-
p.fields.value.fields.forwards.fields.contents.forEach((f) => {
|
|
476
|
-
let forward_name = f.fields.key;
|
|
477
|
-
let forward_weight = f.fields.value.fields.weight;
|
|
478
|
-
let forward_guard = f.fields.value.fields.guard;
|
|
479
|
-
let forward_namedOperator = f.fields.value.fields.namedOperator;
|
|
480
|
-
let forward_permission_index = f.fields.value.fields.permission_index;
|
|
481
|
-
forwards.push({ name: forward_name, namedOperator: forward_namedOperator, permission: forward_permission_index,
|
|
482
|
-
weight: forward_weight, guard: forward_guard ? forward_guard : '', suppliers: f.fields.value.fields.suppliers.fields.contents.map((v) => {
|
|
483
|
-
return { object: v.fields.key, bOptional: v.fields.value, pay_token_type: '' };
|
|
484
|
-
}) }); //@ NOTICE...
|
|
485
|
-
});
|
|
486
|
-
pairs.push({ prior_node: p.fields.key, threshold: p.fields.value.fields.threshold, forwards: forwards });
|
|
487
|
-
});
|
|
488
|
-
return pairs;
|
|
489
|
-
}
|
|
490
|
-
static namedOperators(nodes) {
|
|
491
|
-
let ret = [];
|
|
492
|
-
nodes.forEach((v) => {
|
|
493
|
-
v.pairs.forEach((i) => {
|
|
494
|
-
i.forwards.forEach((k) => {
|
|
495
|
-
if (k?.namedOperator && !ret.find((x) => x === k.namedOperator)) {
|
|
496
|
-
ret.push(k.namedOperator);
|
|
497
|
-
}
|
|
498
|
-
});
|
|
499
|
-
});
|
|
500
|
-
});
|
|
501
|
-
return ret;
|
|
502
|
-
}
|
|
503
|
-
static checkValidForward(forward) {
|
|
504
|
-
if (!IsValidName(forward.name))
|
|
505
|
-
return 'Forward name invalid';
|
|
506
|
-
if (forward?.namedOperator && !IsValidName_AllowEmpty(forward?.namedOperator))
|
|
507
|
-
return 'Progress Operator invalid';
|
|
508
|
-
if (forward?.permission && !Permission.IsValidPermissionIndex(forward?.permission))
|
|
509
|
-
return 'Permission index invalid';
|
|
510
|
-
if (!forward?.permission && !forward?.namedOperator)
|
|
511
|
-
return 'Business-Permissions invalid';
|
|
512
|
-
if (forward?.weight && !IsValidU64(forward.weight))
|
|
513
|
-
return 'Weight invalid';
|
|
514
|
-
return '';
|
|
515
|
-
}
|
|
516
|
-
static INITIAL_NODE_NAME = '';
|
|
517
|
-
static OPERATOR_ORDER_PAYER = 'OrderPayer';
|
|
518
|
-
}
|