fix(BC)_:Add account and chainID to the `permissionGranted` event

This commit is contained in:
Alex Jbanca 2024-10-30 16:51:01 +02:00 committed by Anthony Laibe
parent 9a45ae09ca
commit 3f96b8430b
2 changed files with 17 additions and 3 deletions

View File

@ -62,7 +62,7 @@ func (c *RequestAccountsCommand) Execute(ctx context.Context, request RPCRequest
if err != nil {
return "", err
}
signal.SendConnectorDAppPermissionGranted(connectorDApp)
signal.SendConnectorDAppPermissionGranted(connectorDApp, account, []uint64{chainID})
}
return FormatAccountAddressToResponse(dApp.SharedAccount), nil

View File

@ -1,5 +1,9 @@
package signal
import (
"github.com/status-im/status-go/eth-node/types"
)
const (
EventConnectorSendRequestAccounts = "connector.sendRequestAccounts"
EventConnectorSendTransaction = "connector.sendTransaction"
@ -29,6 +33,12 @@ type ConnectorSendTransactionSignal struct {
TxArgs string `json:"txArgs"`
}
type ConnectorSendDappPermissionGrantedSignal struct {
ConnectorDApp
Chains []uint64 `json:"chains"`
SharedAccount types.Address `json:"sharedAccount"`
}
type ConnectorPersonalSignSignal struct {
ConnectorDApp
RequestID string `json:"requestId"`
@ -66,8 +76,12 @@ func SendConnectorPersonalSign(dApp ConnectorDApp, requestID, challenge, address
})
}
func SendConnectorDAppPermissionGranted(dApp ConnectorDApp) {
send(EventConnectorDAppPermissionGranted, dApp)
func SendConnectorDAppPermissionGranted(dApp ConnectorDApp, account types.Address, chains []uint64) {
send(EventConnectorDAppPermissionGranted, ConnectorSendDappPermissionGrantedSignal{
ConnectorDApp: dApp,
Chains: chains,
SharedAccount: account,
})
}
func SendConnectorDAppPermissionRevoked(dApp ConnectorDApp) {