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
parent b329b158c8
commit 0894b5edb7
No known key found for this signature in database
GPG Key ID: 6004079575C21C5D
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) {