wowok 1.0.3
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/community.d.ts +8 -0
- package/dist/community.js +96 -0
- package/dist/config.d.ts +19 -0
- package/dist/config.js +27 -0
- package/dist/demand.js +176 -0
- package/dist/guard.js +267 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/machine.js +259 -0
- package/dist/passport.js +89 -0
- package/dist/permission.js +217 -0
- package/dist/progress.js +143 -0
- package/dist/protocol.js +177 -0
- package/dist/repository.js +206 -0
- package/dist/reward.js +192 -0
- package/dist/service.js +698 -0
- package/dist/util.js +131 -0
- package/dist/vote.js +273 -0
- package/package.json +24 -0
- package/src/demand.ts +173 -0
- package/src/guard.ts +283 -0
- package/src/index.ts +0 -0
- package/src/machine.ts +257 -0
- package/src/passport.ts +110 -0
- package/src/permission.ts +224 -0
- package/src/progress.ts +139 -0
- package/src/protocol.ts +189 -0
- package/src/repository.ts +213 -0
- package/src/reward.ts +184 -0
- package/src/service.ts +686 -0
- package/src/util.ts +134 -0
- package/src/vote.ts +251 -0
- package/tsconfig.json +110 -0
package/dist/reward.js
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.change_permission = exports.deposit = exports.claim = exports.reward_lock_guards = exports.reward_set_description = exports.reward_remove_guard = exports.reward_add_guard = exports.reward_expand_time = exports.reward_refund = exports.destroy = exports.launch = exports.reward = void 0;
|
|
4
|
+
const bcs_1 = require("@mysten/bcs");
|
|
5
|
+
const protocol_1 = require("./protocol");
|
|
6
|
+
function reward(reward_type, txb, permission, description, minutes_duration, passport) {
|
|
7
|
+
if (passport) {
|
|
8
|
+
return txb.moveCall({
|
|
9
|
+
target: protocol_1.PROTOCOL.RewardFn('new_with_passport'),
|
|
10
|
+
arguments: [passport, txb.pure((0, protocol_1.description_data)(description)), txb.pure(minutes_duration, bcs_1.BCS.U64),
|
|
11
|
+
txb.object(protocol_1.CLOCK_OBJECT), permission],
|
|
12
|
+
typeArguments: [reward_type]
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
return txb.moveCall({
|
|
17
|
+
target: protocol_1.PROTOCOL.RewardFn('new'),
|
|
18
|
+
arguments: [txb.pure((0, protocol_1.description_data)(description)), txb.pure(minutes_duration, bcs_1.BCS.U64),
|
|
19
|
+
txb.object(protocol_1.CLOCK_OBJECT), permission],
|
|
20
|
+
typeArguments: [reward_type]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.reward = reward;
|
|
25
|
+
function launch(reward_type, txb, reward) {
|
|
26
|
+
return txb.moveCall({
|
|
27
|
+
target: protocol_1.PROTOCOL.RewardFn('create'),
|
|
28
|
+
arguments: [reward],
|
|
29
|
+
typeArguments: [reward_type]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
exports.launch = launch;
|
|
33
|
+
function destroy(reward_type, txb, reward) {
|
|
34
|
+
return txb.moveCall({
|
|
35
|
+
target: protocol_1.PROTOCOL.RewardFn('destroy'),
|
|
36
|
+
arguments: [reward],
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
exports.destroy = destroy;
|
|
40
|
+
function reward_refund(reward_type, txb, reward, permission, passport) {
|
|
41
|
+
if (passport) {
|
|
42
|
+
txb.moveCall({
|
|
43
|
+
target: protocol_1.PROTOCOL.RewardFn('refund_with_passport'),
|
|
44
|
+
arguments: [passport, reward, txb.object(protocol_1.CLOCK_OBJECT), permission],
|
|
45
|
+
typeArguments: [reward_type]
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
txb.moveCall({
|
|
50
|
+
target: protocol_1.PROTOCOL.RewardFn('refund'),
|
|
51
|
+
arguments: [reward, txb.object(protocol_1.CLOCK_OBJECT), permission],
|
|
52
|
+
typeArguments: [reward_type]
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.reward_refund = reward_refund;
|
|
57
|
+
function reward_expand_time(reward_type, txb, reward, permission, minutes_expand, passport) {
|
|
58
|
+
if (passport) {
|
|
59
|
+
txb.moveCall({
|
|
60
|
+
target: protocol_1.PROTOCOL.RewardFn('time_expand_with_passport'),
|
|
61
|
+
arguments: [passport, reward, txb.pure(minutes_expand, bcs_1.BCS.U64), permission],
|
|
62
|
+
typeArguments: [reward_type]
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
txb.moveCall({
|
|
67
|
+
target: protocol_1.PROTOCOL.RewardFn('time_expand'),
|
|
68
|
+
arguments: [reward, txb.pure(minutes_expand, bcs_1.BCS.U64), permission],
|
|
69
|
+
typeArguments: [reward_type]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.reward_expand_time = reward_expand_time;
|
|
74
|
+
function reward_add_guard(reward_type, txb, reward, permission, gurads, passport) {
|
|
75
|
+
if (passport) {
|
|
76
|
+
gurads.forEach((guard) => txb.moveCall({
|
|
77
|
+
target: protocol_1.PROTOCOL.RewardFn('guard_add_with_passport'),
|
|
78
|
+
arguments: [passport, reward, guard.guard, txb.pure(guard.portions, bcs_1.BCS.U64), permission],
|
|
79
|
+
typeArguments: [reward_type]
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
gurads.forEach((guard) => txb.moveCall({
|
|
84
|
+
target: protocol_1.PROTOCOL.RewardFn('guard_add'),
|
|
85
|
+
arguments: [reward, guard.guard, txb.pure(guard.portions, bcs_1.BCS.U64), permission],
|
|
86
|
+
typeArguments: [reward_type]
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.reward_add_guard = reward_add_guard;
|
|
91
|
+
function reward_remove_guard(reward_type, txb, reward, permission, guards, removeall, passport) {
|
|
92
|
+
if (passport) {
|
|
93
|
+
if (removeall) {
|
|
94
|
+
txb.moveCall({
|
|
95
|
+
target: protocol_1.PROTOCOL.RewardFn('guard_remove_all_with_passport'),
|
|
96
|
+
arguments: [passport, reward, permission],
|
|
97
|
+
typeArguments: [reward_type]
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
txb.moveCall({
|
|
102
|
+
target: protocol_1.PROTOCOL.RewardFn('guard_remove_with_passport'),
|
|
103
|
+
arguments: [passport, reward, txb.pure(guards, 'vector<address>'), permission],
|
|
104
|
+
typeArguments: [reward_type]
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
if (removeall) {
|
|
110
|
+
txb.moveCall({
|
|
111
|
+
target: protocol_1.PROTOCOL.RewardFn('guard_remove_all'),
|
|
112
|
+
arguments: [reward, permission],
|
|
113
|
+
typeArguments: [reward_type]
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
txb.moveCall({
|
|
118
|
+
target: protocol_1.PROTOCOL.RewardFn('guard_remove'),
|
|
119
|
+
arguments: [reward, txb.pure(guards, 'vector<address>'), permission],
|
|
120
|
+
typeArguments: [reward_type]
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
exports.reward_remove_guard = reward_remove_guard;
|
|
126
|
+
function reward_set_description(reward_type, txb, reward, permission, description, passport) {
|
|
127
|
+
if (passport) {
|
|
128
|
+
txb.moveCall({
|
|
129
|
+
target: protocol_1.PROTOCOL.RewardFn('description_set_with_passport'),
|
|
130
|
+
arguments: [passport, reward, txb.pure((0, protocol_1.description_data)(description)), permission],
|
|
131
|
+
typeArguments: [reward_type]
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
txb.moveCall({
|
|
136
|
+
target: protocol_1.PROTOCOL.RewardFn('description_set'),
|
|
137
|
+
arguments: [reward, txb.pure((0, protocol_1.description_data)(description)), permission],
|
|
138
|
+
typeArguments: [reward_type]
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
exports.reward_set_description = reward_set_description;
|
|
143
|
+
function reward_lock_guards(reward_type, txb, reward, permission, passport) {
|
|
144
|
+
if (passport) {
|
|
145
|
+
txb.moveCall({
|
|
146
|
+
target: protocol_1.PROTOCOL.RewardFn('guard_lock_with_passport'),
|
|
147
|
+
arguments: [passport, reward, permission],
|
|
148
|
+
typeArguments: [reward_type]
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
txb.moveCall({
|
|
153
|
+
target: protocol_1.PROTOCOL.RewardFn('guard_lock'),
|
|
154
|
+
arguments: [reward, permission],
|
|
155
|
+
typeArguments: [reward_type]
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
exports.reward_lock_guards = reward_lock_guards;
|
|
160
|
+
function claim(reward_type, txb, reward, passport) {
|
|
161
|
+
if (passport) {
|
|
162
|
+
txb.moveCall({
|
|
163
|
+
target: protocol_1.PROTOCOL.RewardFn('claim_with_passport'),
|
|
164
|
+
arguments: [passport, reward, txb.object(protocol_1.CLOCK_OBJECT)],
|
|
165
|
+
typeArguments: [reward_type]
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
txb.moveCall({
|
|
170
|
+
target: protocol_1.PROTOCOL.RewardFn('claim_with_passport'),
|
|
171
|
+
arguments: [reward, txb.object(protocol_1.CLOCK_OBJECT)],
|
|
172
|
+
typeArguments: [reward_type]
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
exports.claim = claim;
|
|
177
|
+
function deposit(reward_type, txb, reward, reward_objects) {
|
|
178
|
+
txb.moveCall({
|
|
179
|
+
target: protocol_1.PROTOCOL.RewardFn('deposit'),
|
|
180
|
+
arguments: [reward, txb.makeMoveVec({ objects: reward_objects })],
|
|
181
|
+
typeArguments: [reward_type]
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
exports.deposit = deposit;
|
|
185
|
+
function change_permission(reward_type, txb, reward, old_permission, new_permission) {
|
|
186
|
+
txb.moveCall({
|
|
187
|
+
target: protocol_1.PROTOCOL.RewardFn('permission_set'),
|
|
188
|
+
arguments: [reward, old_permission, new_permission],
|
|
189
|
+
typeArguments: [reward_type]
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
exports.change_permission = change_permission;
|