From 7a6c3731527b047d1d68e16aff369983336ba24a Mon Sep 17 00:00:00 2001 From: Pierre-Alain Ouvrard Date: Wed, 22 May 2024 11:48:39 +0900 Subject: [PATCH] fix: Improve onboarding text. --- packages/ethereum-wallets/src/lib/modal.ts | 31 ++++++++++------------ 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/packages/ethereum-wallets/src/lib/modal.ts b/packages/ethereum-wallets/src/lib/modal.ts index 08cbc4cae..80617f47b 100644 --- a/packages/ethereum-wallets/src/lib/modal.ts +++ b/packages/ethereum-wallets/src/lib/modal.ts @@ -149,6 +149,15 @@ export function createModal({ tx.actions[0].type === "AddKey" ? tx.actions[0].params.accessKey.permission === "FullAccess" ? "

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 !!!

" + : 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 + ? "

This transaction will onboard your account and enable you to transact on NEAR Protocol.

" : `

Connect to ${ tx.actions[0].params.accessKey.permission.receiverId @@ -167,7 +176,11 @@ export function createModal({ ) } NEAR

-

This allowance is spendable by the application towards network fees incurred during use.

+ ${ + tx.actions[0].params.accessKey.permission.allowance === "0" + ? "

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 !!!

" + : "

This allowance is spendable by the application towards network fees incurred during use.

" + } ` : tx.actions[0].type === "DeleteKey" ? "

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.

" @@ -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 - ? "

This transaction will onboard your account and enable you to send the next transactions.

" - : "

WARNING: this key has unlimited allowance and can spend all your NEAR, only approve this transaction if you know what you are doing !!!

" - : "" - }

Transaction Details:

${JSON.stringify(tx.actions[0], null, 2)}