Skip to content

Commit 034cbee

Browse files
committed
Update factory
1 parent 695f9b0 commit 034cbee

File tree

2 files changed

+37
-36
lines changed

2 files changed

+37
-36
lines changed

src/multisig/multisigTransactionsFactory.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ describe("test multisig transactions factory", function () {
160160
to: destinationContract,
161161
functionName: "add",
162162
functionArguments: [7],
163+
optGasLimit: 5000000n,
163164
abi: adderAbi,
164165
});
165166

@@ -194,6 +195,7 @@ describe("test multisig transactions factory", function () {
194195
tokens: [tokenTransfer],
195196
functionName: "distribute",
196197
functionArguments: [],
198+
optGasLimit: 5000000n,
197199
});
198200

199201
assert.instanceOf(transaction, Transaction);
@@ -223,6 +225,7 @@ describe("test multisig transactions factory", function () {
223225
functionArguments: [7],
224226
tokenTransfers: [],
225227
abi: adderAbi,
228+
optGasLimit: 5000000n,
226229
});
227230

228231
assert.instanceOf(transaction, Transaction);

src/multisig/multisigTransactionsFactory.ts

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
BytesValue,
77
CodeMetadataValue,
88
EndpointDefinition,
9-
EndpointModifiers,
109
isTyped,
1110
NativeSerializer,
1211
OptionType,
@@ -77,8 +76,8 @@ export class MultisigTransactionsFactory {
7776
return this.smartContractFactory.createTransactionForExecute(sender, {
7877
contract: options.multisigContract,
7978
function: "proposeAddBoardMember",
80-
gasLimit: options.gasLimit ?? 0n,
81-
arguments: [new AddressValue(options.boardMember)],
79+
gasLimit: options.gasLimit,
80+
arguments: [options.boardMember],
8281
});
8382
}
8483

@@ -89,8 +88,8 @@ export class MultisigTransactionsFactory {
8988
return this.smartContractFactory.createTransactionForExecute(sender, {
9089
contract: options.multisigContract,
9190
function: "proposeAddProposer",
92-
gasLimit: options.gasLimit ?? 0n,
93-
arguments: [new AddressValue(options.proposer)],
91+
gasLimit: options.gasLimit,
92+
arguments: [options.proposer],
9493
});
9594
}
9695

@@ -101,8 +100,8 @@ export class MultisigTransactionsFactory {
101100
return this.smartContractFactory.createTransactionForExecute(sender, {
102101
contract: options.multisigContract,
103102
function: "proposeRemoveUser",
104-
gasLimit: options.gasLimit ?? 0n,
105-
arguments: [new AddressValue(options.userAddress)],
103+
gasLimit: options.gasLimit,
104+
arguments: [options.userAddress],
106105
});
107106
}
108107

@@ -113,8 +112,8 @@ export class MultisigTransactionsFactory {
113112
return this.smartContractFactory.createTransactionForExecute(sender, {
114113
contract: options.multisigContract,
115114
function: "proposeChangeQuorum",
116-
gasLimit: options.gasLimit ?? 0n,
117-
arguments: [new U32Value(options.newQuorum)],
115+
gasLimit: options.gasLimit,
116+
arguments: [options.newQuorum],
118117
});
119118
}
120119

@@ -137,7 +136,7 @@ export class MultisigTransactionsFactory {
137136
return this.smartContractFactory.createTransactionForExecute(sender, {
138137
contract: options.multisigContract,
139138
function: "proposeTransferExecute",
140-
gasLimit: options.gasLimit ?? 0n,
139+
gasLimit: options.gasLimit,
141140
arguments: [
142141
new AddressValue(options.to),
143142
new BigUIntValue(options.nativeTokenAmount),
@@ -154,7 +153,7 @@ export class MultisigTransactionsFactory {
154153
return this.smartContractFactory.createTransactionForExecute(sender, {
155154
contract: options.multisigContract,
156155
function: "deposit",
157-
gasLimit: options.gasLimit ?? 0n,
156+
gasLimit: options.gasLimit,
158157
arguments: [],
159158
nativeTransferAmount: options.nativeTokenAmount,
160159
tokenTransfers: options.tokenTransfers,
@@ -182,8 +181,7 @@ export class MultisigTransactionsFactory {
182181
...this.argSerializer.valuesToStrings(
183182
NativeSerializer.nativeToTypedValues(
184183
[options.to, tokenPayments, options.optGasLimit, VariadicValue.fromItems(...input.functionCall)],
185-
this.abi?.getEndpoint("proposeTransferExecuteEsdt") ??
186-
new EndpointDefinition("proposeTransferExecuteEsdt", [], [], new EndpointModifiers("", [])),
184+
this.abi.getEndpoint("proposeTransferExecuteEsdt"),
187185
),
188186
),
189187
];
@@ -226,7 +224,7 @@ export class MultisigTransactionsFactory {
226224
return this.smartContractFactory.createTransactionForExecute(sender, {
227225
contract: options.multisigContract,
228226
function: "proposeAsyncCall",
229-
gasLimit: options.gasLimit ?? 0n,
227+
gasLimit: options.gasLimit,
230228
arguments: [
231229
new AddressValue(options.to),
232230
new BigUIntValue(options.nativeTransferAmount),
@@ -247,7 +245,7 @@ export class MultisigTransactionsFactory {
247245
return this.smartContractFactory.createTransactionForExecute(sender, {
248246
contract: options.multisigContract,
249247
function: "proposeSCDeployFromSource",
250-
gasLimit: options.gasLimit ?? 0n,
248+
gasLimit: options.gasLimit,
251249
arguments: [
252250
new BigUIntValue(options.amount),
253251
new AddressValue(options.multisigContract),
@@ -268,7 +266,7 @@ export class MultisigTransactionsFactory {
268266
return this.smartContractFactory.createTransactionForExecute(sender, {
269267
contract: options.multisigContract,
270268
function: "proposeSCUpgradeFromSource",
271-
gasLimit: options.gasLimit ?? 0n,
269+
gasLimit: options.gasLimit,
272270
arguments: [
273271
new AddressValue(options.multisigContract),
274272
new BigUIntValue(options.amount),
@@ -286,8 +284,8 @@ export class MultisigTransactionsFactory {
286284
return this.smartContractFactory.createTransactionForExecute(sender, {
287285
contract: options.multisigContract,
288286
function: "sign",
289-
gasLimit: options.gasLimit ?? 0n,
290-
arguments: [new U32Value(options.actionId)],
287+
gasLimit: options.gasLimit,
288+
arguments: [options.actionId],
291289
});
292290
}
293291

@@ -298,8 +296,8 @@ export class MultisigTransactionsFactory {
298296
return this.smartContractFactory.createTransactionForExecute(sender, {
299297
contract: options.multisigContract,
300298
function: "signBatch",
301-
gasLimit: options.gasLimit ?? 0n,
302-
arguments: [new U32Value(options.groupId)],
299+
gasLimit: options.gasLimit,
300+
arguments: [options.groupId],
303301
});
304302
}
305303

@@ -310,8 +308,8 @@ export class MultisigTransactionsFactory {
310308
return this.smartContractFactory.createTransactionForExecute(sender, {
311309
contract: options.multisigContract,
312310
function: "signAndPerform",
313-
gasLimit: options.gasLimit ?? 0n,
314-
arguments: [new U32Value(options.actionId)],
311+
gasLimit: options.gasLimit,
312+
arguments: [options.actionId],
315313
});
316314
}
317315

@@ -322,8 +320,8 @@ export class MultisigTransactionsFactory {
322320
return this.smartContractFactory.createTransactionForExecute(sender, {
323321
contract: options.multisigContract,
324322
function: "signBatchAndPerform",
325-
gasLimit: options.gasLimit ?? 0n,
326-
arguments: [new U32Value(options.groupId)],
323+
gasLimit: options.gasLimit,
324+
arguments: [options.groupId],
327325
});
328326
}
329327

@@ -334,8 +332,8 @@ export class MultisigTransactionsFactory {
334332
return this.smartContractFactory.createTransactionForExecute(sender, {
335333
contract: options.multisigContract,
336334
function: "unsign",
337-
gasLimit: options.gasLimit ?? 0n,
338-
arguments: [new U32Value(options.actionId)],
335+
gasLimit: options.gasLimit,
336+
arguments: [options.actionId],
339337
});
340338
}
341339

@@ -346,8 +344,8 @@ export class MultisigTransactionsFactory {
346344
return this.smartContractFactory.createTransactionForExecute(sender, {
347345
contract: options.multisigContract,
348346
function: "unsignBatch",
349-
gasLimit: options.gasLimit ?? 0n,
350-
arguments: [new U32Value(options.groupId)],
347+
gasLimit: options.gasLimit,
348+
arguments: [options.groupId],
351349
});
352350
}
353351

@@ -362,7 +360,7 @@ export class MultisigTransactionsFactory {
362360
return this.smartContractFactory.createTransactionForExecute(sender, {
363361
contract: options.multisigContract,
364362
function: "unsignForOutdatedBoardMembers",
365-
gasLimit: options.gasLimit ?? 0n,
363+
gasLimit: options.gasLimit,
366364
arguments: [new U32Value(options.actionId), VariadicValue.fromItems(...outdatedBoardMembers)],
367365
});
368366
}
@@ -374,8 +372,8 @@ export class MultisigTransactionsFactory {
374372
return this.smartContractFactory.createTransactionForExecute(sender, {
375373
contract: options.multisigContract,
376374
function: "performAction",
377-
gasLimit: options.gasLimit ?? 0n,
378-
arguments: [new U32Value(options.actionId)],
375+
gasLimit: options.gasLimit,
376+
arguments: [options.actionId],
379377
});
380378
}
381379

@@ -386,8 +384,8 @@ export class MultisigTransactionsFactory {
386384
return this.smartContractFactory.createTransactionForExecute(sender, {
387385
contract: options.multisigContract,
388386
function: "performBatch",
389-
gasLimit: options.gasLimit ?? 0n,
390-
arguments: [new U32Value(options.groupId)],
387+
gasLimit: options.gasLimit,
388+
arguments: [options.groupId],
391389
});
392390
}
393391

@@ -398,8 +396,8 @@ export class MultisigTransactionsFactory {
398396
return this.smartContractFactory.createTransactionForExecute(sender, {
399397
contract: options.multisigContract,
400398
function: "discardAction",
401-
gasLimit: options.gasLimit ?? 0n,
402-
arguments: [new U32Value(options.actionId)],
399+
gasLimit: options.gasLimit,
400+
arguments: [options.actionId],
403401
});
404402
}
405403

@@ -411,7 +409,7 @@ export class MultisigTransactionsFactory {
411409
return this.smartContractFactory.createTransactionForExecute(sender, {
412410
contract: options.multisigContract,
413411
function: "discardBatch",
414-
gasLimit: options.gasLimit ?? 0n,
412+
gasLimit: options.gasLimit,
415413
arguments: [VariadicValue.fromItems(...actionIdsArgs)],
416414
});
417415
}

0 commit comments

Comments
 (0)