aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract_templates/partials/tx.handlebars
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-11-22 21:16:08 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-11-22 21:48:15 +0800
commit06cc66005cf0713fcc877ae67b51b38fb110b09d (patch)
tree9823f26c8f83f5051aa2b5a6068fe9c542eaeb4c /packages/contract_templates/partials/tx.handlebars
parenta5359df002d121c1b7c1f29e8a2bd8b351090ee3 (diff)
downloaddexon-sol-tools-06cc66005cf0713fcc877ae67b51b38fb110b09d.tar
dexon-sol-tools-06cc66005cf0713fcc877ae67b51b38fb110b09d.tar.gz
dexon-sol-tools-06cc66005cf0713fcc877ae67b51b38fb110b09d.tar.bz2
dexon-sol-tools-06cc66005cf0713fcc877ae67b51b38fb110b09d.tar.lz
dexon-sol-tools-06cc66005cf0713fcc877ae67b51b38fb110b09d.tar.xz
dexon-sol-tools-06cc66005cf0713fcc877ae67b51b38fb110b09d.tar.zst
dexon-sol-tools-06cc66005cf0713fcc877ae67b51b38fb110b09d.zip
Make contract-templates an npm package
Diffstat (limited to 'packages/contract_templates/partials/tx.handlebars')
-rw-r--r--packages/contract_templates/partials/tx.handlebars60
1 files changed, 0 insertions, 60 deletions
diff --git a/packages/contract_templates/partials/tx.handlebars b/packages/contract_templates/partials/tx.handlebars
deleted file mode 100644
index b39156583..000000000
--- a/packages/contract_templates/partials/tx.handlebars
+++ /dev/null
@@ -1,60 +0,0 @@
-public {{this.tsName}} = {
- async sendTransactionAsync(
- {{> typed_params inputs=inputs}}
- {{#this.payable}}
- txData: Partial<TxDataPayable> = {},
- {{/this.payable}}
- {{^this.payable}}
- txData: Partial<TxData> = {},
- {{/this.payable}}
- ): Promise<string> {
- const self = this as any as {{contractName}}Contract;
- const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs;
- [{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [{{> params inputs=inputs}}]);
- const encodedData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}.encode([{{> params inputs=inputs}}]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- self.{{this.tsName}}.estimateGasAsync.bind(
- self,
- {{> params inputs=inputs}}
- ),
- );
- const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
- return txHash;
- },
- async estimateGasAsync(
- {{> typed_params inputs=inputs}}
- txData: Partial<TxData> = {},
- ): Promise<number> {
- const self = this as any as {{contractName}}Contract;
- const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs;
- [{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}.encode([{{> params inputs=inputs}}]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- {{> typed_params inputs=inputs}}
- ): string {
- const self = this as any as {{contractName}}Contract;
- const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs;
- [{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}.encode([{{> params inputs=inputs}}]);
- return abiEncodedTransactionData;
- },
- {{> callAsync}}
-};