-
Notifications
You must be signed in to change notification settings - Fork 9
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
(Partially) Remove 30000 #450
Open
shjortConcordium
wants to merge
6
commits into
main
Choose a base branch
from
remove-30000
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4aea02b
Remove hardcoded energy from wCCD
ca6bad1
Remove hardcoded energy for update in nft-minting
272a674
Remove hardcoded energy from eSealing
c6d3bd1
Update version/CHANGELOG
3968d53
Add EPSILON energy to eSealing, wCCD, nft-minting
soer8647 ea47bc9
Improve error messages from invokes in examples
soer8647 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "e_sealing", | ||
"packageManager": "[email protected]", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"@concordium/react-components": "^0.4.0", | ||
|
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 |
---|---|---|
@@ -1,5 +1,15 @@ | ||
import { createContext } from 'react'; | ||
import { AccountTransactionType, CcdAmount, ContractAddress, Energy, ReceiveName } from '@concordium/web-sdk'; | ||
import { | ||
AccountAddress, | ||
AccountTransactionType, | ||
CcdAmount, | ||
ConcordiumGRPCClient, | ||
ContractAddress, | ||
ContractName, | ||
EntrypointName, | ||
ReceiveName, | ||
serializeUpdateContractParameters, | ||
} from '@concordium/web-sdk'; | ||
import { WalletConnection, moduleSchemaFromBase64 } from '@concordium/react-components'; | ||
import { E_SEALING_CONTRACT_NAME, E_SEALING_RAW_SCHEMA } from './constants'; | ||
|
||
|
@@ -8,23 +18,46 @@ import { E_SEALING_CONTRACT_NAME, E_SEALING_RAW_SCHEMA } from './constants'; | |
*/ | ||
export async function register( | ||
connection: WalletConnection, | ||
grpcClient: ConcordiumGRPCClient, | ||
account: string, | ||
fileHashHex: string, | ||
index: bigint, | ||
subindex = 0n | ||
) { | ||
const contractAddress = ContractAddress.create(index, subindex); | ||
const receiveName = ReceiveName.fromString(`${E_SEALING_CONTRACT_NAME}.registerFile`); | ||
|
||
const schema = moduleSchemaFromBase64(E_SEALING_RAW_SCHEMA); | ||
const serializedParameters = serializeUpdateContractParameters( | ||
ContractName.fromString(E_SEALING_CONTRACT_NAME), | ||
EntrypointName.fromString('registerFile'), | ||
fileHashHex, | ||
schema.value | ||
); | ||
|
||
const invokeResult = await grpcClient.invokeContract({ | ||
contract: contractAddress, | ||
method: receiveName, | ||
invoker: AccountAddress.fromBase58(account), | ||
parameter: serializedParameters, | ||
}); | ||
|
||
if (invokeResult.tag === 'failure') { | ||
throw Error('Transaction would fail!'); | ||
} | ||
|
||
return connection.signAndSendTransaction( | ||
account, | ||
AccountTransactionType.Update, | ||
{ | ||
amount: CcdAmount.fromMicroCcd(0), | ||
address: ContractAddress.create(index, subindex), | ||
receiveName: ReceiveName.fromString(`${E_SEALING_CONTRACT_NAME}.registerFile`), | ||
maxContractExecutionEnergy: Energy.create(30000n), | ||
address: contractAddress, | ||
receiveName, | ||
maxContractExecutionEnergy: invokeResult.usedEnergy, | ||
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. Adding a small margin
Applies to the other examples below as well. |
||
}, | ||
{ | ||
parameters: fileHashHex, | ||
schema: moduleSchemaFromBase64(E_SEALING_RAW_SCHEMA), | ||
schema, | ||
} | ||
); | ||
} | ||
|
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "wccd", | ||
"packageManager": "[email protected]", | ||
"version": "4.1.2", | ||
"version": "4.1.3", | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"@concordium/react-components": "^0.4.0", | ||
|
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.
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.
It would be helpful if that error message reports the reason for the failure. The following, I suggest to cover:
rejectReason
of the smart contract if present.invokeResult.tag
(if it is notfailure
) since that is where we can seeOutOfEnergy
errors:https://github.com/Concordium/concordium-smart-contract-tools/blob/main/front-end-tools/src/utils.ts#L209
Reason for adding this reporting of errors now:
Before, people who reported problems while using this front end were able to give us a "failedTransactionHash" that we could use for further investigation. We don't have this anymore, so reporting potential problems here is what we have to rely on now.
This comment applies to the other examples as well.