wowok 1.2.11 → 1.2.12
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 -3
- package/src/demand.ts +85 -98
- package/src/entity.ts +34 -34
- package/src/guard.ts +15 -15
- package/src/machine.ts +150 -174
- package/src/passport.ts +34 -37
- package/src/permission.ts +80 -96
- package/src/progress.ts +118 -118
- package/src/protocol.ts +25 -28
- package/src/repository.ts +147 -160
- package/src/resource.ts +43 -45
- package/src/reward.ts +108 -119
- package/src/service.ts +338 -364
- package/src/utils.ts +4 -4
- package/src/vote.ts +139 -157
- package/src/wowok.ts +19 -23
package/src/service.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { bcs, BCS, toHEX, fromHEX, getSuiMoveConfig } from '@mysten/bcs';
|
|
2
2
|
import { IsValidArray, IsValidPercent, IsValidName_AllowEmpty, Bcs, array_unique, IsValidTokenType, IsValidDesription,
|
|
3
|
-
IsValidAddress, IsValidEndpoint,
|
|
3
|
+
IsValidAddress, IsValidEndpoint, IsValidUintLarge, IsValidInt, IsValidName, } from './utils'
|
|
4
4
|
import { FnCallType, GuardObject, PassportObject, PermissionObject, RepositoryObject, MachineObject, ServiceAddress,
|
|
5
5
|
ServiceObject, DiscountObject, OrderObject, OrderAddress, CoinObject, Protocol, ValueType,
|
|
6
6
|
TxbObject} from './protocol';
|
|
7
7
|
import { ERROR, Errors } from './exception';
|
|
8
|
-
import {
|
|
8
|
+
import { type TransactionResult, Transaction as TransactionBlock } from '@mysten/sui/transactions';
|
|
9
9
|
|
|
10
10
|
export type Service_Guard_Percent = {
|
|
11
11
|
guard:GuardObject;
|
|
@@ -62,24 +62,24 @@ export class Service {
|
|
|
62
62
|
protected pay_token_type;
|
|
63
63
|
protected permission;
|
|
64
64
|
protected object : TxbObject;
|
|
65
|
-
protected
|
|
65
|
+
protected txb;
|
|
66
66
|
|
|
67
67
|
//static token2coin = (token:string) => { return '0x2::coin::Coin<' + token + '>'};
|
|
68
68
|
|
|
69
69
|
get_pay_type() { return this.pay_token_type }
|
|
70
70
|
get_object() { return this.object }
|
|
71
|
-
private constructor(
|
|
71
|
+
private constructor(txb: TransactionBlock, pay_token_type:string, permission:PermissionObject) {
|
|
72
72
|
this.pay_token_type = pay_token_type
|
|
73
|
-
this.
|
|
73
|
+
this.txb = txb
|
|
74
74
|
this.permission = permission
|
|
75
75
|
this.object = ''
|
|
76
76
|
}
|
|
77
|
-
static From(
|
|
78
|
-
let s = new Service(
|
|
79
|
-
s.object = Protocol.TXB_OBJECT(
|
|
77
|
+
static From(txb: TransactionBlock, token_type:string, permission:PermissionObject, object:TxbObject) : Service {
|
|
78
|
+
let s = new Service(txb, token_type, permission);
|
|
79
|
+
s.object = Protocol.TXB_OBJECT(txb, object);
|
|
80
80
|
return s
|
|
81
81
|
}
|
|
82
|
-
static New(
|
|
82
|
+
static New(txb: TransactionBlock, token_type:string, permission:PermissionObject, description:string,
|
|
83
83
|
payee_address:string, endpoint?:string, passport?:PassportObject) : Service {
|
|
84
84
|
if (!Protocol.IsValidObjects([permission])) {
|
|
85
85
|
ERROR(Errors.IsValidObjects)
|
|
@@ -99,21 +99,20 @@ export class Service {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
let pay_token_type = token_type;
|
|
102
|
-
let s = new Service(
|
|
103
|
-
let
|
|
104
|
-
let ep = endpoint? txb.pure(Bcs.getInstance().ser(ValueType.TYPE_OPTION_STRING, endpoint)) : OptionNone(txb);
|
|
102
|
+
let s = new Service(txb, pay_token_type, permission);
|
|
103
|
+
let ep = txb.pure.option('string', endpoint ? endpoint : undefined);
|
|
105
104
|
|
|
106
105
|
|
|
107
106
|
if (passport) {
|
|
108
107
|
s.object = txb.moveCall({
|
|
109
|
-
target:
|
|
110
|
-
arguments:[passport, txb.pure(description), txb.pure(payee_address
|
|
108
|
+
target:Protocol.Instance().ServiceFn('new_with_passport') as FnCallType,
|
|
109
|
+
arguments:[passport, txb.pure.string(description), txb.pure.address(payee_address), ep, Protocol.TXB_OBJECT(txb, permission)],
|
|
111
110
|
typeArguments:[pay_token_type],
|
|
112
111
|
})
|
|
113
112
|
} else {
|
|
114
113
|
s.object = txb.moveCall({
|
|
115
|
-
target:
|
|
116
|
-
arguments:[txb.pure(description), txb.pure(payee_address
|
|
114
|
+
target:Protocol.Instance().ServiceFn('new') as FnCallType,
|
|
115
|
+
arguments:[txb.pure.string(description), txb.pure.address(payee_address), ep, Protocol.TXB_OBJECT(txb, permission)],
|
|
117
116
|
typeArguments:[pay_token_type],
|
|
118
117
|
})
|
|
119
118
|
}
|
|
@@ -121,18 +120,16 @@ export class Service {
|
|
|
121
120
|
}
|
|
122
121
|
|
|
123
122
|
launch() : ServiceAddress {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object)],
|
|
123
|
+
return this.txb.moveCall({
|
|
124
|
+
target:Protocol.Instance().ServiceFn('create') as FnCallType,
|
|
125
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object)],
|
|
128
126
|
typeArguments:[this.pay_token_type]
|
|
129
127
|
})
|
|
130
128
|
}
|
|
131
129
|
destroy() {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
arguments: [Protocol.TXB_OBJECT(txb, this.object)],
|
|
130
|
+
this.txb.moveCall({
|
|
131
|
+
target:Protocol.Instance().ServiceFn('destroy') as FnCallType,
|
|
132
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object)],
|
|
136
133
|
typeArguments:[this.pay_token_type]
|
|
137
134
|
})
|
|
138
135
|
}
|
|
@@ -142,17 +139,16 @@ export class Service {
|
|
|
142
139
|
ERROR(Errors.IsValidDesription)
|
|
143
140
|
}
|
|
144
141
|
|
|
145
|
-
let txb = this.protocol.CurrentSession();
|
|
146
142
|
if (passport) {
|
|
147
|
-
txb.moveCall({
|
|
148
|
-
target:
|
|
149
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(description), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
143
|
+
this.txb.moveCall({
|
|
144
|
+
target:Protocol.Instance().ServiceFn('description_set_with_passport') as FnCallType,
|
|
145
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(description), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
150
146
|
typeArguments:[this.pay_token_type]
|
|
151
147
|
})
|
|
152
148
|
} else {
|
|
153
|
-
txb.moveCall({
|
|
154
|
-
target:
|
|
155
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(description), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
149
|
+
this.txb.moveCall({
|
|
150
|
+
target:Protocol.Instance().ServiceFn('description_set') as FnCallType,
|
|
151
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(description), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
156
152
|
typeArguments:[this.pay_token_type]
|
|
157
153
|
})
|
|
158
154
|
}
|
|
@@ -164,20 +160,21 @@ export class Service {
|
|
|
164
160
|
if (!IsValidName(item)) {
|
|
165
161
|
ERROR(Errors.IsValidName, 'item')
|
|
166
162
|
}
|
|
167
|
-
|
|
168
|
-
let txb = this.protocol.CurrentSession();
|
|
163
|
+
|
|
169
164
|
if (passport) {
|
|
170
|
-
txb.moveCall({
|
|
171
|
-
target:
|
|
172
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(item),
|
|
173
|
-
txb.pure(
|
|
165
|
+
this.txb.moveCall({
|
|
166
|
+
target:Protocol.Instance().ServiceFn('price_set_with_passport') as FnCallType,
|
|
167
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item),
|
|
168
|
+
this.txb.pure.u64(price),
|
|
169
|
+
this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
174
170
|
typeArguments:[this.pay_token_type]
|
|
175
171
|
})
|
|
176
172
|
} else {
|
|
177
|
-
txb.moveCall({
|
|
178
|
-
target:
|
|
179
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(item),
|
|
180
|
-
txb.pure(
|
|
173
|
+
this.txb.moveCall({
|
|
174
|
+
target:Protocol.Instance().ServiceFn('price_set') as FnCallType,
|
|
175
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item),
|
|
176
|
+
this.txb.pure.u64(price),
|
|
177
|
+
this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
181
178
|
typeArguments:[this.pay_token_type]
|
|
182
179
|
})
|
|
183
180
|
}
|
|
@@ -189,20 +186,21 @@ export class Service {
|
|
|
189
186
|
if (!IsValidInt(stock)) {
|
|
190
187
|
ERROR(Errors.IsValidInt, 'stock')
|
|
191
188
|
}
|
|
192
|
-
|
|
193
|
-
let txb = this.protocol.CurrentSession();
|
|
189
|
+
|
|
194
190
|
if (passport) {
|
|
195
|
-
txb.moveCall({
|
|
196
|
-
target:
|
|
197
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(item),
|
|
198
|
-
txb.pure(
|
|
191
|
+
this.txb.moveCall({
|
|
192
|
+
target:Protocol.Instance().ServiceFn('stock_set_with_passport') as FnCallType,
|
|
193
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item),
|
|
194
|
+
this.txb.pure.u64(stock),
|
|
195
|
+
this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
199
196
|
typeArguments:[this.pay_token_type]
|
|
200
197
|
})
|
|
201
198
|
} else {
|
|
202
|
-
txb.moveCall({
|
|
203
|
-
target:
|
|
204
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(item),
|
|
205
|
-
txb.pure(
|
|
199
|
+
this.txb.moveCall({
|
|
200
|
+
target:Protocol.Instance().ServiceFn('stock_set') as FnCallType,
|
|
201
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item),
|
|
202
|
+
this.txb.pure.u64(stock),
|
|
203
|
+
this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
206
204
|
typeArguments:[this.pay_token_type]
|
|
207
205
|
})
|
|
208
206
|
}
|
|
@@ -214,20 +212,21 @@ export class Service {
|
|
|
214
212
|
if (!IsValidUintLarge(stock_add)) {
|
|
215
213
|
ERROR(Errors.IsValidUint, 'stock_add')
|
|
216
214
|
}
|
|
217
|
-
|
|
218
|
-
let txb = this.protocol.CurrentSession();
|
|
215
|
+
|
|
219
216
|
if (passport) {
|
|
220
|
-
txb.moveCall({
|
|
221
|
-
target:
|
|
222
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(item),
|
|
223
|
-
txb.pure(
|
|
217
|
+
this.txb.moveCall({
|
|
218
|
+
target:Protocol.Instance().ServiceFn('stock_add_with_passport') as FnCallType,
|
|
219
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item),
|
|
220
|
+
this.txb.pure.u64(stock_add),
|
|
221
|
+
this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
224
222
|
typeArguments:[this.pay_token_type]
|
|
225
223
|
})
|
|
226
224
|
} else {
|
|
227
|
-
txb.moveCall({
|
|
228
|
-
target:
|
|
229
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(item),
|
|
230
|
-
txb.pure(
|
|
225
|
+
this.txb.moveCall({
|
|
226
|
+
target:Protocol.Instance().ServiceFn('stock_add') as FnCallType,
|
|
227
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item),
|
|
228
|
+
this.txb.pure.u64(stock_add),
|
|
229
|
+
this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
231
230
|
typeArguments:[this.pay_token_type]
|
|
232
231
|
})
|
|
233
232
|
}
|
|
@@ -240,44 +239,46 @@ export class Service {
|
|
|
240
239
|
ERROR(Errors.IsValidUint, 'stock_reduce')
|
|
241
240
|
}
|
|
242
241
|
|
|
243
|
-
let txb = this.protocol.CurrentSession();
|
|
244
242
|
if (passport) {
|
|
245
|
-
txb.moveCall({
|
|
246
|
-
target:
|
|
247
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(item),
|
|
248
|
-
txb.pure(
|
|
243
|
+
this.txb.moveCall({
|
|
244
|
+
target:Protocol.Instance().ServiceFn('stock_reduce_with_passport') as FnCallType,
|
|
245
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item),
|
|
246
|
+
this.txb.pure.u64(stock_reduce),
|
|
247
|
+
this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
249
248
|
typeArguments:[this.pay_token_type]
|
|
250
249
|
})
|
|
251
250
|
} else {
|
|
252
|
-
txb.moveCall({
|
|
253
|
-
target:
|
|
254
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(item),
|
|
255
|
-
txb.pure(
|
|
251
|
+
this.txb.moveCall({
|
|
252
|
+
target:Protocol.Instance().ServiceFn('stock_reduce') as FnCallType,
|
|
253
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item),
|
|
254
|
+
this.txb.pure.u64(stock_reduce),
|
|
255
|
+
this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
256
256
|
typeArguments:[this.pay_token_type]
|
|
257
257
|
})
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
-
|
|
260
|
+
|
|
261
|
+
set_sale_endpoint(item:string, endpoint?:string|null, bNotFoundAssert:boolean=true, passport?:PassportObject) {
|
|
261
262
|
if (!IsValidName(item)) {
|
|
262
263
|
ERROR(Errors.IsValidName, 'set_sale_endpoint')
|
|
263
264
|
}
|
|
264
265
|
if (endpoint && !IsValidEndpoint(endpoint)) {
|
|
265
266
|
ERROR(Errors.IsValidEndpoint, 'set_sale_endpoint')
|
|
266
267
|
}
|
|
267
|
-
|
|
268
|
-
let ep =
|
|
268
|
+
|
|
269
|
+
let ep = this.txb.pure.option('string', endpoint ? endpoint : undefined);
|
|
269
270
|
if (passport) {
|
|
270
|
-
txb.moveCall({
|
|
271
|
-
target:
|
|
272
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(item), ep,
|
|
273
|
-
txb.pure(bNotFoundAssert
|
|
271
|
+
this.txb.moveCall({
|
|
272
|
+
target:Protocol.Instance().ServiceFn('sale_endpoint_set_with_passport') as FnCallType,
|
|
273
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item), ep,
|
|
274
|
+
this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
274
275
|
typeArguments:[this.pay_token_type]
|
|
275
276
|
})
|
|
276
277
|
} else {
|
|
277
|
-
txb.moveCall({
|
|
278
|
-
target:
|
|
279
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(item), ep,
|
|
280
|
-
txb.pure(bNotFoundAssert
|
|
278
|
+
this.txb.moveCall({
|
|
279
|
+
target:Protocol.Instance().ServiceFn('sale_endpoint_set') as FnCallType,
|
|
280
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item), ep,
|
|
281
|
+
this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
281
282
|
typeArguments:[this.pay_token_type]
|
|
282
283
|
})
|
|
283
284
|
}
|
|
@@ -287,18 +288,17 @@ export class Service {
|
|
|
287
288
|
if (!IsValidAddress(payee)) {
|
|
288
289
|
ERROR(Errors.IsValidAddress, 'payee');
|
|
289
290
|
}
|
|
290
|
-
|
|
291
|
-
let txb = this.protocol.CurrentSession();
|
|
291
|
+
|
|
292
292
|
if (passport) {
|
|
293
|
-
txb.moveCall({
|
|
294
|
-
target:
|
|
295
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(payee
|
|
293
|
+
this.txb.moveCall({
|
|
294
|
+
target:Protocol.Instance().ServiceFn('payee_set_with_passport') as FnCallType,
|
|
295
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.address(payee), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
296
296
|
typeArguments:[this.pay_token_type]
|
|
297
297
|
})
|
|
298
298
|
} else {
|
|
299
|
-
txb.moveCall({
|
|
300
|
-
target:
|
|
301
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(payee
|
|
299
|
+
this.txb.moveCall({
|
|
300
|
+
target:Protocol.Instance().ServiceFn('payee_set') as FnCallType,
|
|
301
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.address(payee), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
302
302
|
typeArguments:[this.pay_token_type]
|
|
303
303
|
})
|
|
304
304
|
}
|
|
@@ -307,18 +307,17 @@ export class Service {
|
|
|
307
307
|
if (!Protocol.IsValidObjects([repository])) {
|
|
308
308
|
ERROR(Errors.IsValidObjects, 'repository_add');
|
|
309
309
|
}
|
|
310
|
-
|
|
311
|
-
let txb = this.protocol.CurrentSession();
|
|
310
|
+
|
|
312
311
|
if (passport) {
|
|
313
|
-
txb.moveCall({
|
|
314
|
-
target:
|
|
315
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, repository), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
312
|
+
this.txb.moveCall({
|
|
313
|
+
target:Protocol.Instance().ServiceFn('repository_add_with_passport') as FnCallType,
|
|
314
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, repository), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
316
315
|
typeArguments:[this.pay_token_type]
|
|
317
316
|
})
|
|
318
317
|
} else {
|
|
319
|
-
txb.moveCall({
|
|
320
|
-
target:
|
|
321
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, repository), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
318
|
+
this.txb.moveCall({
|
|
319
|
+
target:Protocol.Instance().ServiceFn('repository_add') as FnCallType,
|
|
320
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, repository), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
322
321
|
typeArguments:[this.pay_token_type]
|
|
323
322
|
})
|
|
324
323
|
}
|
|
@@ -329,35 +328,34 @@ export class Service {
|
|
|
329
328
|
if (!IsValidArray(repository_address, IsValidAddress)) {
|
|
330
329
|
ERROR(Errors.IsValidArray, 'repository_address');
|
|
331
330
|
}
|
|
332
|
-
|
|
333
|
-
let txb = this.protocol.CurrentSession();
|
|
331
|
+
|
|
334
332
|
if (passport) {
|
|
335
333
|
if (removeall) {
|
|
336
|
-
txb.moveCall({
|
|
337
|
-
target:
|
|
338
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
334
|
+
this.txb.moveCall({
|
|
335
|
+
target:Protocol.Instance().ServiceFn('repository_remove_all_with_passport') as FnCallType,
|
|
336
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
339
337
|
typeArguments:[this.pay_token_type]
|
|
340
338
|
})
|
|
341
339
|
} else {
|
|
342
|
-
txb.moveCall({
|
|
343
|
-
target:
|
|
344
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(array_unique(repository_address!)
|
|
345
|
-
Protocol.TXB_OBJECT(txb, this.permission)],
|
|
340
|
+
this.txb.moveCall({
|
|
341
|
+
target:Protocol.Instance().ServiceFn('repository_remove_with_passport') as FnCallType,
|
|
342
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(repository_address!)),
|
|
343
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
346
344
|
typeArguments:[this.pay_token_type]
|
|
347
345
|
})
|
|
348
346
|
}
|
|
349
347
|
} else {
|
|
350
348
|
if (removeall) {
|
|
351
|
-
txb.moveCall({
|
|
352
|
-
target:
|
|
353
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
349
|
+
this.txb.moveCall({
|
|
350
|
+
target:Protocol.Instance().ServiceFn('repository_remove_all') as FnCallType,
|
|
351
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
354
352
|
typeArguments:[this.pay_token_type]
|
|
355
353
|
})
|
|
356
354
|
} else {
|
|
357
|
-
txb.moveCall({
|
|
358
|
-
target:
|
|
359
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(array_unique(repository_address!)
|
|
360
|
-
Protocol.TXB_OBJECT(txb, this.permission)],
|
|
355
|
+
this.txb.moveCall({
|
|
356
|
+
target:Protocol.Instance().ServiceFn('repository_remove') as FnCallType,
|
|
357
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(repository_address!)),
|
|
358
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
361
359
|
typeArguments:[this.pay_token_type]
|
|
362
360
|
})
|
|
363
361
|
}
|
|
@@ -375,21 +373,20 @@ export class Service {
|
|
|
375
373
|
if (!bValid) {
|
|
376
374
|
ERROR(Errors.InvalidParam, 'guards')
|
|
377
375
|
}
|
|
378
|
-
|
|
379
|
-
let txb = this.protocol.CurrentSession();
|
|
376
|
+
|
|
380
377
|
guards.forEach((guard) => {
|
|
381
378
|
if (passport) {
|
|
382
|
-
txb.moveCall({
|
|
383
|
-
target:
|
|
384
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, guard.guard),
|
|
385
|
-
txb.pure(guard.percent
|
|
379
|
+
this.txb.moveCall({
|
|
380
|
+
target:Protocol.Instance().ServiceFn('withdraw_guard_add_with_passport') as FnCallType,
|
|
381
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, guard.guard),
|
|
382
|
+
this.txb.pure.u8(guard.percent), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
386
383
|
typeArguments:[this.pay_token_type]
|
|
387
384
|
})
|
|
388
385
|
} else {
|
|
389
|
-
txb.moveCall({
|
|
390
|
-
target:
|
|
391
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, guard.guard), txb.pure(guard.percent
|
|
392
|
-
Protocol.TXB_OBJECT(txb, this.permission)],
|
|
386
|
+
this.txb.moveCall({
|
|
387
|
+
target:Protocol.Instance().ServiceFn('withdraw_guard_add') as FnCallType,
|
|
388
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, guard.guard), this.txb.pure.u8(guard.percent),
|
|
389
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
393
390
|
typeArguments:[this.pay_token_type]
|
|
394
391
|
})
|
|
395
392
|
}
|
|
@@ -404,34 +401,33 @@ export class Service {
|
|
|
404
401
|
ERROR(Errors.IsValidArray, 'guard_address')
|
|
405
402
|
}
|
|
406
403
|
|
|
407
|
-
let txb = this.protocol.CurrentSession();
|
|
408
404
|
if (passport) {
|
|
409
405
|
if (removeall) {
|
|
410
|
-
txb.moveCall({
|
|
411
|
-
target:
|
|
412
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
406
|
+
this.txb.moveCall({
|
|
407
|
+
target:Protocol.Instance().ServiceFn('withdraw_guard_remove_all_with_passport') as FnCallType,
|
|
408
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
413
409
|
typeArguments:[this.pay_token_type]
|
|
414
410
|
})
|
|
415
411
|
} else {
|
|
416
|
-
txb.moveCall({
|
|
417
|
-
target:
|
|
418
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(array_unique(guard_address!)
|
|
419
|
-
Protocol.TXB_OBJECT(txb, this.permission)],
|
|
412
|
+
this.txb.moveCall({
|
|
413
|
+
target:Protocol.Instance().ServiceFn('withdraw_guard_remove_with_passport') as FnCallType,
|
|
414
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(guard_address!)),
|
|
415
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
420
416
|
typeArguments:[this.pay_token_type]
|
|
421
417
|
})
|
|
422
418
|
}
|
|
423
419
|
} else {
|
|
424
420
|
if (removeall) {
|
|
425
|
-
txb.moveCall({
|
|
426
|
-
target:
|
|
427
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
421
|
+
this.txb.moveCall({
|
|
422
|
+
target:Protocol.Instance().ServiceFn('withdraw_guard_remove_all') as FnCallType,
|
|
423
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
428
424
|
typeArguments:[this.pay_token_type]
|
|
429
425
|
})
|
|
430
426
|
} else {
|
|
431
|
-
txb.moveCall({
|
|
432
|
-
target:
|
|
433
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(array_unique(guard_address!)
|
|
434
|
-
Protocol.TXB_OBJECT(txb, this.permission)],
|
|
427
|
+
this.txb.moveCall({
|
|
428
|
+
target:Protocol.Instance().ServiceFn('withdraw_guard_remove') as FnCallType,
|
|
429
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(guard_address!)),
|
|
430
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
435
431
|
typeArguments:[this.pay_token_type]
|
|
436
432
|
})
|
|
437
433
|
}
|
|
@@ -449,20 +445,19 @@ export class Service {
|
|
|
449
445
|
ERROR(Errors.InvalidParam, 'guards')
|
|
450
446
|
}
|
|
451
447
|
|
|
452
|
-
let txb = this.protocol.CurrentSession();
|
|
453
448
|
guards.forEach((guard) => {
|
|
454
449
|
if (passport) {
|
|
455
|
-
txb.moveCall({
|
|
456
|
-
target:
|
|
457
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, guard.guard),
|
|
458
|
-
txb.pure(guard.percent
|
|
450
|
+
this.txb.moveCall({
|
|
451
|
+
target:Protocol.Instance().ServiceFn('refund_guard_add_with_passport') as FnCallType,
|
|
452
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, guard.guard),
|
|
453
|
+
this.txb.pure.u8(guard.percent), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
459
454
|
typeArguments:[this.pay_token_type]
|
|
460
455
|
})
|
|
461
456
|
} else {
|
|
462
|
-
txb.moveCall({
|
|
463
|
-
target:
|
|
464
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, guard.guard), txb.pure(guard.percent
|
|
465
|
-
Protocol.TXB_OBJECT(txb, this.permission)],
|
|
457
|
+
this.txb.moveCall({
|
|
458
|
+
target:Protocol.Instance().ServiceFn('refund_guard_add') as FnCallType,
|
|
459
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, guard.guard), this.txb.pure.u8(guard.percent),
|
|
460
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
466
461
|
typeArguments:[this.pay_token_type]
|
|
467
462
|
})
|
|
468
463
|
}
|
|
@@ -474,34 +469,33 @@ export class Service {
|
|
|
474
469
|
ERROR(Errors.InvalidParam, 'guard_address')
|
|
475
470
|
}
|
|
476
471
|
|
|
477
|
-
let txb = this.protocol.CurrentSession();
|
|
478
472
|
if (passport) {
|
|
479
473
|
if (removeall) {
|
|
480
|
-
txb.moveCall({
|
|
481
|
-
target:
|
|
482
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
474
|
+
this.txb.moveCall({
|
|
475
|
+
target:Protocol.Instance().ServiceFn('refund_guard_remove_all_with_passport') as FnCallType,
|
|
476
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
483
477
|
typeArguments:[this.pay_token_type]
|
|
484
478
|
})
|
|
485
479
|
} else {
|
|
486
|
-
txb.moveCall({
|
|
487
|
-
target:
|
|
488
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(array_unique(guard_address!)
|
|
489
|
-
Protocol.TXB_OBJECT(txb, this.permission)],
|
|
480
|
+
this.txb.moveCall({
|
|
481
|
+
target:Protocol.Instance().ServiceFn('refund_guard_remove_with_passport') as FnCallType,
|
|
482
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(guard_address!)),
|
|
483
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
490
484
|
typeArguments:[this.pay_token_type]
|
|
491
485
|
})
|
|
492
486
|
}
|
|
493
487
|
} else {
|
|
494
488
|
if (removeall) {
|
|
495
|
-
txb.moveCall({
|
|
496
|
-
target:
|
|
497
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
489
|
+
this.txb.moveCall({
|
|
490
|
+
target:Protocol.Instance().ServiceFn('refund_guard_remove_all') as FnCallType,
|
|
491
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
498
492
|
typeArguments:[this.pay_token_type]
|
|
499
493
|
})
|
|
500
494
|
} else {
|
|
501
|
-
txb.moveCall({
|
|
502
|
-
target:
|
|
503
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(array_unique(guard_address!)
|
|
504
|
-
Protocol.TXB_OBJECT(txb, this.permission)],
|
|
495
|
+
this.txb.moveCall({
|
|
496
|
+
target:Protocol.Instance().ServiceFn('refund_guard_remove') as FnCallType,
|
|
497
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(guard_address!)),
|
|
498
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
505
499
|
typeArguments:[this.pay_token_type]
|
|
506
500
|
})
|
|
507
501
|
}
|
|
@@ -534,25 +528,24 @@ export class Service {
|
|
|
534
528
|
}
|
|
535
529
|
names.push(s.item); price.push(s.price); stock.push(s.stock); endpoint.push(s.endpoint ?? '')
|
|
536
530
|
})
|
|
537
|
-
|
|
538
|
-
let txb = this.protocol.CurrentSession();
|
|
531
|
+
|
|
539
532
|
if (passport) {
|
|
540
|
-
txb.moveCall({
|
|
541
|
-
target:
|
|
542
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, names)),
|
|
543
|
-
txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, endpoint)), txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, price)),
|
|
544
|
-
txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, stock)), txb.pure(Bcs.getInstance().ser(ValueType.TYPE_BOOL, bExistAssert)),
|
|
545
|
-
Protocol.TXB_OBJECT(txb, this.permission)],
|
|
533
|
+
this.txb.moveCall({
|
|
534
|
+
target:Protocol.Instance().ServiceFn('sales_add_with_passport') as FnCallType,
|
|
535
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, names)),
|
|
536
|
+
this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, endpoint)), this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, price)),
|
|
537
|
+
this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, stock)), this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_BOOL, bExistAssert)),
|
|
538
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
546
539
|
typeArguments:[this.pay_token_type]
|
|
547
540
|
})
|
|
548
541
|
} else {
|
|
549
|
-
txb.moveCall({
|
|
550
|
-
target:
|
|
551
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, names)),
|
|
552
|
-
txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, endpoint)),
|
|
553
|
-
txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, price)), txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, stock)),
|
|
554
|
-
txb.pure(Bcs.getInstance().ser(ValueType.TYPE_BOOL, bExistAssert)),
|
|
555
|
-
Protocol.TXB_OBJECT(txb, this.permission)],
|
|
542
|
+
this.txb.moveCall({
|
|
543
|
+
target:Protocol.Instance().ServiceFn('sales_add') as FnCallType,
|
|
544
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, names)),
|
|
545
|
+
this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, endpoint)),
|
|
546
|
+
this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, price)), this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, stock)),
|
|
547
|
+
this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_BOOL, bExistAssert)),
|
|
548
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
556
549
|
typeArguments:[this.pay_token_type]
|
|
557
550
|
})
|
|
558
551
|
}
|
|
@@ -563,20 +556,19 @@ export class Service {
|
|
|
563
556
|
if (!IsValidArray(sales, IsValidName)) {
|
|
564
557
|
ERROR(Errors.IsValidArray, 'remove_sales')
|
|
565
558
|
}
|
|
566
|
-
|
|
567
|
-
let txb = this.protocol.CurrentSession();
|
|
559
|
+
|
|
568
560
|
if (passport) {
|
|
569
|
-
txb.moveCall({
|
|
570
|
-
target:
|
|
571
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, array_unique(sales!))),
|
|
572
|
-
Protocol.TXB_OBJECT(txb, this.permission)],
|
|
561
|
+
this.txb.moveCall({
|
|
562
|
+
target:Protocol.Instance().ServiceFn('sales_remove_with_passport') as FnCallType,
|
|
563
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, array_unique(sales!))),
|
|
564
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
573
565
|
typeArguments:[this.pay_token_type]
|
|
574
566
|
})
|
|
575
567
|
} else {
|
|
576
|
-
txb.moveCall({
|
|
577
|
-
target:
|
|
578
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, array_unique(sales!))),
|
|
579
|
-
Protocol.TXB_OBJECT(txb, this.permission)],
|
|
568
|
+
this.txb.moveCall({
|
|
569
|
+
target:Protocol.Instance().ServiceFn('sales_remove') as FnCallType,
|
|
570
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, array_unique(sales!))),
|
|
571
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
580
572
|
typeArguments:[this.pay_token_type]
|
|
581
573
|
})
|
|
582
574
|
}
|
|
@@ -600,32 +592,30 @@ export class Service {
|
|
|
600
592
|
if (!bValid) {
|
|
601
593
|
ERROR(Errors.InvalidParam, 'discount_dispatch')
|
|
602
594
|
}
|
|
603
|
-
|
|
604
|
-
let txb = this.protocol.CurrentSession();
|
|
595
|
+
const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
|
|
605
596
|
discount_dispatch.forEach((discount) => {
|
|
606
|
-
let price_greater = discount.discount?.price_greater
|
|
607
|
-
|
|
608
|
-
let time_start = discount.discount?.time_start ?
|
|
609
|
-
txb.pure(Bcs.getInstance().ser(ValueType.TYPE_OPTION_U64, discount.discount.time_start)) : OptionNone(txb);
|
|
597
|
+
let price_greater = this.txb.pure.option('u64', discount.discount?.price_greater);
|
|
598
|
+
let time_start = this.txb.pure.option('u64', discount.discount?.time_start);
|
|
610
599
|
|
|
611
600
|
if (passport) {
|
|
612
|
-
txb.moveCall({
|
|
613
|
-
target:
|
|
614
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(discount.discount.name),
|
|
615
|
-
txb.pure(discount.discount.type
|
|
616
|
-
txb.pure(discount.discount.off
|
|
617
|
-
txb.pure(discount.discount.duration_minutes,
|
|
618
|
-
Protocol.TXB_OBJECT(txb, this.permission), txb.pure(discount.receiver,
|
|
601
|
+
this.txb.moveCall({
|
|
602
|
+
target:Protocol.Instance().ServiceFn('dicscount_create_with_passport') as FnCallType,
|
|
603
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(discount.discount.name),
|
|
604
|
+
this.txb.pure.u8(discount.discount.type),
|
|
605
|
+
this.txb.pure.u64(discount.discount.off), price_greater, time_start,
|
|
606
|
+
this.txb.pure.u64(discount.discount.duration_minutes), this.txb.pure.u64(discount.count),
|
|
607
|
+
Protocol.TXB_OBJECT(this.txb, this.permission), this.txb.pure.address(discount.receiver), this.txb.object(clock)],
|
|
619
608
|
typeArguments:[this.pay_token_type]
|
|
620
609
|
});
|
|
621
610
|
} else {
|
|
622
|
-
txb.moveCall({
|
|
623
|
-
target:
|
|
624
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(discount.discount.name),
|
|
625
|
-
txb.pure(discount.discount.type
|
|
626
|
-
txb.pure(discount.discount.off
|
|
627
|
-
txb.pure(discount.discount.duration_minutes,
|
|
628
|
-
Protocol.TXB_OBJECT(txb, this.permission), txb.pure(discount.receiver
|
|
611
|
+
this.txb.moveCall({
|
|
612
|
+
target:Protocol.Instance().ServiceFn('dicscount_create') as FnCallType,
|
|
613
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(discount.discount.name),
|
|
614
|
+
this.txb.pure.u8(discount.discount.type),
|
|
615
|
+
this.txb.pure.u64(discount.discount.off), price_greater, time_start,
|
|
616
|
+
this.txb.pure.u64(discount.discount.duration_minutes), this.txb.pure.u64(discount.count),
|
|
617
|
+
Protocol.TXB_OBJECT(this.txb, this.permission), this.txb.pure.address(discount.receiver),
|
|
618
|
+
this.txb.object(clock)],
|
|
629
619
|
typeArguments:[this.pay_token_type]
|
|
630
620
|
})
|
|
631
621
|
}
|
|
@@ -637,82 +627,79 @@ export class Service {
|
|
|
637
627
|
if (!Protocol.IsValidObjects([order])) {
|
|
638
628
|
ERROR(Errors.IsValidObjects, 'order')
|
|
639
629
|
}
|
|
640
|
-
|
|
641
|
-
let txb = this.protocol.CurrentSession();
|
|
630
|
+
|
|
642
631
|
if (passport) {
|
|
643
|
-
txb.moveCall({
|
|
644
|
-
target:
|
|
645
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
632
|
+
this.txb.moveCall({
|
|
633
|
+
target:Protocol.Instance().ServiceFn('withdraw_with_passport') as FnCallType,
|
|
634
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
646
635
|
typeArguments:[this.pay_token_type]
|
|
647
636
|
})
|
|
648
637
|
} else {
|
|
649
|
-
txb.moveCall({
|
|
650
|
-
target:
|
|
651
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
638
|
+
this.txb.moveCall({
|
|
639
|
+
target:Protocol.Instance().ServiceFn('withdraw') as FnCallType,
|
|
640
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
652
641
|
typeArguments:[this.pay_token_type]
|
|
653
642
|
})
|
|
654
643
|
}
|
|
655
644
|
|
|
656
645
|
}
|
|
657
646
|
set_buy_guard(guard?:GuardObject, passport?:PassportObject) {
|
|
658
|
-
let txb = this.protocol.CurrentSession();
|
|
659
647
|
if (passport) {
|
|
660
648
|
if (guard) {
|
|
661
|
-
txb.moveCall({
|
|
662
|
-
target:
|
|
663
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, guard), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
649
|
+
this.txb.moveCall({
|
|
650
|
+
target:Protocol.Instance().ServiceFn('buy_guard_set_with_passport') as FnCallType,
|
|
651
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, guard), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
664
652
|
typeArguments:[this.pay_token_type]
|
|
665
653
|
})
|
|
666
654
|
} else {
|
|
667
|
-
txb.moveCall({
|
|
668
|
-
target:
|
|
669
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
655
|
+
this.txb.moveCall({
|
|
656
|
+
target:Protocol.Instance().ServiceFn('buy_guard_none_with_passport') as FnCallType,
|
|
657
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
670
658
|
typeArguments:[this.pay_token_type]
|
|
671
659
|
})
|
|
672
660
|
}
|
|
673
661
|
} else {
|
|
674
662
|
if (guard) {
|
|
675
|
-
txb.moveCall({
|
|
676
|
-
target:
|
|
677
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, guard), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
663
|
+
this.txb.moveCall({
|
|
664
|
+
target:Protocol.Instance().ServiceFn('buy_guard_set') as FnCallType,
|
|
665
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, guard), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
678
666
|
typeArguments:[this.pay_token_type]
|
|
679
667
|
})
|
|
680
668
|
} else {
|
|
681
|
-
txb.moveCall({
|
|
682
|
-
target:
|
|
683
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
669
|
+
this.txb.moveCall({
|
|
670
|
+
target:Protocol.Instance().ServiceFn('buy_guard_none') as FnCallType,
|
|
671
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
684
672
|
typeArguments:[this.pay_token_type]
|
|
685
673
|
})
|
|
686
674
|
}
|
|
687
675
|
}
|
|
688
676
|
}
|
|
689
677
|
set_machine(machine?:MachineObject, passport?:PassportObject) {
|
|
690
|
-
let txb = this.protocol.CurrentSession();
|
|
691
678
|
if (passport) {
|
|
692
679
|
if (machine) {
|
|
693
|
-
txb.moveCall({
|
|
694
|
-
target:
|
|
695
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, machine), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
680
|
+
this.txb.moveCall({
|
|
681
|
+
target:Protocol.Instance().ServiceFn('machine_set_with_passport') as FnCallType,
|
|
682
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, machine), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
696
683
|
typeArguments:[this.pay_token_type]
|
|
697
684
|
})
|
|
698
685
|
} else {
|
|
699
|
-
txb.moveCall({
|
|
700
|
-
target:
|
|
701
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
686
|
+
this.txb.moveCall({
|
|
687
|
+
target:Protocol.Instance().ServiceFn('machine_none_with_passport') as FnCallType,
|
|
688
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
702
689
|
typeArguments:[this.pay_token_type]
|
|
703
690
|
})
|
|
704
691
|
}
|
|
705
692
|
} else {
|
|
706
693
|
if (machine) {
|
|
707
|
-
txb.moveCall({
|
|
708
|
-
target:
|
|
709
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, machine), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
694
|
+
this.txb.moveCall({
|
|
695
|
+
target:Protocol.Instance().ServiceFn('machine_set') as FnCallType,
|
|
696
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, machine), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
710
697
|
typeArguments:[this.pay_token_type]
|
|
711
698
|
})
|
|
712
699
|
} else {
|
|
713
|
-
txb.moveCall({
|
|
714
|
-
target:
|
|
715
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
700
|
+
this.txb.moveCall({
|
|
701
|
+
target:Protocol.Instance().ServiceFn('machine_none') as FnCallType,
|
|
702
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
716
703
|
typeArguments:[this.pay_token_type]
|
|
717
704
|
})
|
|
718
705
|
}
|
|
@@ -724,52 +711,48 @@ export class Service {
|
|
|
724
711
|
ERROR(Errors.IsValidEndpoint);
|
|
725
712
|
}
|
|
726
713
|
|
|
727
|
-
let
|
|
728
|
-
let ep = endpoint? txb.pure(Bcs.getInstance().ser(ValueType.TYPE_OPTION_STRING, endpoint)) : OptionNone(txb);
|
|
729
|
-
|
|
714
|
+
let ep = this.txb.pure.option('string', endpoint ? endpoint : undefined);
|
|
730
715
|
if (passport) {
|
|
731
|
-
txb.moveCall({
|
|
732
|
-
target:
|
|
733
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), ep, Protocol.TXB_OBJECT(txb, this.permission)],
|
|
716
|
+
this.txb.moveCall({
|
|
717
|
+
target:Protocol.Instance().ServiceFn('endpoint_set_with_passport') as FnCallType,
|
|
718
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), ep, Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
734
719
|
typeArguments:[this.pay_token_type]
|
|
735
720
|
})
|
|
736
721
|
} else {
|
|
737
|
-
txb.moveCall({
|
|
738
|
-
target:
|
|
739
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), ep, Protocol.TXB_OBJECT(txb, this.permission)],
|
|
722
|
+
this.txb.moveCall({
|
|
723
|
+
target:Protocol.Instance().ServiceFn('endpoint_set') as FnCallType,
|
|
724
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), ep, Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
740
725
|
typeArguments:[this.pay_token_type]
|
|
741
726
|
})
|
|
742
727
|
}
|
|
743
728
|
}
|
|
744
729
|
publish(passport?:PassportObject) {
|
|
745
|
-
let txb = this.protocol.CurrentSession();
|
|
746
730
|
if (passport) {
|
|
747
|
-
txb.moveCall({
|
|
748
|
-
target:
|
|
749
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
731
|
+
this.txb.moveCall({
|
|
732
|
+
target:Protocol.Instance().ServiceFn('publish_with_passport') as FnCallType,
|
|
733
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
750
734
|
typeArguments:[this.pay_token_type]
|
|
751
735
|
})
|
|
752
736
|
} else {
|
|
753
|
-
txb.moveCall({
|
|
754
|
-
target:
|
|
755
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
737
|
+
this.txb.moveCall({
|
|
738
|
+
target:Protocol.Instance().ServiceFn('publish') as FnCallType,
|
|
739
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
756
740
|
typeArguments:[this.pay_token_type]
|
|
757
741
|
})
|
|
758
742
|
}
|
|
759
743
|
|
|
760
744
|
}
|
|
761
745
|
clone(passport?:PassportObject) : ServiceObject {
|
|
762
|
-
let txb = this.protocol.CurrentSession();
|
|
763
746
|
if (passport) {
|
|
764
|
-
return txb.moveCall({
|
|
765
|
-
target:
|
|
766
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
747
|
+
return this.txb.moveCall({
|
|
748
|
+
target:Protocol.Instance().ServiceFn('clone_withpassport') as FnCallType,
|
|
749
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
767
750
|
typeArguments:[this.pay_token_type]
|
|
768
751
|
})
|
|
769
752
|
} else {
|
|
770
|
-
return txb.moveCall({
|
|
771
|
-
target:
|
|
772
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
753
|
+
return this.txb.moveCall({
|
|
754
|
+
target:Protocol.Instance().ServiceFn('clone') as FnCallType,
|
|
755
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
773
756
|
typeArguments:[this.pay_token_type]
|
|
774
757
|
})
|
|
775
758
|
}
|
|
@@ -784,37 +767,36 @@ export class Service {
|
|
|
784
767
|
}
|
|
785
768
|
|
|
786
769
|
let req = array_unique(customer_required) as string[];
|
|
787
|
-
|
|
770
|
+
|
|
788
771
|
if (passport) {
|
|
789
|
-
txb.moveCall({
|
|
790
|
-
target:
|
|
791
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object),
|
|
792
|
-
txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, req)),
|
|
793
|
-
txb.pure(pubkey
|
|
772
|
+
this.txb.moveCall({
|
|
773
|
+
target:Protocol.Instance().ServiceFn('required_set_with_passport') as FnCallType,
|
|
774
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object),
|
|
775
|
+
this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, req)),
|
|
776
|
+
this.txb.pure.string(pubkey), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
794
777
|
typeArguments:[this.pay_token_type]
|
|
795
778
|
})
|
|
796
779
|
} else {
|
|
797
|
-
txb.moveCall({
|
|
798
|
-
target:
|
|
799
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object),
|
|
800
|
-
txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, req)),
|
|
801
|
-
txb.pure(pubkey
|
|
780
|
+
this.txb.moveCall({
|
|
781
|
+
target:Protocol.Instance().ServiceFn('required_set') as FnCallType,
|
|
782
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object),
|
|
783
|
+
this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, req)),
|
|
784
|
+
this.txb.pure.string(pubkey), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
802
785
|
typeArguments:[this.pay_token_type]
|
|
803
786
|
})
|
|
804
787
|
}
|
|
805
788
|
}
|
|
806
789
|
remove_customer_required(passport?:PassportObject) {
|
|
807
|
-
let txb = this.protocol.CurrentSession();
|
|
808
790
|
if (passport) {
|
|
809
|
-
txb.moveCall({
|
|
810
|
-
target:
|
|
811
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
791
|
+
this.txb.moveCall({
|
|
792
|
+
target:Protocol.Instance().ServiceFn('required_none_with_passport') as FnCallType,
|
|
793
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
812
794
|
typeArguments:[this.pay_token_type]
|
|
813
795
|
})
|
|
814
796
|
} else {
|
|
815
|
-
txb.moveCall({
|
|
816
|
-
target:
|
|
817
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
797
|
+
this.txb.moveCall({
|
|
798
|
+
target:Protocol.Instance().ServiceFn('required_none') as FnCallType,
|
|
799
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
818
800
|
typeArguments:[this.pay_token_type]
|
|
819
801
|
})
|
|
820
802
|
}
|
|
@@ -823,20 +805,19 @@ export class Service {
|
|
|
823
805
|
if (!pubkey) {
|
|
824
806
|
ERROR(Errors.InvalidParam, 'pubkey')
|
|
825
807
|
}
|
|
826
|
-
|
|
827
|
-
let txb = this.protocol.CurrentSession();
|
|
808
|
+
|
|
828
809
|
if (passport) {
|
|
829
|
-
txb.moveCall({
|
|
830
|
-
target:
|
|
831
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(pubkey
|
|
832
|
-
Protocol.TXB_OBJECT(txb, this.permission)],
|
|
810
|
+
this.txb.moveCall({
|
|
811
|
+
target:Protocol.Instance().ServiceFn('required_pubkey_set_with_passport') as FnCallType,
|
|
812
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(pubkey),
|
|
813
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
833
814
|
typeArguments:[this.pay_token_type]
|
|
834
815
|
})
|
|
835
816
|
} else {
|
|
836
|
-
txb.moveCall({
|
|
837
|
-
target:
|
|
838
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(pubkey
|
|
839
|
-
Protocol.TXB_OBJECT(txb, this.permission)],
|
|
817
|
+
this.txb.moveCall({
|
|
818
|
+
target:Protocol.Instance().ServiceFn('required_pubkey_set') as FnCallType,
|
|
819
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(pubkey),
|
|
820
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
840
821
|
typeArguments:[this.pay_token_type]
|
|
841
822
|
})
|
|
842
823
|
}
|
|
@@ -848,36 +829,34 @@ export class Service {
|
|
|
848
829
|
if (!pubkey) {
|
|
849
830
|
ERROR(Errors.InvalidParam, 'pubkey')
|
|
850
831
|
}
|
|
851
|
-
|
|
852
|
-
let txb = this.protocol.CurrentSession();
|
|
832
|
+
|
|
853
833
|
if (passport) {
|
|
854
|
-
txb.moveCall({
|
|
855
|
-
target:
|
|
856
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order), txb.pure(pubkey
|
|
857
|
-
Protocol.TXB_OBJECT(txb, this.permission)],
|
|
834
|
+
this.txb.moveCall({
|
|
835
|
+
target:Protocol.Instance().ServiceFn('order_pubkey_update_with_passport') as FnCallType,
|
|
836
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), this.txb.pure.string(pubkey),
|
|
837
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
858
838
|
typeArguments:[this.pay_token_type]
|
|
859
839
|
})
|
|
860
840
|
} else {
|
|
861
|
-
txb.moveCall({
|
|
862
|
-
target:
|
|
863
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order), txb.pure(pubkey
|
|
864
|
-
Protocol.TXB_OBJECT(txb, this.permission)],
|
|
841
|
+
this.txb.moveCall({
|
|
842
|
+
target:Protocol.Instance().ServiceFn('order_pubkey_update') as FnCallType,
|
|
843
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), this.txb.pure.string(pubkey),
|
|
844
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
865
845
|
typeArguments:[this.pay_token_type]
|
|
866
846
|
})
|
|
867
847
|
}
|
|
868
848
|
}
|
|
869
849
|
pause(pause:boolean, passport?:PassportObject) {
|
|
870
|
-
let txb = this.protocol.CurrentSession();
|
|
871
850
|
if (passport) {
|
|
872
|
-
txb.moveCall({
|
|
873
|
-
target:
|
|
874
|
-
arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(pause
|
|
851
|
+
this.txb.moveCall({
|
|
852
|
+
target:Protocol.Instance().ServiceFn('pause_with_passport') as FnCallType,
|
|
853
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.bool(pause), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
875
854
|
typeArguments:[this.pay_token_type]
|
|
876
855
|
})
|
|
877
856
|
} else {
|
|
878
|
-
txb.moveCall({
|
|
879
|
-
target:
|
|
880
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(pause
|
|
857
|
+
this.txb.moveCall({
|
|
858
|
+
target:Protocol.Instance().ServiceFn('pause') as FnCallType,
|
|
859
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.bool(pause), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
881
860
|
typeArguments:[this.pay_token_type]
|
|
882
861
|
})
|
|
883
862
|
}
|
|
@@ -888,17 +867,16 @@ export class Service {
|
|
|
888
867
|
ERROR(Errors.IsValidObjects, 'order')
|
|
889
868
|
}
|
|
890
869
|
|
|
891
|
-
let txb = this.protocol.CurrentSession();
|
|
892
870
|
if (passport) {
|
|
893
|
-
txb.moveCall({
|
|
894
|
-
target:
|
|
895
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order), passport],
|
|
871
|
+
this.txb.moveCall({
|
|
872
|
+
target:Protocol.Instance().ServiceFn('refund_with_passport') as FnCallType,
|
|
873
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), passport],
|
|
896
874
|
typeArguments:[this.pay_token_type]
|
|
897
875
|
})
|
|
898
876
|
} else {
|
|
899
|
-
txb.moveCall({
|
|
900
|
-
target:
|
|
901
|
-
arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order)],
|
|
877
|
+
this.txb.moveCall({
|
|
878
|
+
target:Protocol.Instance().ServiceFn('refund') as FnCallType,
|
|
879
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order)],
|
|
902
880
|
typeArguments:[this.pay_token_type]
|
|
903
881
|
})
|
|
904
882
|
}
|
|
@@ -911,14 +889,13 @@ export class Service {
|
|
|
911
889
|
if (!customer_info_crypto.pubkey || !customer_info_crypto.customer_info_crypt) {
|
|
912
890
|
ERROR(Errors.InvalidParam, 'customer_info_crypto')
|
|
913
891
|
}
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
txb.pure(customer_info_crypto.
|
|
920
|
-
txb.pure(
|
|
921
|
-
txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_VEC_U8, array_unique(customer_info_crypto.customer_info_crypt)))],
|
|
892
|
+
|
|
893
|
+
this.txb.moveCall({
|
|
894
|
+
target:Protocol.Instance().ServiceFn('order_required_info_update') as FnCallType,
|
|
895
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order),
|
|
896
|
+
this.txb.pure.string(customer_info_crypto.pubkey),
|
|
897
|
+
this.txb.pure.string(customer_info_crypto.customer_pubkey),
|
|
898
|
+
this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_VEC_U8, array_unique(customer_info_crypto.customer_info_crypt)))],
|
|
922
899
|
typeArguments:[this.pay_token_type]
|
|
923
900
|
})
|
|
924
901
|
|
|
@@ -944,42 +921,41 @@ export class Service {
|
|
|
944
921
|
|
|
945
922
|
let name:string[] = []; let price:number[] = []; let stock:number[] = []; let order;
|
|
946
923
|
buy_items.forEach((b) => { name.push(b.item); price.push(b.max_price); stock.push(b.count)})
|
|
947
|
-
|
|
948
|
-
let txb = this.protocol.CurrentSession();
|
|
924
|
+
const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
|
|
949
925
|
if (passport) {
|
|
950
926
|
if (discount) {
|
|
951
|
-
order = txb.moveCall({
|
|
952
|
-
target:
|
|
953
|
-
arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, name)),
|
|
954
|
-
txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, price)), txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, stock)),
|
|
955
|
-
Protocol.TXB_OBJECT(txb, coin), Protocol.TXB_OBJECT(txb, discount), txb.object(
|
|
927
|
+
order = this.txb.moveCall({
|
|
928
|
+
target:Protocol.Instance().ServiceFn('dicount_buy_with_passport') as FnCallType,
|
|
929
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, name)),
|
|
930
|
+
this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, price)), this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, stock)),
|
|
931
|
+
Protocol.TXB_OBJECT(this.txb, coin), Protocol.TXB_OBJECT(this.txb, discount), this.txb.object(clock)],
|
|
956
932
|
typeArguments:[this.pay_token_type]
|
|
957
933
|
})} else {
|
|
958
|
-
order = txb.moveCall({
|
|
959
|
-
target:
|
|
960
|
-
arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, name)),
|
|
961
|
-
txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, price)),
|
|
962
|
-
txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, stock)),
|
|
963
|
-
Protocol.TXB_OBJECT(txb, coin)],
|
|
934
|
+
order = this.txb.moveCall({
|
|
935
|
+
target:Protocol.Instance().ServiceFn('buy_with_passport') as FnCallType,
|
|
936
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, name)),
|
|
937
|
+
this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, price)),
|
|
938
|
+
this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, stock)),
|
|
939
|
+
Protocol.TXB_OBJECT(this.txb, coin)],
|
|
964
940
|
typeArguments:[this.pay_token_type]
|
|
965
941
|
})}
|
|
966
942
|
} else {
|
|
967
943
|
if (discount) {
|
|
968
|
-
order = txb.moveCall({
|
|
969
|
-
target:
|
|
970
|
-
arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure
|
|
971
|
-
txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, price)),
|
|
972
|
-
txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, stock)),
|
|
973
|
-
Protocol.TXB_OBJECT(txb, coin),
|
|
974
|
-
Protocol.TXB_OBJECT(txb, discount), txb.object(
|
|
944
|
+
order = this.txb.moveCall({
|
|
945
|
+
target:Protocol.Instance().ServiceFn('disoucnt_buy') as FnCallType,
|
|
946
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('string', name),
|
|
947
|
+
this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, price)),
|
|
948
|
+
this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, stock)),
|
|
949
|
+
Protocol.TXB_OBJECT(this.txb, coin),
|
|
950
|
+
Protocol.TXB_OBJECT(this.txb, discount), this.txb.object(clock)],
|
|
975
951
|
typeArguments:[this.pay_token_type]
|
|
976
952
|
})} else {
|
|
977
|
-
order = txb.moveCall({
|
|
978
|
-
target:
|
|
979
|
-
arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure
|
|
980
|
-
txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, price)),
|
|
981
|
-
txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, stock)),
|
|
982
|
-
Protocol.TXB_OBJECT(txb, coin)],
|
|
953
|
+
order = this.txb.moveCall({
|
|
954
|
+
target:Protocol.Instance().ServiceFn('buy') as FnCallType,
|
|
955
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('string', name),
|
|
956
|
+
this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, price)),
|
|
957
|
+
this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, stock)),
|
|
958
|
+
Protocol.TXB_OBJECT(this.txb, coin)],
|
|
983
959
|
typeArguments:[this.pay_token_type]
|
|
984
960
|
})}
|
|
985
961
|
}
|
|
@@ -989,15 +965,15 @@ export class Service {
|
|
|
989
965
|
}
|
|
990
966
|
|
|
991
967
|
if (machine) {
|
|
992
|
-
return txb.moveCall({
|
|
993
|
-
target:
|
|
994
|
-
arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order), Protocol.TXB_OBJECT(txb, machine)],
|
|
968
|
+
return this.txb.moveCall({
|
|
969
|
+
target:Protocol.Instance().ServiceFn('order_create_with_machine') as FnCallType,
|
|
970
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), Protocol.TXB_OBJECT(this.txb, machine)],
|
|
995
971
|
typeArguments:[this.pay_token_type]
|
|
996
972
|
})
|
|
997
973
|
} else {
|
|
998
|
-
return txb.moveCall({
|
|
999
|
-
target:
|
|
1000
|
-
arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order)],
|
|
974
|
+
return this.txb.moveCall({
|
|
975
|
+
target:Protocol.Instance().ServiceFn('order_create') as FnCallType,
|
|
976
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order)],
|
|
1001
977
|
typeArguments:[this.pay_token_type]
|
|
1002
978
|
})
|
|
1003
979
|
}
|
|
@@ -1008,10 +984,9 @@ export class Service {
|
|
|
1008
984
|
ERROR(Errors.IsValidObjects, 'order & machine');
|
|
1009
985
|
}
|
|
1010
986
|
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order), Protocol.TXB_OBJECT(txb, machine)],
|
|
987
|
+
this.txb.moveCall({
|
|
988
|
+
target:Protocol.Instance().ServiceFn('order_create_with_machine') as FnCallType,
|
|
989
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), Protocol.TXB_OBJECT(this.txb, machine)],
|
|
1015
990
|
typeArguments:[this.pay_token_type]
|
|
1016
991
|
})
|
|
1017
992
|
}
|
|
@@ -1021,10 +996,9 @@ export class Service {
|
|
|
1021
996
|
ERROR(Errors.IsValidObjects)
|
|
1022
997
|
}
|
|
1023
998
|
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission), Protocol.TXB_OBJECT(txb, new_permission)],
|
|
999
|
+
this.txb.moveCall({
|
|
1000
|
+
target:Protocol.Instance().ServiceFn('permission_set') as FnCallType,
|
|
1001
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission), Protocol.TXB_OBJECT(this.txb, new_permission)],
|
|
1028
1002
|
typeArguments:[this.pay_token_type]
|
|
1029
1003
|
})
|
|
1030
1004
|
this.permission = new_permission
|