Skip to content

Commit

Permalink
Merge branch 'ethereum-wallets' into ik/worflow-package-publish
Browse files Browse the repository at this point in the history
  • Loading branch information
yellowCrimsonGator committed May 22, 2024
2 parents 72c3559 + 7a6c373 commit b57ce59
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions packages/ethereum-wallets/src/lib/modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,15 @@ export function createModal({
tx.actions[0].type === "AddKey"
? tx.actions[0].params.accessKey.permission === "FullAccess"
? "<p>WARNING: The application is requesting a FullAccess key, you can loose your account and all your assets, only approve this transaction if you know what you are doing !!!<p>"
: tx.actions[0].params.accessKey.permission.allowance === "0" &&
tx.actions[0].params.publicKey === relayerPublicKey &&
tx.actions[0].params.accessKey.permission.receiverId ===
tx.signerId &&
tx.actions[0].params.accessKey.permission.methodNames
?.length === 1 &&
tx.actions[0].params.accessKey.permission.methodNames[0] ===
RLP_EXECUTE
? "<p>This transaction will onboard your account and enable you to transact on NEAR Protocol.</p>"
: `
<p>Connect to ${
tx.actions[0].params.accessKey.permission.receiverId
Expand All @@ -167,7 +176,11 @@ export function createModal({
)
} NEAR
</p>
<p>This allowance is spendable by the application towards network fees incurred during use.</p>
${
tx.actions[0].params.accessKey.permission.allowance === "0"
? "<p>WARNING: this key will have unlimited allowance spendable towards network fees, only approve this transaction if you trust the application and you know what you are doing !!!</p>"
: "<p>This allowance is spendable by the application towards network fees incurred during use.</p>"
}
`
: tx.actions[0].type === "DeleteKey"
? "<p>This is an optional transaction which removes the application access key. If you reject the transaction, the key will be reused when you login again.</p>"
Expand Down Expand Up @@ -195,22 +208,6 @@ export function createModal({
`
: "Unknown transaction type."
}
${
// Relayer onboarding
tx.actions[0].type === "AddKey" &&
tx.actions[0].params.accessKey.permission !== "FullAccess" &&
tx.actions[0].params.accessKey.permission.allowance === "0"
? tx.actions[0].params.publicKey === relayerPublicKey &&
tx.actions[0].params.accessKey.permission.receiverId ===
tx.signerId &&
tx.actions[0].params.accessKey.permission.methodNames?.length ===
1 &&
tx.actions[0].params.accessKey.permission.methodNames[0] ===
RLP_EXECUTE
? "<p>This transaction will onboard your account and enable you to send the next transactions.</p>"
: "<p>WARNING: this key has unlimited allowance and can spend all your NEAR, only approve this transaction if you know what you are doing !!!</p>"
: ""
}
<p>Transaction Details:</p>
<p>${JSON.stringify(tx.actions[0], null, 2)}</p>
<p>
Expand Down

0 comments on commit b57ce59

Please sign in to comment.