Skip to main content

🆙 RPC API

The LUKSO UP Browser Extension uses the RPC API methods from the table below. The methods are grouped by category: signing methods, standard methods, and LUKSO-specific methods.

Supported Methods

NameType
eth_signsigning
personal_signsigning
eth_accountsstandard
eth_requestAccountsstandard
eth_sendTransactionstandard
wallet_switchEthereumChainstandard
up_addTransactionRelayerLUKSO specific
up_importLUKSO specific
up_generateLSP23AddressLUKSO specific

Signing

eth_sign

tip

We encourage developers to use eth_sign for signing purposes.

While a security issue potentially existed in the initial implementation on Ethereum, the current implementation has no such potential exploit. As such usage of this method is preferable to personal_sign.

This method returns a EIP-191 signature over the data provided to the call. It requests that the user provides an Ethereum address that should sign the transaction as well as the data (encoded bytes) that are to be executed.

Returns

string - on a successful call the method returns a signature, a string representing hex encoded bytes or an error with code 4001 - if the user rejects the requets

personal_sign

The personal_sign endpoint is enabled to allow for backward compatibility. However, its use is not recommended. Some libraries such as Ethers.js end up using personal_sign under the hood. That is why, for compatibility reasons, personal_sign is left enabled. Note however that personal_sign ultimately acts as a proxy, redirecting the call to the eth_sign method.

Standard

eth_sendTransaction

Creates new message call transaction and signs it using the account specified in from. This method requires that the user has granted permission to interact with their account first. The transaction will not be signed by the UP itself, but by a controller address that has sufficient permissions.

eth_requestAccounts

This method is specified by EIP-1102. Calling this method may trigger a user interface that allows the user to approve or reject account access for a given DApp.

Returns

string[] - an array of accounts or throws an error with code 4001 if the request was rejected by the user.

wallet_switchEthereumChain

This method implements EIP-3326. It allows Dapps to request that a wallet switches its active chain (connection).

The method requires that a target chain ID is provided

Returns

null or error - the method will return null if successful or throw an error otherwise

eth_accounts

Similar to the eth_requestAccounts this method returns all of the addresses that the user has approved for the DApp. This method does not trigger a user interface.

Returns

string[] - a successful request returns an array of hexadecimal Ethereum address strings

LUKSO Specific

up_addTransactionRelayer

Add a custom relayer.

Parameters

1. relayer - Object

Object containing the new relayer properties. To find more information about custom relayers, you can read the Transaction Relay Service API.

NameTypeDescription
nameStringThe name of the relayer.
apiUrlStringThe base API URL.
chainIdsArrayArray of string (hex) or int.
params: [
{
name: 'My Relayer',
apiUrl: 'https://relayer.testnet.staging.lukso.dev/api/v1/',
chainIds: [4201],
},
];

Returns

1. String Array - Array of Universal Profile addresses the user selected for this relay service

It returns an array of Universal Profile addresses.

up_import

Add a Universal Profile address to the UP Browser Extension.

Parameters

1. String - Universal Profile address to add to the extension

The Universal Profile address to add.

params: ['0x311611C9A46a192C14Ea993159a0498EDE5578aC'];

Returns

1. String - New controller address, to be added to the profile by the dapp.

up_generateLSP23Address

It allows the creation of a Universal Profile for the UP Browser Extension using the LSP23 Standard, which under the hood will wrap many operations/transactions into one, simplifying deployment.

To perform the deployment of a Universal Profile, the dApp needs the salt and the controllerAddress. The controllerAddress will be injected in the dataKeys and dataValues array, then the salt and the encoded dataKeys and dataValues are sent to the relayer to deploy the profile. Previously, the relayer had to do several consecutive transactions to deploy a profile. Now, all those transactions are taking place at the smart contract level, so the relayer only creates one transaction.

up_generateLSP23Address: should be used for creating a new Universal Profile using the UP Browser Extension

up_import: should be used for adding already existing Universal Profiles to the UP Browser Extension

Parameters
NameTypeDescription
primaryImplementationContractAddressstringUniversal Profile implementation address
secondaryImplementationContractAddressstringKey Manager implementation address
secondaryContractInitializationCalldatastringinitialization calldata for for the Key Manager contract
secondaryContractAddControlledContractAddressbooleanthe my.universalprofile.cloud sets it as true
secondaryContractExtraInitializationParamsstringmy.universalprofile.cloud sets it as '0x'
upPostDeploymentModuleAddressstringaddress of the post deployment module
linkedContractsFactoryAddressstring address of the linkedContractsFactory (LSP23)
dataKeysstring[] data that will be set on a smart contract, e.g: adding controllers, adding LSP3 metadata, or adding default controller permissions
dataValuesstring[] data that will be set on a smart contract, e.g: adding controllers, adding LSP3 metadata, or adding default controller permissions
dataKeysControllerIndexnumber an array index where the controller key is placed
dataValuesControllerIndexnumber array index where the controller value is placed

Returns

NameType
saltstring
controllerAddressstring
upAddressupAddress

Additional Resources