Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit d0b9122

Browse files
committed
Add encodeCreation() method
1 parent 3abb12d commit d0b9122

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

packages/encoder/lib/encoders.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,6 +1295,40 @@ export class ContractEncoder {
12951295
);
12961296
}
12971297

1298+
/**
1299+
* **This method is asynchronous.**
1300+
*
1301+
* This method is similar to [[encodeTransaction]], except that instead of
1302+
* encoding a function transaction, it encodes a creation transaction.
1303+
*
1304+
* Because this method does not perform overload resolution, it only returns
1305+
* the resulting transaction options (including the encoded `data`), and does
1306+
* not bother returning the ABI used (as this was user-supplied.)
1307+
*
1308+
* If the `allowOptions` flag is set in the `options` argument, the input may
1309+
* contain an additional transaction options argument after the other
1310+
* arguments. Any non-`data` options not specified in such a transaction
1311+
* options argument will be simply omitted; it you want some options to have
1312+
* defaults, it is up to the you to set these options as appropriate
1313+
* afterwards.
1314+
*
1315+
* If the transaction options parameter has a `data` or a `to` option,
1316+
* these option will be recognized but ignored.
1317+
*
1318+
* See [[encodeTransaction]] for documentation of the inputs.
1319+
*/
1320+
public async encodeCreation(
1321+
inputs: unknown[],
1322+
options: Types.ResolveOptions = {}
1323+
): Promise<Codec.Options> {
1324+
const method = this.getConstructorMethod();
1325+
return await this.projectEncoder.encodeTxNoResolution(
1326+
method,
1327+
inputs,
1328+
options
1329+
);
1330+
}
1331+
12981332
/**
12991333
* **This method is asynchronous.**
13001334
*

0 commit comments

Comments
 (0)