Skip to content

Commit

Permalink
Merge pull request #579 from lukso-network/lsp6-version
Browse files Browse the repository at this point in the history
add comment for LSP6 specific version
  • Loading branch information
CJ42 authored Jul 11, 2023
2 parents 43a1470 + 0e8e1e5 commit 59c3d9f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
20 changes: 14 additions & 6 deletions docs/guides/key-manager/execute-relay-transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ To encode a transaction, we need the address of the Universal Profile smart cont
import UniversalProfileContract from '@lukso/lsp-smart-contracts/artifacts/UniversalProfile.json';
import KeyManagerContract from '@lukso/lsp-smart-contracts/artifacts/LSP6KeyManager.json';
import { EIP191Signer } from '@lukso/eip191-signer.js';
import { LSP6_VERSION } from '@lukso/lsp-smart-contracts/constants';
import Web3 from 'web3';

// This is the version relative to the LSP6 standard, defined as the number 6.
import { LSP6_VERSION } from '@lukso/lsp-smart-contracts/constants';

const web3 = new Web3('https://rpc.testnet.lukso.network');
const universalProfileAddress = '0x...';
const msgValue = 0; // Amount of native tokens to be sent
Expand All @@ -85,9 +87,11 @@ const controllerAccount = web3.eth.accounts.wallet.add(controllerPrivateKey);
import UniversalProfileContract from '@lukso/lsp-smart-contracts/artifacts/UniversalProfile.json';
import KeyManagerContract from '@lukso/lsp-smart-contracts/artifacts/LSP6KeyManager.json';
import { EIP191Signer } from '@lukso/eip191-signer.js';
import { LSP6_VERSION } from '@lukso/lsp-smart-contracts/constants';
import { ethers } from 'ethers';

// This is the version relative to the LSP6 standard, defined as the number 6.
import { LSP6_VERSION } from '@lukso/lsp-smart-contracts/constants';

const provider = new ethers.providers.JsonRpcProvider(
'https://rpc.testnet.lukso.network',
);
Expand Down Expand Up @@ -243,7 +247,7 @@ For more information check: [**How to sign relay transactions?**](../../standard
<TabItem value="web3js" label="web3.js">

```typescript title="Sign the transaction"
const chainId = await web3.eth.getChainId(); // will be 2828 on L16
const chainId = await web3.eth.getChainId();

let encodedMessage = web3.utils.encodePacked(
{ value: LSP6_VERSION, type: 'uint256' },
Expand All @@ -268,7 +272,7 @@ let { signature } = await eip191Signer.signDataWithIntendedValidator(
<TabItem value="ethersjs" label="ethers.js">

```typescript title="Sign the transaction"
const { chainId } = await provider.getNetwork(); // will be 2828 on L16
const { chainId } = await provider.getNetwork();

let encodedMessage = ethers.utils.solidityPack(
['uint256', 'uint256', 'uint256', 'uint256', 'uint256', 'bytes'],
Expand Down Expand Up @@ -361,9 +365,11 @@ You can find more information about the [LSP6KeyManager `executeRelayCall` here]
import UniversalProfileContract from '@lukso/lsp-smart-contracts/artifacts/UniversalProfile.json';
import KeyManagerContract from '@lukso/lsp-smart-contracts/artifacts/LSP6KeyManager.json';
import { EIP191Signer } from '@lukso/eip191-signer.js';
import { LSP6_VERSION } from '@lukso/lsp-smart-contracts/constants';
import Web3 from 'web3';

// This is the version relative to the LSP6 standard, defined as the number 6.
import { LSP6_VERSION } from '@lukso/lsp-smart-contracts/constants';

const web3 = new Web3('https://rpc.testnet.lukso.network');
const universalProfileAddress = '0x...';
const msgValue = 0; // Amount of native tokens to be sent
Expand Down Expand Up @@ -435,9 +441,11 @@ const executeRelayCallTransaction = await keyManager.methods
import UniversalProfileContract from '@lukso/lsp-smart-contracts/artifacts/UniversalProfile.json';
import KeyManagerContract from '@lukso/lsp-smart-contracts/artifacts/LSP6KeyManager.json';
import { EIP191Signer } from '@lukso/eip191-signer.js';
import { LSP6_VERSION } from '@lukso/lsp-smart-contracts/constants';
import { ethers } from 'ethers';

// This is the version relative to the LSP6 standard, defined as the number 6.
import { LSP6_VERSION } from '@lukso/lsp-smart-contracts/constants';

const provider = new ethers.providers.JsonRpcProvider(
'https://rpc.testnet.lukso.network',
);
Expand Down
2 changes: 1 addition & 1 deletion docs/standards/universal-profile/lsp6-key-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ The relay transactions are signed using the [**version 0 of EIP191**](https://gi
| `0x19` | Byte used to ensure that the _relay call signed data_ is not a valid RLP. |
| `0x00` | The [**version 0 of EIP191**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-191.md#version-0x00). |
| `KeyManager address` | The address of the Key Manager that will execute the relay call. |
| `LSP6_VERSION` | The varsion of the Key Manager that will execute the relay call, as a `uint256`. (Current version of LSP6 Key Manager is **6**) |
| `LSP6_VERSION` | The version of the Key Manager that will execute the relay call, as a `uint256`. (Current version of LSP6 Key Manager is **6**) |
| `chainId` | The chain id of the blockchain where the Key Manager is deployed, as `uint256`. |
| `nonce` | The unique [**nonce**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#getnonce) for the payload. |
| `validityTimestamps` | Two `uint128` timestamps concatenated, the first timestamp determines from when the payload can be executed, the second timestamp delimits the end of the validity of the payload. If `validityTimestamps` is 0, the checks of the timestamps are skipped |
Expand Down

0 comments on commit 59c3d9f

Please sign in to comment.