-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix web3config setconfig #6555
Merged
fix web3config setconfig #6555
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
b9bc95e
add web3config
b5b5835
Merge branch '4.x' into 6455
bb17b1f
Merge branch '4.x' into 6455
62ed18d
fix config to emit properly
a9b0f30
fix lint
b5b303c
fix testcases and change emit for contracts
fb898b2
fix lint
c71d770
Merge branch '4.x' into 6455
b46bfa2
remove unneccesary code
7085a7b
update tests
e40efa8
remove test
49b75d9
update changelog and format
2073a4e
update changelog
a6cb1aa
Merge branch '4.x' into 6455
a3c8517
fix contracts creation in web3 package
ca440d0
fix linter
c3d1363
format
a30ca22
format
d8422a6
Merge branch '4.x' into 6455
f2de1bf
add validation
1c56741
add test and address feedback
95e5183
update changelog
bc3c89e
update tests
83f4933
update
be3c2fa
fix tests
af85f44
update test
cfd84b6
update time
7b436a3
add promises to fix parallel tests
99432fd
revert
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -241,7 +241,6 @@ export class Contract<Abi extends ContractAbi> | |
* RPC provider when using contract methods. | ||
* Default is `input` | ||
*/ | ||
private readonly _dataInputFill?: 'data' | 'input' | 'both'; | ||
|
||
private context?: Web3Context; | ||
/** | ||
|
@@ -369,17 +368,11 @@ export class Contract<Abi extends ContractAbi> | |
: isDataFormat(optionsOrContextOrReturnFormat) | ||
? optionsOrContextOrReturnFormat | ||
: returnFormat ?? DEFAULT_RETURN_FORMAT; | ||
|
||
const address = | ||
typeof addressOrOptionsOrContext === 'string' ? addressOrOptionsOrContext : undefined; | ||
|
||
if (this.config.contractDataInputFill === 'both') { | ||
this._dataInputFill = this.config.contractDataInputFill; | ||
} else { | ||
this._dataInputFill = | ||
this.config.contractDataInputFill = | ||
(options as ContractInitOptions)?.dataInputFill ?? | ||
this.config.contractDataInputFill; | ||
} | ||
this._parseAndSetJsonInterface(jsonInterface, returnDataFormat); | ||
|
||
if (!isNullish(address)) { | ||
|
@@ -409,6 +402,13 @@ export class Contract<Abi extends ContractAbi> | |
set: (value: ContractAbi) => this._parseAndSetJsonInterface(value, returnDataFormat), | ||
get: () => this._jsonInterface, | ||
}); | ||
|
||
if (contractContext instanceof Web3Context) { | ||
contractContext.on(Web3ConfigEvent.CONFIG_CHANGE, event => { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
this.setConfig({ [event.name]: event.newValue }); | ||
luu-alex marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}); | ||
} | ||
Comment on lines
+406
to
+411
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you, please, update the CHANGELOG.md? |
||
} | ||
|
||
/** | ||
|
@@ -501,7 +501,7 @@ export class Contract<Abi extends ContractAbi> | |
data: this.options.data, | ||
provider: this.currentProvider, | ||
syncWithContext: this.syncWithContext, | ||
dataInputFill: this._dataInputFill, | ||
dataInputFill: this.config.contractDataInputFill, | ||
}, | ||
this.getContextObject(), | ||
); | ||
|
@@ -516,7 +516,7 @@ export class Contract<Abi extends ContractAbi> | |
data: this.options.data, | ||
provider: this.currentProvider, | ||
syncWithContext: this.syncWithContext, | ||
dataInputFill: this._dataInputFill, | ||
dataInputFill: this.config.contractDataInputFill, | ||
}, | ||
this.getContextObject(), | ||
); | ||
|
@@ -1014,7 +1014,7 @@ export class Contract<Abi extends ContractAbi> | |
params, | ||
options: { | ||
...options, | ||
dataInputFill: this._dataInputFill, | ||
dataInputFill: this.config.contractDataInputFill, | ||
}, | ||
contractOptions: { | ||
...this.options, | ||
|
@@ -1088,7 +1088,7 @@ export class Contract<Abi extends ContractAbi> | |
checkRevertBeforeSending: false, | ||
contractAbi: this._jsonInterface, | ||
}); | ||
|
||
// eslint-disable-next-line no-void | ||
void transactionToSend.on('error', (error: unknown) => { | ||
if (error instanceof ContractExecutionError) { | ||
|
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
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
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you, please, mention this in the CHANGELOG.md.