-
Notifications
You must be signed in to change notification settings - Fork 58
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
feat: add Near.signAndSendTransactions #159
base: dev
Are you sure you want to change the base?
Conversation
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.
Please rebase on top of dev
branch. See https://github.com/NearSocial/VM/blob/master/CONTRIBUTING.md
if (lastReceiverId !== action.contractName) { | ||
transactions.push({ | ||
receiverId: action.contractName, | ||
actions: [{ type: "FunctionCall", params: action }], | ||
}); | ||
} else { | ||
transactions[transactions.length - 1].actions.push({ | ||
type: "FunctionCall", | ||
params: action, | ||
}); | ||
} |
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.
You still need to limit the max gas amount per transaction. As 2FA contracts are not the issue, the max gas should be 300Tgas
Carefully! You add a full access key; with this key | ||
you can sign any transaction on behalf of your | ||
account. The key has full access to your tokens. |
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.
I think we should display the warning message at the top of the confirmation window.
Also display a warning message for all non default actions. E.g. contract deploy on your account, all key actions, account deletion.
<div> | ||
<span className="text-secondary">Code:</span> | ||
<span className="font-monospace"> | ||
{action.params.code} |
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.
What's the format of the code? Should we display just the base58 hash?
{displayGas(action.params.gas || TGas.mul(30))} | ||
</span> | ||
</div> | ||
<Markdown text={jsonMarkdown(action.params.args)} /> |
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.
Someone asked me to include binary data here. Not sure how we want to handle it. We can always add this later.
import { Markdown } from "./Markdown"; | ||
import { displayGas, displayNear, Loading } from "../data/utils"; | ||
import { useNear } from "../data/near"; | ||
import { formatNearAmount } from "near-api-js/lib/utils/format"; |
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.
I don't like the implementation of the formatNearAmount
. It doesn't understand yoctoNear. Let's stick with displayNear for consistency. We can fix it later
@AZbang This is great! Would you be able to push this PR through the finish line? |
Added Near.signAndSendTransactions for support all types actions. The method is fully compatible with the wallet-selector format. For example:
Also added UI for confirmation modal. You can test it on my gateway:
https://call-any-actions-near-social.surge.sh/#/azbang.near/widget/ExportAccount