This repository has been archived by the owner on Sep 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8b4671f
commit 722687d
Showing
13 changed files
with
561 additions
and
361 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
semi: true, | ||
trailingComma: 'all', | ||
singleQuote: true, | ||
printWidth: 120, | ||
tabWidth: 2, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
name: '{{name}}', | ||
type: '{{type}}',{{#if (isDefined indexed)}} | ||
indexed: {{indexed}},{{/if}}{{#if components}} | ||
components: [ | ||
{{#each components}} | ||
{{> abi_type this}} | ||
{{/each}} | ||
]{{/if}} | ||
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
public {{this.tsName}} = { | ||
public {{languageSpecificName}} = { | ||
{{> callAsync}} | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,46 @@ | ||
async callAsync( | ||
{{> typed_params inputs=inputs}} | ||
callData: Partial<CallData> = {}, | ||
callData: Partial<CallData> = {}, | ||
defaultBlock?: BlockParam, | ||
): Promise<{{> return_type outputs=outputs}}> { | ||
{{#each inputs}} | ||
{{#assertionType name type}}{{/assertionType}} | ||
{{/each}} | ||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ | ||
schemas.addressSchema, | ||
schemas.numberSchema, | ||
schemas.jsNumber, | ||
]); | ||
if (defaultBlock !== undefined) { | ||
assert.isBlockParam('defaultBlock', defaultBlock); | ||
} | ||
const self = this as any as {{contractName}}Contract; | ||
const encodedData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> params inputs=inputs}}]); | ||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( | ||
{ | ||
to: self.address, | ||
...callData, | ||
data: encodedData, | ||
}, | ||
self._web3Wrapper.getContractDefaults(), | ||
{ | ||
to: self.address, | ||
...callData, | ||
data: encodedData, | ||
}, | ||
self._web3Wrapper.getContractDefaults(), | ||
); | ||
callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; | ||
|
||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); | ||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); | ||
const abiEncoder = self._lookupAbiEncoder('{{this.functionSignature}}'); | ||
// tslint:disable boolean-naming | ||
const result = abiEncoder.strictDecodeReturnValue<{{> return_type outputs=outputs}}>(rawCallResult); | ||
// tslint:enable boolean-naming | ||
return result; | ||
}, | ||
getABIEncodedTransactionData( | ||
{{> typed_params inputs=inputs}} | ||
): string { | ||
{{#each inputs}} | ||
{{#assertionType name type}}{{/assertionType}} | ||
{{/each}} | ||
const self = this as any as {{contractName}}Contract; | ||
const abiEncodedTransactionData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> params inputs=inputs}}]); | ||
return abiEncodedTransactionData; | ||
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{{#each inputs}} | ||
{{name}}{{#ifEquals 'address' type}}.toLowerCase(){{/ifEquals}}{{#if @last}}{{else}},{{/if}} | ||
{{/each}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{{#each inputs}} | ||
{{name}}{{#if @last}}{{else}},{{/if}} | ||
{{/each}} | ||
{{/each}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ | |
{{/singleReturnValue}} | ||
{{else}} | ||
void | ||
{{/if}} | ||
{{/if}} |
Oops, something went wrong.